: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(hogql): compare date bounds in the project time zone at 6 decimals (#109625)
Andy Zhao6ddbcb2e2bf7
diff --git a/posthog/hogql/database/schema/test/__snapshots__/test_persons_revenue_analytics.ambr b/posthog/hogql/database/schema/test/__snapshots__/test_persons_revenue_analytics.ambrindex 2d67837b0ec4..0e03cd9454d5 100644--- a/posthog/hogql/database/schema/test/__snapshots__/test_persons_revenue_analytics.ambr+++ b/posthog/hogql/database/schema/test/__snapshots__/test_persons_revenue_analytics.ambr@@ -4133,7 +4133,7 @@WHERE ifNull(notEquals(person_id, accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')), isNotNull(person_id)or isNotNull(accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')))GROUP BY person_id) AS e__pdi__person__revenue_analytics ON equals(e__pdi__person.e__pdi__person___id, e__pdi__person__revenue_analytics.person_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY day_start, breakdown_value_1)GROUP BY day_start, breakdown_value_1ORDER BY day_start ASC, breakdown_value ASC)@@ -4342,7 +4342,7 @@WHERE ifNull(notEquals(person_id, accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')), isNotNull(person_id)or isNotNull(accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')))GROUP BY person_id) AS e__poe__revenue_analytics ON equals(e.person_id, e__poe__revenue_analytics.person_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY day_start,breakdown_value_1)GROUP BY day_start,@@ -4477,7 +4477,7 @@WHERE ifNull(notEquals(person_id, accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')), isNotNull(person_id)or isNotNull(accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')))GROUP BY person_id) AS e__poe__revenue_analytics ON equals(if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id), e__poe__revenue_analytics.person_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY day_start, breakdown_value_1)GROUP BY day_start, breakdown_value_1ORDER BY day_start ASC, breakdown_value ASC)@@ -4610,7 +4610,7 @@WHERE ifNull(notEquals(person_id, accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')), isNotNull(person_id)or isNotNull(accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')))GROUP BY person_id) AS e__person__revenue_analytics ON equals(e__person.e__person___id, e__person__revenue_analytics.person_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY day_start, breakdown_value_1)GROUP BY day_start, breakdown_value_1ORDER BY day_start ASC, breakdown_value ASC)@@ -5031,7 +5031,7 @@WHERE ifNull(notEquals(person_id, accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')), isNotNull(person_id)or isNotNull(accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')))GROUP BY person_id) AS e__pdi__person__revenue_analytics ON equals(e__pdi__person.e__pdi__person___id, e__pdi__person__revenue_analytics.person_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY day_start,breakdown_value_1)GROUP BY day_start,@@ -5174,7 +5174,7 @@WHERE ifNull(notEquals(person_id, accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')), isNotNull(person_id)or isNotNull(accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')))GROUP BY person_id) AS e__poe__revenue_analytics ON equals(e.person_id, e__poe__revenue_analytics.person_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY day_start,breakdown_value_1)GROUP BY day_start,@@ -5324,7 +5324,7 @@WHERE ifNull(notEquals(person_id, accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')), isNotNull(person_id)or isNotNull(accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')))GROUP BY person_id) AS e__poe__revenue_analytics ON equals(if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id), e__poe__revenue_analytics.person_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY day_start,breakdown_value_1)GROUP BY day_start,@@ -5481,7 +5481,7 @@WHERE ifNull(notEquals(person_id, accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')), isNotNull(person_id)or isNotNull(accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')))GROUP BY person_id) AS e__person__revenue_analytics ON equals(e__person.e__person___id, e__person__revenue_analytics.person_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY day_start,breakdown_value_1)GROUP BY day_start,diff --git a/posthog/hogql/database/schema/test/__snapshots__/test_persons_revenue_analytics.new_events_schema.ambr b/posthog/hogql/database/schema/test/__snapshots__/test_persons_revenue_analytics.new_events_schema.ambrindex 9aa02214e6cd..34e72f1ae9ac 100644--- a/posthog/hogql/database/schema/test/__snapshots__/test_persons_revenue_analytics.new_events_schema.ambr+++ b/posthog/hogql/database/schema/test/__snapshots__/test_persons_revenue_analytics.new_events_schema.ambr@@ -877,7 +877,7 @@WHERE ifNull(notEquals(person_id, accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')), isNotNull(person_id)or isNotNull(accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')))GROUP BY person_id) AS e__pdi__person__revenue_analytics ON equals(e__pdi__person.e__pdi__person___id, e__pdi__person__revenue_analytics.person_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY day_start, breakdown_value_1)GROUP BY day_start, breakdown_value_1ORDER BY day_start ASC, breakdown_value ASC)@@ -1237,11 +1237,12 @@e__poe__revenue_analytics.person_id)WHERE and(equals(e.team_id,99999), greaterOrEquals(e.timestamp,- toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00',- 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp,- assumeNotNull(toDateTime('2025-05-30 23:59:59',- 'UTC'))), equals(e.event,- '$pageview'))+ toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00',+ 'UTC')), toIntervalDay(1)), 6,+ 'UTC')), lessOrEquals(e.timestamp,+ assumeNotNull(toDateTime('2025-05-30 23:59:59',+ 'UTC'))), equals(e.event,+ '$pageview'))GROUP BY day_start,breakdown_value_1)GROUP BY day_start,@@ -1386,7 +1387,7 @@WHERE ifNull(notEquals(person_id, accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')), isNotNull(person_id)or isNotNull(accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')))GROUP BY person_id) AS e__poe__revenue_analytics ON equals(if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id), e__poe__revenue_analytics.person_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY day_start, breakdown_value_1)GROUP BY day_start, breakdown_value_1ORDER BY day_start ASC, breakdown_value ASC)@@ -1520,7 +1521,7 @@WHERE ifNull(notEquals(person_id, accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')), isNotNull(person_id)or isNotNull(accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')))GROUP BY person_id) AS e__person__revenue_analytics ON equals(e__person.e__person___id, e__person__revenue_analytics.person_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY day_start, breakdown_value_1)GROUP BY day_start, breakdown_value_1ORDER BY day_start ASC, breakdown_value ASC)@@ -1609,7 +1610,7 @@WHERE ifNull(notEquals(person_id, accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')), isNotNull(person_id)or isNotNull(accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')))GROUP BY person_id) AS e__pdi__person__revenue_analytics ON equals(e__pdi__person.e__pdi__person___id, e__pdi__person__revenue_analytics.person_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY day_start,breakdown_value_1)GROUP BY day_start,@@ -1754,7 +1755,7 @@WHERE ifNull(notEquals(person_id, accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')), isNotNull(person_id)or isNotNull(accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')))GROUP BY person_id) AS e__poe__revenue_analytics ON equals(e.person_id, e__poe__revenue_analytics.person_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY day_start,breakdown_value_1)GROUP BY day_start,@@ -1906,7 +1907,7 @@WHERE ifNull(notEquals(person_id, accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')), isNotNull(person_id)or isNotNull(accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')))GROUP BY person_id) AS e__poe__revenue_analytics ON equals(if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id), e__poe__revenue_analytics.person_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY day_start,breakdown_value_1)GROUP BY day_start,@@ -2065,7 +2066,7 @@WHERE ifNull(notEquals(person_id, accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')), isNotNull(person_id)or isNotNull(accurateCastOrNull('00000000-0000-0000-0000-000000000000', 'UUID')))GROUP BY person_id) AS e__person__revenue_analytics ON equals(e__person.e__person___id, e__person__revenue_analytics.person_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-05-29 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2025-05-30 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY day_start,breakdown_value_1)GROUP BY day_start,diff --git a/posthog/hogql/database/schema/test/__snapshots__/test_session_replay_events.ambr b/posthog/hogql/database/schema/test/__snapshots__/test_session_replay_events.ambrindex cb01594cb3f2..238a4e9017df 100644--- a/posthog/hogql/database/schema/test/__snapshots__/test_session_replay_events.ambr+++ b/posthog/hogql/database/schema/test/__snapshots__/test_session_replay_events.ambr@@ -91,7 +91,7 @@JOIN(SELECT events.event AS event,events.`$session_id` AS `$session_id`- FROM events PREWHERE greaterOrEquals(events.timestamp, minus(toDateTime64('today', 6, 'UTC'), toIntervalDay(90)))+ FROM events PREWHERE greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime64('today', 6, 'UTC'), toIntervalDay(90)), 6, 'UTC'))WHERE equals(events.team_id, 99999)) AS raw_session_replay_events__events ON equals(session_replay_events.session_id, raw_session_replay_events__events.`$session_id`)WHERE and(equals(session_replay_events.team_id, 99999), equals(raw_session_replay_events__events.event, '$pageview'))ORDER BY session_replay_events.session_id ASC@@ -116,7 +116,7 @@JOIN(SELECT replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$current_url'), ''), 'null'), '^"|"$', '') AS `properties___$current_url`,events.`$session_id` AS `$session_id`- FROM events PREWHERE greaterOrEquals(events.timestamp, minus(toDateTime64('today', 6, 'UTC'), toIntervalDay(90)))+ FROM events PREWHERE greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime64('today', 6, 'UTC'), toIntervalDay(90)), 6, 'UTC'))WHERE equals(events.team_id, 99999)) AS raw_session_replay_events__events ON equals(session_replay_events.session_id, raw_session_replay_events__events.`$session_id`)WHERE and(equals(session_replay_events.team_id, 99999), ifNull(like(raw_session_replay_events__events.`properties___$current_url`, '%example.com%'), 0))ORDER BY session_replay_events.session_id ASC@@ -165,7 +165,7 @@JOIN(SELECT replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$current_url'), ''), 'null'), '^"|"$', '') AS `properties___$current_url`,events.`$session_id` AS `$session_id`- FROM events PREWHERE greaterOrEquals(events.timestamp, minus(toDateTime64('today', 6, 'UTC'), toIntervalDay(90)))+ FROM events PREWHERE greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime64('today', 6, 'UTC'), toIntervalDay(90)), 6, 'UTC'))WHERE equals(events.team_id, 99999)) AS raw_session_replay_events__events ON equals(session_replay_events.session_id, raw_session_replay_events__events.`$session_id`)WHERE equals(session_replay_events.team_id, 99999)GROUP BY session_replay_events.session_id@@ -191,7 +191,7 @@JOIN(SELECT replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'person_property'), ''), 'null'), '^"|"$', '') AS poe___properties___person_property,events.`$session_id` AS `$session_id`- FROM events PREWHERE greaterOrEquals(events.timestamp, minus(toDateTime64('today', 6, 'UTC'), toIntervalDay(90)))+ FROM events PREWHERE greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime64('today', 6, 'UTC'), toIntervalDay(90)), 6, 'UTC'))WHERE equals(events.team_id, 99999)) AS raw_session_replay_events__events ON equals(session_replay_events.session_id, raw_session_replay_events__events.`$session_id`)WHERE and(equals(session_replay_events.team_id, 99999), ifNull(equals(ifNull(raw_session_replay_events__events.poe___properties___person_property, 'false'), 'true'), 0))ORDER BY session_replay_events.session_id ASCdiff --git a/posthog/hogql/database/schema/test/__snapshots__/test_session_replay_events.new_events_schema.ambr b/posthog/hogql/database/schema/test/__snapshots__/test_session_replay_events.new_events_schema.ambrindex 32f3ed779bdc..f1aaa70c99fa 100644--- a/posthog/hogql/database/schema/test/__snapshots__/test_session_replay_events.new_events_schema.ambr+++ b/posthog/hogql/database/schema/test/__snapshots__/test_session_replay_events.new_events_schema.ambr@@ -6,7 +6,7 @@JOIN(SELECT events.event AS event,events.properties.`$session_id` AS `$session_id`- FROM events_json AS events PREWHERE greaterOrEquals(events.timestamp, minus(toDateTime64('today', 6, 'UTC'), toIntervalDay(90)))+ FROM events_json AS events PREWHERE greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime64('today', 6, 'UTC'), toIntervalDay(90)), 6, 'UTC'))WHERE equals(events.team_id, 99999)) AS raw_session_replay_events__events ON equals(session_replay_events.session_id, raw_session_replay_events__events.`$session_id`)WHERE and(equals(session_replay_events.team_id, 99999), equals(raw_session_replay_events__events.event, '$pageview'))ORDER BY session_replay_events.session_id ASC@@ -32,7 +32,7 @@JOIN(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$current_url`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$current_url`)), if(isNull(nullIf(toString(events.properties.`$current_url`), '')), NULL, if(and(in(ascii(toString(events.properties.`$current_url`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$current_url`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$current_url`), '[]'), '{}'), toString(events.properties.`$current_url`)))) AS `properties___$current_url`,events.properties.`$session_id` AS `$session_id`- FROM events_json AS events PREWHERE greaterOrEquals(events.timestamp, minus(toDateTime64('today', 6, 'UTC'), toIntervalDay(90)))+ FROM events_json AS events PREWHERE greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime64('today', 6, 'UTC'), toIntervalDay(90)), 6, 'UTC'))WHERE equals(events.team_id, 99999)) AS raw_session_replay_events__events ON equals(session_replay_events.session_id, raw_session_replay_events__events.`$session_id`)WHERE and(equals(session_replay_events.team_id, 99999), ifNull(like(raw_session_replay_events__events.`properties___$current_url`, '%example.com%'), 0))ORDER BY session_replay_events.session_id ASC@@ -83,7 +83,7 @@JOIN(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$current_url`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$current_url`)), if(isNull(nullIf(toString(events.properties.`$current_url`), '')), NULL, if(and(in(ascii(toString(events.properties.`$current_url`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$current_url`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$current_url`), '[]'), '{}'), toString(events.properties.`$current_url`)))) AS `properties___$current_url`,events.properties.`$session_id` AS `$session_id`- FROM events_json AS events PREWHERE greaterOrEquals(events.timestamp, minus(toDateTime64('today', 6, 'UTC'), toIntervalDay(90)))+ FROM events_json AS events PREWHERE greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime64('today', 6, 'UTC'), toIntervalDay(90)), 6, 'UTC'))WHERE equals(events.team_id, 99999)) AS raw_session_replay_events__events ON equals(session_replay_events.session_id, raw_session_replay_events__events.`$session_id`)WHERE equals(session_replay_events.team_id, 99999)GROUP BY session_replay_events.session_id@@ -110,7 +110,7 @@JOIN(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^person_property)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^person_property)), if(isNull(nullIf(toString(events.person_properties.person_property), '')), NULL, if(and(in(ascii(toString(events.person_properties.person_property)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.person_property)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.person_property), '[]'), '{}'), toString(events.person_properties.person_property)))) AS poe___properties___person_property,events.properties.`$session_id` AS `$session_id`- FROM events_json AS events PREWHERE greaterOrEquals(events.timestamp, minus(toDateTime64('today', 6, 'UTC'), toIntervalDay(90)))+ FROM events_json AS events PREWHERE greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime64('today', 6, 'UTC'), toIntervalDay(90)), 6, 'UTC'))WHERE equals(events.team_id, 99999)) AS raw_session_replay_events__events ON equals(session_replay_events.session_id, raw_session_replay_events__events.`$session_id`)WHERE and(equals(session_replay_events.team_id, 99999), ifNull(equals(ifNull(raw_session_replay_events__events.poe___properties___person_property, 'false'), 'true'), 0))ORDER BY session_replay_events.session_id ASCdiff --git a/posthog/hogql/database/schema/util/test/__snapshots__/test_session_v2_where_clause_extractor.ambr b/posthog/hogql/database/schema/util/test/__snapshots__/test_session_v2_where_clause_extractor.ambrindex c98f498f2962..be3f30cc6d63 100644--- a/posthog/hogql/database/schema/util/test/__snapshots__/test_session_v2_where_clause_extractor.ambr+++ b/posthog/hogql/database/schema/util/test/__snapshots__/test_session_v2_where_clause_extractor.ambr@@ -174,7 +174,7 @@GROUP BYraw_sessions.session_id_v7) AS s__session ON equals(toUInt128(accurateCastOrNull(s.session_id, %(hogql_val_4)s)), s__session.session_id_v7)WHERE- and(equals(s.team_id, <TEAM_ID>), ifNull(equals(s__session.`$entry_pathname`, %(hogql_val_6)s), 0), greaterOrEquals(s.min_first_timestamp, toDateTime64(%(hogql_val_7)s, 6, %(hogql_val_8)s)), less(s.min_first_timestamp, now64(6, %(hogql_val_9)s)))+ and(equals(s.team_id, <TEAM_ID>), ifNull(equals(s__session.`$entry_pathname`, %(hogql_val_6)s), 0), greaterOrEquals(s.min_first_timestamp, toDateTime64(%(hogql_val_7)s, 6, %(hogql_val_8)s)), less(s.min_first_timestamp, toDateTime64(now64(6, %(hogql_val_9)s), 6, %(hogql_val_10)s)))GROUP BYs.session_idLIMIT 50000@@ -194,10 +194,10 @@FROMeventsWHERE- and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, today()))+ and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, toDateTime64(today(), 6, %(hogql_val_0)s)))LIMIT 50000) AS eventsLEFT JOIN (SELECT- dateDiff(%(hogql_val_0)s, min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_1)s)), max(toTimeZone(raw_sessions.max_timestamp, %(hogql_val_2)s))) AS `$session_duration`,+ dateDiff(%(hogql_val_1)s, min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_2)s)), max(toTimeZone(raw_sessions.max_timestamp, %(hogql_val_3)s))) AS `$session_duration`,raw_sessions.session_id_v7 AS session_id_v7FROMraw_sessionsdiff --git a/posthog/hogql/database/schema/util/test/__snapshots__/test_session_v2_where_clause_extractor.new_events_schema.ambr b/posthog/hogql/database/schema/util/test/__snapshots__/test_session_v2_where_clause_extractor.new_events_schema.ambrindex e30609511fd4..ea06edfe52c6 100644--- a/posthog/hogql/database/schema/util/test/__snapshots__/test_session_v2_where_clause_extractor.new_events_schema.ambr+++ b/posthog/hogql/database/schema/util/test/__snapshots__/test_session_v2_where_clause_extractor.new_events_schema.ambr@@ -125,10 +125,10 @@FROMevents_json AS eventsWHERE- and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, today()))+ and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, toDateTime64(today(), 6, %(hogql_val_0)s)))LIMIT 50000) AS eventsLEFT JOIN (SELECT- dateDiff(%(hogql_val_0)s, min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_1)s)), max(toTimeZone(raw_sessions.max_timestamp, %(hogql_val_2)s))) AS `$session_duration`,+ dateDiff(%(hogql_val_1)s, min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_2)s)), max(toTimeZone(raw_sessions.max_timestamp, %(hogql_val_3)s))) AS `$session_duration`,raw_sessions.session_id_v7 AS session_id_v7FROMraw_sessionsdiff --git a/posthog/hogql/database/schema/util/test/__snapshots__/test_session_v3_where_clause_extractor.ambr b/posthog/hogql/database/schema/util/test/__snapshots__/test_session_v3_where_clause_extractor.ambrindex 817e5586e371..b11fa664d0ea 100644--- a/posthog/hogql/database/schema/util/test/__snapshots__/test_session_v3_where_clause_extractor.ambr+++ b/posthog/hogql/database/schema/util/test/__snapshots__/test_session_v3_where_clause_extractor.ambr@@ -146,7 +146,7 @@GROUP BYraw_sessions_v3.session_id_v7) AS s__session ON equals(toUInt128(accurateCastOrNull(s.session_id, %(hogql_val_2)s)), s__session.session_id_v7)WHERE- and(equals(s.team_id, <TEAM_ID>), equals(s__session.`$entry_pathname`, %(hogql_val_4)s), greaterOrEquals(s.min_first_timestamp, toDateTime64(%(hogql_val_5)s, 6, %(hogql_val_6)s)), less(s.min_first_timestamp, now64(6, %(hogql_val_7)s)))+ and(equals(s.team_id, <TEAM_ID>), equals(s__session.`$entry_pathname`, %(hogql_val_4)s), greaterOrEquals(s.min_first_timestamp, toDateTime64(%(hogql_val_5)s, 6, %(hogql_val_6)s)), less(s.min_first_timestamp, toDateTime64(now64(6, %(hogql_val_7)s), 6, %(hogql_val_8)s)))GROUP BYs.session_idLIMIT 50000@@ -209,10 +209,10 @@FROMeventsWHERE- and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, today()))+ and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, toDateTime64(today(), 6, %(hogql_val_0)s)))LIMIT 50000) AS eventsLEFT JOIN (SELECT- dateDiff(%(hogql_val_0)s, min(toTimeZone(raw_sessions_v3.min_timestamp, %(hogql_val_1)s)), max(toTimeZone(raw_sessions_v3.max_timestamp, %(hogql_val_2)s))) AS `$session_duration`,+ dateDiff(%(hogql_val_1)s, min(toTimeZone(raw_sessions_v3.min_timestamp, %(hogql_val_2)s)), max(toTimeZone(raw_sessions_v3.max_timestamp, %(hogql_val_3)s))) AS `$session_duration`,raw_sessions_v3.session_id_v7 AS session_id_v7FROMraw_sessions_v3diff --git a/posthog/hogql/database/schema/util/test/__snapshots__/test_session_v3_where_clause_extractor.new_events_schema.ambr b/posthog/hogql/database/schema/util/test/__snapshots__/test_session_v3_where_clause_extractor.new_events_schema.ambrindex e996bdc55dbe..96324a27ad2f 100644--- a/posthog/hogql/database/schema/util/test/__snapshots__/test_session_v3_where_clause_extractor.new_events_schema.ambr+++ b/posthog/hogql/database/schema/util/test/__snapshots__/test_session_v3_where_clause_extractor.new_events_schema.ambr@@ -78,10 +78,10 @@FROMevents_json AS eventsWHERE- and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, today()))+ and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, toDateTime64(today(), 6, %(hogql_val_0)s)))LIMIT 50000) AS eventsLEFT JOIN (SELECT- dateDiff(%(hogql_val_0)s, min(toTimeZone(raw_sessions_v3.min_timestamp, %(hogql_val_1)s)), max(toTimeZone(raw_sessions_v3.max_timestamp, %(hogql_val_2)s))) AS `$session_duration`,+ dateDiff(%(hogql_val_1)s, min(toTimeZone(raw_sessions_v3.min_timestamp, %(hogql_val_2)s)), max(toTimeZone(raw_sessions_v3.max_timestamp, %(hogql_val_3)s))) AS `$session_duration`,raw_sessions_v3.session_id_v7 AS session_id_v7FROMraw_sessions_v3diff --git a/posthog/hogql/database/schema/util/test/__snapshots__/test_session_where_clause_extractor.ambr b/posthog/hogql/database/schema/util/test/__snapshots__/test_session_where_clause_extractor.ambrindex dd1c0d2fbeb7..dda9970a402d 100644--- a/posthog/hogql/database/schema/util/test/__snapshots__/test_session_where_clause_extractor.ambr+++ b/posthog/hogql/database/schema/util/test/__snapshots__/test_session_where_clause_extractor.ambr@@ -11,12 +11,12 @@FROMsessionsWHERE- and(equals(sessions.team_id, <TEAM_ID>), greaterOrEquals(sessions.min_timestamp, minus(%(hogql_val_0)s, toIntervalDay(3))))+ and(equals(sessions.team_id, <TEAM_ID>), greaterOrEquals(sessions.min_timestamp, toDateTime64(minus(%(hogql_val_0)s, toIntervalDay(3)), 6, %(hogql_val_1)s)))GROUP BYsessions.session_id,sessions.session_id) AS sessions ON equals(events.`$session_id`, sessions.session_id)WHERE- and(equals(events.team_id, <TEAM_ID>), greater(events.timestamp, toDateTime64(%(hogql_val_1)s, 6, %(hogql_val_2)s)))+ and(equals(events.team_id, <TEAM_ID>), greater(events.timestamp, toDateTime64(%(hogql_val_2)s, 6, %(hogql_val_3)s)))GROUP BYsessions.session_idLIMIT 50000@@ -33,12 +33,12 @@FROMsessionsWHERE- and(equals(sessions.team_id, <TEAM_ID>), greaterOrEquals(sessions.min_timestamp, minus(%(hogql_val_1)s, toIntervalDay(3))))+ and(equals(sessions.team_id, <TEAM_ID>), greaterOrEquals(sessions.min_timestamp, toDateTime64(minus(%(hogql_val_1)s, toIntervalDay(3)), 6, %(hogql_val_2)s)))GROUP BYsessions.session_id,sessions.session_id) AS sessionsWHERE- greater(sessions.`$start_timestamp`, %(hogql_val_2)s)+ greater(sessions.`$start_timestamp`, %(hogql_val_3)s)LIMIT 50000'''# ---@@ -46,8 +46,8 @@'''SELECTcount(DISTINCT e.`$session_id`) AS total,- toStartOfDay(toTimeZone(e.timestamp, %(hogql_val_7)s)) AS day_start,- multiIf(and(greaterOrEquals(e__session.`$session_duration`, 2.0), less(e__session.`$session_duration`, 4.5)), %(hogql_val_8)s, and(greaterOrEquals(e__session.`$session_duration`, 4.5), less(e__session.`$session_duration`, 27.0)), %(hogql_val_9)s, and(greaterOrEquals(e__session.`$session_duration`, 27.0), less(e__session.`$session_duration`, 44.0)), %(hogql_val_10)s, and(greaterOrEquals(e__session.`$session_duration`, 44.0), less(e__session.`$session_duration`, 48.0)), %(hogql_val_11)s, and(greaterOrEquals(e__session.`$session_duration`, 48.0), less(e__session.`$session_duration`, 57.5)), %(hogql_val_12)s, and(greaterOrEquals(e__session.`$session_duration`, 57.5), less(e__session.`$session_duration`, 61.0)), %(hogql_val_13)s, and(greaterOrEquals(e__session.`$session_duration`, 61.0), less(e__session.`$session_duration`, 74.0)), %(hogql_val_14)s, and(greaterOrEquals(e__session.`$session_duration`, 74.0), less(e__session.`$session_duration`, 90.0)), %(hogql_val_15)s, and(greaterOrEquals(e__session.`$session_duration`, 90.0), less(e__session.`$session_duration`, 98.5)), %(hogql_val_16)s, and(greaterOrEquals(e__session.`$session_duration`, 98.5), less(e__session.`$session_duration`, 167.01)), %(hogql_val_17)s, %(hogql_val_18)s) AS breakdown_value+ toStartOfDay(toTimeZone(e.timestamp, %(hogql_val_9)s)) AS day_start,+ multiIf(and(greaterOrEquals(e__session.`$session_duration`, 2.0), less(e__session.`$session_duration`, 4.5)), %(hogql_val_10)s, and(greaterOrEquals(e__session.`$session_duration`, 4.5), less(e__session.`$session_duration`, 27.0)), %(hogql_val_11)s, and(greaterOrEquals(e__session.`$session_duration`, 27.0), less(e__session.`$session_duration`, 44.0)), %(hogql_val_12)s, and(greaterOrEquals(e__session.`$session_duration`, 44.0), less(e__session.`$session_duration`, 48.0)), %(hogql_val_13)s, and(greaterOrEquals(e__session.`$session_duration`, 48.0), less(e__session.`$session_duration`, 57.5)), %(hogql_val_14)s, and(greaterOrEquals(e__session.`$session_duration`, 57.5), less(e__session.`$session_duration`, 61.0)), %(hogql_val_15)s, and(greaterOrEquals(e__session.`$session_duration`, 61.0), less(e__session.`$session_duration`, 74.0)), %(hogql_val_16)s, and(greaterOrEquals(e__session.`$session_duration`, 74.0), less(e__session.`$session_duration`, 90.0)), %(hogql_val_17)s, and(greaterOrEquals(e__session.`$session_duration`, 90.0), less(e__session.`$session_duration`, 98.5)), %(hogql_val_18)s, and(greaterOrEquals(e__session.`$session_duration`, 98.5), less(e__session.`$session_duration`, 167.01)), %(hogql_val_19)s, %(hogql_val_20)s) AS breakdown_valueFROMevents AS eLEFT OUTER JOIN (SELECT@@ -68,12 +68,12 @@FROMsessionsWHERE- and(equals(sessions.team_id, <TEAM_ID>), greaterOrEquals(sessions.min_timestamp, minus(toStartOfDay(assumeNotNull(toDateTime(%(hogql_val_3)s, %(hogql_val_4)s))), toIntervalDay(3))), lessOrEquals(sessions.min_timestamp, plus(assumeNotNull(toDateTime(%(hogql_val_5)s, %(hogql_val_6)s)), toIntervalDay(3))))+ and(equals(sessions.team_id, <TEAM_ID>), greaterOrEquals(sessions.min_timestamp, toDateTime64(minus(toStartOfDay(assumeNotNull(toDateTime(%(hogql_val_3)s, %(hogql_val_4)s))), toIntervalDay(3)), 6, %(hogql_val_5)s)), lessOrEquals(sessions.min_timestamp, toDateTime64(plus(assumeNotNull(toDateTime(%(hogql_val_6)s, %(hogql_val_7)s)), toIntervalDay(3)), 6, %(hogql_val_8)s)))GROUP BYsessions.session_id,sessions.session_id) AS e__session ON equals(e.`$session_id`, e__session.session_id)WHERE- and(equals(e.team_id, <TEAM_ID>), and(greaterOrEquals(toTimeZone(e.timestamp, %(hogql_val_19)s), toStartOfDay(assumeNotNull(toDateTime(%(hogql_val_20)s, %(hogql_val_21)s)))), lessOrEquals(toTimeZone(e.timestamp, %(hogql_val_22)s), assumeNotNull(toDateTime(%(hogql_val_23)s, %(hogql_val_24)s))), equals(e.event, %(hogql_val_25)s), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id), (SELECT+ and(equals(e.team_id, <TEAM_ID>), and(greaterOrEquals(toTimeZone(e.timestamp, %(hogql_val_21)s), toStartOfDay(assumeNotNull(toDateTime(%(hogql_val_22)s, %(hogql_val_23)s)))), lessOrEquals(toTimeZone(e.timestamp, %(hogql_val_24)s), assumeNotNull(toDateTime(%(hogql_val_25)s, %(hogql_val_26)s))), equals(e.event, %(hogql_val_27)s), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id), (SELECTcohortpeople.person_id AS person_idFROMcohortpeople@@ -89,7 +89,7 @@'''SELECTs.session_id AS session_id,- min(toTimeZone(s.min_first_timestamp, %(hogql_val_4)s)) AS start_time+ min(toTimeZone(s.min_first_timestamp, %(hogql_val_6)s)) AS start_timeFROMsession_replay_events AS sLEFT JOIN (SELECT@@ -98,12 +98,12 @@FROMsessionsWHERE- and(equals(sessions.team_id, <TEAM_ID>), greaterOrEquals(sessions.min_timestamp, minus(%(hogql_val_2)s, toIntervalDay(3))), lessOrEquals(sessions.min_timestamp, plus(now64(6, %(hogql_val_3)s), toIntervalDay(3))))+ and(equals(sessions.team_id, <TEAM_ID>), greaterOrEquals(sessions.min_timestamp, toDateTime64(minus(%(hogql_val_2)s, toIntervalDay(3)), 6, %(hogql_val_3)s)), lessOrEquals(sessions.min_timestamp, toDateTime64(plus(now64(6, %(hogql_val_4)s), toIntervalDay(3)), 6, %(hogql_val_5)s)))GROUP BYsessions.session_id,sessions.session_id) AS s__session ON equals(s.session_id, s__session.session_id)WHERE- and(equals(s.team_id, <TEAM_ID>), ifNull(equals(s__session.`$entry_pathname`, %(hogql_val_5)s), 0), greaterOrEquals(s.min_first_timestamp, toDateTime64(%(hogql_val_6)s, 6, %(hogql_val_7)s)), less(s.min_first_timestamp, now64(6, %(hogql_val_8)s)))+ and(equals(s.team_id, <TEAM_ID>), ifNull(equals(s__session.`$entry_pathname`, %(hogql_val_7)s), 0), greaterOrEquals(s.min_first_timestamp, toDateTime64(%(hogql_val_8)s, 6, %(hogql_val_9)s)), less(s.min_first_timestamp, toDateTime64(now64(6, %(hogql_val_10)s), 6, %(hogql_val_11)s)))GROUP BYs.session_idLIMIT 50000@@ -123,15 +123,15 @@FROMeventsWHERE- and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, today()))+ and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, toDateTime64(today(), 6, %(hogql_val_0)s)))LIMIT 50000) AS eventsLEFT JOIN (SELECT- dateDiff(%(hogql_val_0)s, min(toTimeZone(sessions.min_timestamp, %(hogql_val_1)s)), max(toTimeZone(sessions.max_timestamp, %(hogql_val_2)s))) AS `$session_duration`,+ dateDiff(%(hogql_val_1)s, min(toTimeZone(sessions.min_timestamp, %(hogql_val_2)s)), max(toTimeZone(sessions.max_timestamp, %(hogql_val_3)s))) AS `$session_duration`,sessions.session_id AS session_idFROMsessionsWHERE- and(equals(sessions.team_id, <TEAM_ID>), lessOrEquals(sessions.min_timestamp, plus(today(), toIntervalDay(3))))+ and(equals(sessions.team_id, <TEAM_ID>), lessOrEquals(sessions.min_timestamp, toDateTime64(plus(today(), toIntervalDay(3)), 6, %(hogql_val_4)s)))GROUP BYsessions.session_id,sessions.session_id) AS events__session ON equals(events.`$session_id`, events__session.session_id)diff --git a/posthog/hogql/database/schema/util/test/__snapshots__/test_session_where_clause_extractor.new_events_schema.ambr b/posthog/hogql/database/schema/util/test/__snapshots__/test_session_where_clause_extractor.new_events_schema.ambrindex f64bd55ba7cf..f4496ddc80a9 100644--- a/posthog/hogql/database/schema/util/test/__snapshots__/test_session_where_clause_extractor.new_events_schema.ambr+++ b/posthog/hogql/database/schema/util/test/__snapshots__/test_session_where_clause_extractor.new_events_schema.ambr@@ -11,12 +11,12 @@FROMsessionsWHERE- and(equals(sessions.team_id, <TEAM_ID>), greaterOrEquals(sessions.min_timestamp, minus(%(hogql_val_0)s, toIntervalDay(3))))+ and(equals(sessions.team_id, <TEAM_ID>), greaterOrEquals(sessions.min_timestamp, toDateTime64(minus(%(hogql_val_0)s, toIntervalDay(3)), 6, %(hogql_val_1)s)))GROUP BYsessions.session_id,sessions.session_id) AS sessions ON equals(events.properties.`$session_id`, sessions.session_id)WHERE- and(equals(events.team_id, <TEAM_ID>), greater(events.timestamp, toDateTime64(%(hogql_val_1)s, 6, %(hogql_val_2)s)))+ and(equals(events.team_id, <TEAM_ID>), greater(events.timestamp, toDateTime64(%(hogql_val_2)s, 6, %(hogql_val_3)s)))GROUP BYsessions.session_idLIMIT 50000@@ -26,8 +26,8 @@'''SELECTcount(DISTINCT e.properties.`$session_id`) AS total,- toStartOfDay(toTimeZone(e.timestamp, %(hogql_val_7)s)) AS day_start,- multiIf(and(greaterOrEquals(e__session.`$session_duration`, 2.0), less(e__session.`$session_duration`, 4.5)), %(hogql_val_8)s, and(greaterOrEquals(e__session.`$session_duration`, 4.5), less(e__session.`$session_duration`, 27.0)), %(hogql_val_9)s, and(greaterOrEquals(e__session.`$session_duration`, 27.0), less(e__session.`$session_duration`, 44.0)), %(hogql_val_10)s, and(greaterOrEquals(e__session.`$session_duration`, 44.0), less(e__session.`$session_duration`, 48.0)), %(hogql_val_11)s, and(greaterOrEquals(e__session.`$session_duration`, 48.0), less(e__session.`$session_duration`, 57.5)), %(hogql_val_12)s, and(greaterOrEquals(e__session.`$session_duration`, 57.5), less(e__session.`$session_duration`, 61.0)), %(hogql_val_13)s, and(greaterOrEquals(e__session.`$session_duration`, 61.0), less(e__session.`$session_duration`, 74.0)), %(hogql_val_14)s, and(greaterOrEquals(e__session.`$session_duration`, 74.0), less(e__session.`$session_duration`, 90.0)), %(hogql_val_15)s, and(greaterOrEquals(e__session.`$session_duration`, 90.0), less(e__session.`$session_duration`, 98.5)), %(hogql_val_16)s, and(greaterOrEquals(e__session.`$session_duration`, 98.5), less(e__session.`$session_duration`, 167.01)), %(hogql_val_17)s, %(hogql_val_18)s) AS breakdown_value+ toStartOfDay(toTimeZone(e.timestamp, %(hogql_val_9)s)) AS day_start,+ multiIf(and(greaterOrEquals(e__session.`$session_duration`, 2.0), less(e__session.`$session_duration`, 4.5)), %(hogql_val_10)s, and(greaterOrEquals(e__session.`$session_duration`, 4.5), less(e__session.`$session_duration`, 27.0)), %(hogql_val_11)s, and(greaterOrEquals(e__session.`$session_duration`, 27.0), less(e__session.`$session_duration`, 44.0)), %(hogql_val_12)s, and(greaterOrEquals(e__session.`$session_duration`, 44.0), less(e__session.`$session_duration`, 48.0)), %(hogql_val_13)s, and(greaterOrEquals(e__session.`$session_duration`, 48.0), less(e__session.`$session_duration`, 57.5)), %(hogql_val_14)s, and(greaterOrEquals(e__session.`$session_duration`, 57.5), less(e__session.`$session_duration`, 61.0)), %(hogql_val_15)s, and(greaterOrEquals(e__session.`$session_duration`, 61.0), less(e__session.`$session_duration`, 74.0)), %(hogql_val_16)s, and(greaterOrEquals(e__session.`$session_duration`, 74.0), less(e__session.`$session_duration`, 90.0)), %(hogql_val_17)s, and(greaterOrEquals(e__session.`$session_duration`, 90.0), less(e__session.`$session_duration`, 98.5)), %(hogql_val_18)s, and(greaterOrEquals(e__session.`$session_duration`, 98.5), less(e__session.`$session_duration`, 167.01)), %(hogql_val_19)s, %(hogql_val_20)s) AS breakdown_valueFROMevents_json AS eLEFT OUTER JOIN (SELECT@@ -48,12 +48,12 @@FROMsessionsWHERE- and(equals(sessions.team_id, <TEAM_ID>), greaterOrEquals(sessions.min_timestamp, minus(toStartOfDay(assumeNotNull(toDateTime(%(hogql_val_3)s, %(hogql_val_4)s))), toIntervalDay(3))), lessOrEquals(sessions.min_timestamp, plus(assumeNotNull(toDateTime(%(hogql_val_5)s, %(hogql_val_6)s)), toIntervalDay(3))))+ and(equals(sessions.team_id, <TEAM_ID>), greaterOrEquals(sessions.min_timestamp, toDateTime64(minus(toStartOfDay(assumeNotNull(toDateTime(%(hogql_val_3)s, %(hogql_val_4)s))), toIntervalDay(3)), 6, %(hogql_val_5)s)), lessOrEquals(sessions.min_timestamp, toDateTime64(plus(assumeNotNull(toDateTime(%(hogql_val_6)s, %(hogql_val_7)s)), toIntervalDay(3)), 6, %(hogql_val_8)s)))GROUP BYsessions.session_id,sessions.session_id) AS e__session ON equals(e.properties.`$session_id`, e__session.session_id)WHERE- and(equals(e.team_id, <TEAM_ID>), and(greaterOrEquals(toTimeZone(e.timestamp, %(hogql_val_19)s), toStartOfDay(assumeNotNull(toDateTime(%(hogql_val_20)s, %(hogql_val_21)s)))), lessOrEquals(toTimeZone(e.timestamp, %(hogql_val_22)s), assumeNotNull(toDateTime(%(hogql_val_23)s, %(hogql_val_24)s))), equals(e.event, %(hogql_val_25)s), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id), (SELECT+ and(equals(e.team_id, <TEAM_ID>), and(greaterOrEquals(toTimeZone(e.timestamp, %(hogql_val_21)s), toStartOfDay(assumeNotNull(toDateTime(%(hogql_val_22)s, %(hogql_val_23)s)))), lessOrEquals(toTimeZone(e.timestamp, %(hogql_val_24)s), assumeNotNull(toDateTime(%(hogql_val_25)s, %(hogql_val_26)s))), equals(e.event, %(hogql_val_27)s), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id), (SELECTcohortpeople.person_id AS person_idFROMcohortpeople@@ -79,15 +79,15 @@FROMevents_json AS eventsWHERE- and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, today()))+ and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, toDateTime64(today(), 6, %(hogql_val_0)s)))LIMIT 50000) AS eventsLEFT JOIN (SELECT- dateDiff(%(hogql_val_0)s, min(toTimeZone(sessions.min_timestamp, %(hogql_val_1)s)), max(toTimeZone(sessions.max_timestamp, %(hogql_val_2)s))) AS `$session_duration`,+ dateDiff(%(hogql_val_1)s, min(toTimeZone(sessions.min_timestamp, %(hogql_val_2)s)), max(toTimeZone(sessions.max_timestamp, %(hogql_val_3)s))) AS `$session_duration`,sessions.session_id AS session_idFROMsessionsWHERE- and(equals(sessions.team_id, <TEAM_ID>), lessOrEquals(sessions.min_timestamp, plus(today(), toIntervalDay(3))))+ and(equals(sessions.team_id, <TEAM_ID>), lessOrEquals(sessions.min_timestamp, toDateTime64(plus(today(), toIntervalDay(3)), 6, %(hogql_val_4)s)))GROUP BYsessions.session_id,sessions.session_id) AS events__session ON equals(events.`$session_id`, events__session.session_id)diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambrindex 6eaebc0a8db5..f01245a66575 100644--- a/posthog/hogql/test/__snapshots__/test_query.ambr+++ b/posthog/hogql/test/__snapshots__/test_query.ambr@@ -77,13 +77,13 @@WITH latest_events AS (SELECT events.distinct_id AS distinct_id, argMax(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', ''), toTimeZone(events.timestamp, %(hogql_val_1)s)) AS latest_os_versionFROM events- WHERE and(equals(events.team_id, 99999), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_2)s), ''), 'null'), '^"|"$', ''), %(hogql_val_3)s), 0), greaterOrEquals(events.timestamp, minus(now64(6, %(hogql_val_4)s), toIntervalDay(30))))+ WHERE and(equals(events.team_id, 99999), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_2)s), ''), 'null'), '^"|"$', ''), %(hogql_val_3)s), 0), greaterOrEquals(events.timestamp, toDateTime64(minus(now64(6, %(hogql_val_4)s), toIntervalDay(30)), 6, %(hogql_val_5)s)))GROUP BY events.distinct_id), major_versions AS (- SELECT latest_events.distinct_id AS distinct_id, latest_events.latest_os_version AS latest_os_version, splitByChar(%(hogql_val_5)s, ifNull(latest_events.latest_os_version, %(hogql_val_6)s))[1] AS major_version+ SELECT latest_events.distinct_id AS distinct_id, latest_events.latest_os_version AS latest_os_version, splitByChar(%(hogql_val_6)s, ifNull(latest_events.latest_os_version, %(hogql_val_7)s))[1] AS major_versionFROM latest_events)SELECT major_versions.major_version AS major_version, count() AS user_count, round(divide(multiply(100, count()), sum(count()) OVER ()), 2) AS percentageFROM major_versions- WHERE in(major_versions.major_version, tuple(%(hogql_val_7)s, %(hogql_val_8)s, %(hogql_val_9)s))+ WHERE in(major_versions.major_version, tuple(%(hogql_val_8)s, %(hogql_val_9)s, %(hogql_val_10)s))GROUP BY major_versions.major_versionORDER BY major_versions.major_version ASCLIMIT 100diff --git a/posthog/hogql/test/__snapshots__/test_query.new_events_schema.ambr b/posthog/hogql/test/__snapshots__/test_query.new_events_schema.ambrindex 346e61073b58..c4ac16e40719 100644--- a/posthog/hogql/test/__snapshots__/test_query.new_events_schema.ambr+++ b/posthog/hogql/test/__snapshots__/test_query.new_events_schema.ambr@@ -53,13 +53,13 @@WITH latest_events AS (SELECT events.distinct_id AS distinct_id, argMax(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$os_version`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$os_version`)), if(isNull(nullIf(toString(events.properties.`$os_version`), '')), NULL, if(and(in(ascii(toString(events.properties.`$os_version`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$os_version`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$os_version`), '[]'), '{}'), toString(events.properties.`$os_version`)))), toTimeZone(events.timestamp, %(hogql_val_0)s)) AS latest_os_versionFROM events_json AS events- WHERE and(equals(events.team_id, 99999), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$os`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), %(hogql_val_1)s), 0), greaterOrEquals(events.timestamp, minus(now64(6, %(hogql_val_2)s), toIntervalDay(30))))+ WHERE and(equals(events.team_id, 99999), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$os`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), %(hogql_val_1)s), 0), greaterOrEquals(events.timestamp, toDateTime64(minus(now64(6, %(hogql_val_2)s), toIntervalDay(30)), 6, %(hogql_val_3)s)))GROUP BY events.distinct_id), major_versions AS (- SELECT latest_events.distinct_id AS distinct_id, latest_events.latest_os_version AS latest_os_version, splitByChar(%(hogql_val_3)s, ifNull(latest_events.latest_os_version, %(hogql_val_4)s))[1] AS major_version+ SELECT latest_events.distinct_id AS distinct_id, latest_events.latest_os_version AS latest_os_version, splitByChar(%(hogql_val_4)s, ifNull(latest_events.latest_os_version, %(hogql_val_5)s))[1] AS major_versionFROM latest_events)SELECT major_versions.major_version AS major_version, count() AS user_count, round(divide(multiply(100, count()), sum(count()) OVER ()), 2) AS percentageFROM major_versions- WHERE in(major_versions.major_version, tuple(%(hogql_val_5)s, %(hogql_val_6)s, %(hogql_val_7)s))+ WHERE in(major_versions.major_version, tuple(%(hogql_val_6)s, %(hogql_val_7)s, %(hogql_val_8)s))GROUP BY major_versions.major_versionORDER BY major_versions.major_version ASCLIMIT 100diff --git a/posthog/hogql/transforms/property_types.py b/posthog/hogql/transforms/property_types.pyindex 5aa840a695bb..418445716d30 100644--- a/posthog/hogql/transforms/property_types.py+++ b/posthog/hogql/transforms/property_types.py@@ -132,7 +132,7 @@ class PropertyFinder(TraversingVisitor):class ToTimeZoneParts:bare_field: ast.Exprtimezone: str- constant: ast.Expr+ other_side: ast.Exprswapped: bool@@ -563,7 +563,7 @@ class PropertySwapper(CloningVisitor):if parts is None:return None- tz_constant = self._ensure_constant_has_timezone(parts.constant, parts.timezone)+ tz_constant = self._anchor_to_timezone(parts.other_side, parts.timezone)if parts.swapped:return ast.CompareOperation(left=tz_constant, right=parts.bare_field, op=node.op)@@ -572,7 +572,7 @@ class PropertySwapper(CloningVisitor):@staticmethoddef _extract_toTimeZone_parts(node: ast.CompareOperation) -> ToTimeZoneParts | None:- """Extract the bare field, timezone, constant and side from a comparison+ """Extract the bare field, timezone, other side and side from a comparisonwhere one side is toTimeZone(field, tz).Returns None if the pattern doesn't match.@@ -580,7 +580,7 @@ class PropertySwapper(CloningVisitor):"""for left_is_tz in (True, False):tz_side = node.left if left_is_tz else node.right- const_side = node.right if left_is_tz else node.left+ other_side = node.right if left_is_tz else node.leftinner = tz_sideif isinstance(inner, ast.Alias):@@ -591,41 +591,31 @@ class PropertySwapper(CloningVisitor):return ToTimeZoneParts(bare_field=inner.args[0],timezone=tz_arg.value,- constant=const_side,+ other_side=other_side,swapped=not left_is_tz,)return None@staticmethod- def _ensure_constant_has_timezone(expr: ast.Expr, tz: str) -> ast.Expr:- """Wrap a constant expression with toDateTime64(..., 6, tz) if it doesn't- already carry timezone information.-- Constants that are already wrapped in toDateTime64/toDateTime with a tz- argument are left unchanged. Bare string/datetime constants get wrapped.- """+ def _anchor_to_timezone(expr: ast.Expr, tz: str) -> ast.Expr:inner = exprif isinstance(inner, ast.Alias):inner = inner.expr- # Already has timezone: toDateTime64('...', 6, 'tz') or toDateTime('...', 'tz')if isinstance(inner, ast.Call):- if inner.name == "toDateTime64" and len(inner.args) == 3:- return expr- if inner.name == "toDateTime" and len(inner.args) == 2:+ if inner.name in ("toDateTime", "toDateTime64"):return expr# Recurse into wrapper functions like assumeNotNull(toDateTime(...))if inner.name in ("assumeNotNull",) and len(inner.args) == 1:- wrapped_arg = PropertySwapper._ensure_constant_has_timezone(inner.args[0], tz)+ wrapped_arg = PropertySwapper._anchor_to_timezone(inner.args[0], tz)if wrapped_arg is not inner.args[0]:- new_call = ast.Call(name=inner.name, args=[wrapped_arg])- if isinstance(expr, ast.Alias):- return ast.Alias(alias=expr.alias, expr=new_call)- return new_call+ new_call = ast.Call(+ name=inner.name, args=[wrapped_arg], type=PropertySwapper._datetime_call_type(inner.name, False)+ )+ return PropertySwapper._replace_keeping_alias(expr, new_call)return expr- # Bare constant — wrap with toDateTime64 carrying the timezone.# Skip if the value is already a timezone-aware datetime: the printer# converts it to the team timezone and emits toDateTime64('...', 6, tz)# regardless of the constant's original tzinfo (see escape_sql.py:249).@@ -636,17 +626,33 @@ class PropertySwapper(CloningVisitor):if (zoned := parse_zoned_datetime_string(inner.value)) is not None:inner.value = zonedreturn expr- new_call = ast.Call(- name="toDateTime64",- args=[inner, ast.Constant(value=6), ast.Constant(value=tz)],- )- if isinstance(expr, ast.Alias):- return ast.Alias(alias=expr.alias, expr=new_call)- return new_call- # For anything else (arithmetic, other calls), leave as-is.- # These typically already produce timezone-aware values.- return expr+ new_call = ast.Call(+ name="toDateTime64",+ args=[inner, ast.Constant(value=6), ast.Constant(value=tz)],+ type=PropertySwapper._datetime_call_type("toDateTime64", PropertySwapper._is_nullable_bound(inner)),+ )+ return PropertySwapper._replace_keeping_alias(expr, new_call)++ @staticmethod+ def _replace_keeping_alias(expr: ast.Expr, replacement: ast.Expr) -> ast.Expr:+ if isinstance(expr, ast.Alias):+ return ast.Alias(alias=expr.alias, expr=replacement, hidden=expr.hidden)+ return replacement++ @staticmethod+ def _datetime_call_type(name: str, nullable: bool) -> ast.CallType:+ return ast.CallType(name=name, arg_types=[], return_type=ast.DateTimeType(nullable=nullable))++ @staticmethod+ def _is_nullable_bound(expr: ast.Expr) -> bool:+ if isinstance(expr, ast.Constant):+ return expr.value is None+ if isinstance(expr.type, ast.CallType):+ return expr.type.return_type.nullable+ if isinstance(expr.type, ast.ConstantType):+ return expr.type.nullable+ return Truedef visit_field(self, node: ast.Field):if isinstance(node.type, ast.FieldType):diff --git a/posthog/hogql/transforms/test/__snapshots__/test_state_aggregations.ambr b/posthog/hogql/transforms/test/__snapshots__/test_state_aggregations.ambrindex 47592059b475..7bd98342472b 100644--- a/posthog/hogql/transforms/test/__snapshots__/test_state_aggregations.ambr+++ b/posthog/hogql/transforms/test/__snapshots__/test_state_aggregations.ambr@@ -151,13 +151,13 @@FROM (SELECT countState() AS total_pageviewsFROM events- WHERE and(equals(events.team_id, 420), less(events.timestamp, minus(now64(6, %(hogql_val_0)s), toIntervalDay(1)))))+ WHERE and(equals(events.team_id, 420), less(events.timestamp, toDateTime64(minus(now64(6, %(hogql_val_0)s), toIntervalDay(1)), 6, %(hogql_val_1)s))))LIMIT 50000 UNION ALLSELECT countMerge(total_pageviews) AS total_pageviewsFROM (SELECT countState() AS total_pageviewsFROM events- WHERE and(equals(events.team_id, 420), greaterOrEquals(events.timestamp, minus(now64(6, %(hogql_val_1)s), toIntervalDay(1)))))+ WHERE and(equals(events.team_id, 420), greaterOrEquals(events.timestamp, toDateTime64(minus(now64(6, %(hogql_val_2)s), toIntervalDay(1)), 6, %(hogql_val_3)s))))LIMIT 50000'''# ---@@ -480,13 +480,13 @@FROM (SELECT countState() AS total_pageviewsFROM events- WHERE and(equals(events.team_id, 420), less(events.timestamp, minus(now64(6, %(hogql_val_0)s), toIntervalDay(1)))))+ WHERE and(equals(events.team_id, 420), less(events.timestamp, toDateTime64(minus(now64(6, %(hogql_val_0)s), toIntervalDay(1)), 6, %(hogql_val_1)s))))LIMIT 50000 UNION ALLSELECT countMerge(total_pageviews) AS total_pageviewsFROM (SELECT countState() AS total_pageviewsFROM events- WHERE and(equals(events.team_id, 420), greaterOrEquals(events.timestamp, minus(now64(6, %(hogql_val_1)s), toIntervalDay(1)))))+ WHERE and(equals(events.team_id, 420), greaterOrEquals(events.timestamp, toDateTime64(minus(now64(6, %(hogql_val_2)s), toIntervalDay(1)), 6, %(hogql_val_3)s))))LIMIT 50000'''# ---diff --git a/posthog/hogql/transforms/test/__snapshots__/test_state_aggregations.new_events_schema.ambr b/posthog/hogql/transforms/test/__snapshots__/test_state_aggregations.new_events_schema.ambrindex 6b008d8d7e5d..02aee24607c3 100644--- a/posthog/hogql/transforms/test/__snapshots__/test_state_aggregations.new_events_schema.ambr+++ b/posthog/hogql/transforms/test/__snapshots__/test_state_aggregations.new_events_schema.ambr@@ -151,13 +151,13 @@FROM (SELECT countState() AS total_pageviewsFROM events_json AS events- WHERE and(equals(events.team_id, 420), less(events.timestamp, minus(now64(6, %(hogql_val_0)s), toIntervalDay(1)))))+ WHERE and(equals(events.team_id, 420), less(events.timestamp, toDateTime64(minus(now64(6, %(hogql_val_0)s), toIntervalDay(1)), 6, %(hogql_val_1)s))))LIMIT 50000 UNION ALLSELECT countMerge(total_pageviews) AS total_pageviewsFROM (SELECT countState() AS total_pageviewsFROM events_json AS events- WHERE and(equals(events.team_id, 420), greaterOrEquals(events.timestamp, minus(now64(6, %(hogql_val_1)s), toIntervalDay(1)))))+ WHERE and(equals(events.team_id, 420), greaterOrEquals(events.timestamp, toDateTime64(minus(now64(6, %(hogql_val_2)s), toIntervalDay(1)), 6, %(hogql_val_3)s))))LIMIT 50000'''# ---@@ -480,13 +480,13 @@FROM (SELECT countState() AS total_pageviewsFROM events_json AS events- WHERE and(equals(events.team_id, 420), less(events.timestamp, minus(now64(6, %(hogql_val_0)s), toIntervalDay(1)))))+ WHERE and(equals(events.team_id, 420), less(events.timestamp, toDateTime64(minus(now64(6, %(hogql_val_0)s), toIntervalDay(1)), 6, %(hogql_val_1)s))))LIMIT 50000 UNION ALLSELECT countMerge(total_pageviews) AS total_pageviewsFROM (SELECT countState() AS total_pageviewsFROM events_json AS events- WHERE and(equals(events.team_id, 420), greaterOrEquals(events.timestamp, minus(now64(6, %(hogql_val_1)s), toIntervalDay(1)))))+ WHERE and(equals(events.team_id, 420), greaterOrEquals(events.timestamp, toDateTime64(minus(now64(6, %(hogql_val_2)s), toIntervalDay(1)), 6, %(hogql_val_3)s))))LIMIT 50000'''# ---diff --git a/posthog/hogql/transforms/test/test_property_types.py b/posthog/hogql/transforms/test/test_property_types.pyindex 38c28b195348..a866b4d36437 100644--- a/posthog/hogql/transforms/test/test_property_types.py+++ b/posthog/hogql/transforms/test/test_property_types.py@@ -55,9 +55,10 @@ from posthog.hogql.transforms.property_types import PropertySwapper, build_propefrom posthog.hogql.type_system import ComparisonCompatibilityfrom posthog.clickhouse.client import sync_execute+from posthog.clickhouse.events_json import EVENTS_JSON_DATA_TABLEfrom posthog.errors import ExposedCHQueryErrorfrom posthog.models import PropertyDefinition, Team-from posthog.models.event.sql import EVENTS_PROPERTIES_JSON_TYPE, PERSON_PROPERTIES_JSON_TYPE+from posthog.models.event.sql import EVENTS_DATA_TABLE, EVENTS_PROPERTIES_JSON_TYPE, PERSON_PROPERTIES_JSON_TYPEfrom posthog.models.group.util import create_groupfrom posthog.models.property.util import get_property_string_exprfrom posthog.property_columns import TableColumn@@ -2085,12 +2086,15 @@ class TestTimezoneIndexPruning(ClickhouseTestMixin, BaseTest):f"Partition Condition={partition.get('Condition')!r}")- def test_hogql_compiled_query_has_partition_pruning(self):+ @parameterized.expand(+ [+ ("infix_and", "timestamp >= '2024-03-01' AND timestamp < '2024-04-01'"),+ ("date_bounds", "timestamp >= toDate('2024-03-01') AND timestamp < toDate('2024-04-01')"),+ ]+ )+ def test_hogql_compiled_query_has_partition_pruning(self, _name, where):"""The HogQL pipeline strips toTimeZone from WHERE comparisons to restore pruning."""- sql, values = self._compile_hogql(- "SELECT count() FROM events WHERE timestamp >= '2024-03-01' AND timestamp < '2024-04-01'",- timezone="America/New_York",- )+ sql, values = self._compile_hogql(f"SELECT count() FROM events WHERE {where}", timezone="America/New_York")indexes = get_indexes_from_explain(sql, values)pruning_index = _get_index_by_type(indexes, "Min-Max")@@ -2114,6 +2118,20 @@ class TestTimezoneIndexPruning(ClickhouseTestMixin, BaseTest):assert "toTimeZone" not in where_clause, f"Expected toTimeZone stripped from WHERE, got:\n{where_clause}"assert "toTimeZone" in select_clause, f"Expected toTimeZone in SELECT for display, got:\n{select_clause}"+ @parameterized.expand(+ [+ ("assume_not_null_date_bound", "assumeNotNull(toStartOfWeek(toDateTime('2024-03-03 00:00:00')))"),+ ("computed_non_null_bound", "plus(assumeNotNull(toDateTime('2024-03-03 00:00:00')), toIntervalSecond(0))"),+ ]+ )+ def test_anchored_non_null_bound_keeps_comparison_unwrapped(self, _name, bound):+ sql, _ = self._compile_hogql(+ f"SELECT count() FROM posthog.hog_invocation_results WHERE scheduled_at >= {bound}",+ timezone="America/New_York",+ )+ assert re.search(r"greaterOrEquals\([\w.]*scheduled_at, ", sql), sql+ assert not re.search(r"ifNull\(greaterOrEquals\([\w.]*scheduled_at", sql), sql+def test_toTimeZone_not_stripped_in_join_on(self):"""toTimeZone should NOT be stripped from JOIN ON comparisons — only WHERE benefits from pruning."""sql, _ = self._compile_hogql(@@ -2202,6 +2220,44 @@ class TestTimezoneIndexPruning(ClickhouseTestMixin, BaseTest):hogql = "SELECT count() FROM events WHERE event = 'dst_test' AND timestamp >= '2024-03-10' AND timestamp < '2024-03-11'"self._assert_correct_results(hogql, timezone="America/New_York", expected_count=2)+ @parameterized.expand(+ [+ ("to_date", "timestamp >= toDate('2024-03-01') AND timestamp < toDate('2024-03-02')"),+ (+ "start_of_month",+ "timestamp >= toStartOfMonth(toDateTime('2024-03-15 00:00:00')) AND timestamp < toDate('2024-03-02')",+ ),+ ]+ )+ def test_date_bounds_use_project_timezone(self, _name, where):+ events_table = (+ EVENTS_JSON_DATA_TABLE if settings.CLICKHOUSE_HOGQL_USE_NEW_EVENTS_SCHEMA else EVENTS_DATA_TABLE()+ )+ # A row past 2262 overflows any later comparison against a 9-decimal bound, whatever the team.+ self.addCleanup(+ sync_execute,+ f"ALTER TABLE {events_table} DELETE WHERE team_id = {self.team.pk} AND timestamp >= '2262-01-01' SETTINGS mutations_sync = 2",+ )+ for timestamp in (+ datetime(2024, 2, 29, 14, 30, 0),+ datetime(2024, 2, 29, 15, 30, 0),+ datetime(2024, 3, 1, 14, 0, 0),+ datetime(2299, 12, 31, 0, 0, 0),+ ):+ _create_event(team=self.team, distinct_id="tokyo_user", event="tokyo_date_test", timestamp=timestamp)+ flush_persons_and_events()++ hogql = f"SELECT count() FROM events WHERE event = 'tokyo_date_test' AND {where}"+ self._assert_correct_results(hogql, timezone="Asia/Tokyo", expected_count=2)++ def test_nanosecond_bound_keeps_its_precision(self):+ for timestamp in (datetime(2024, 3, 1, 12, 0, 0), datetime(2024, 3, 1, 12, 0, 1)):+ _create_event(team=self.team, distinct_id="nano_user", event="nano_test", timestamp=timestamp)+ flush_persons_and_events()++ hogql = "SELECT count() FROM events WHERE event = 'nano_test' AND timestamp >= toDateTime64('2024-03-01 12:00:00.000000500', 9)"+ self._assert_correct_results(hogql, timezone="UTC", expected_count=1)+def test_positive_utc_offset_does_not_drop_events(self):"""Asia/Tokyo (UTC+9): midnight Tokyo = 15:00 UTC the previous day."""_create_event(@@ -2296,7 +2352,7 @@ class TestTimezoneIndexPruning(ClickhouseTestMixin, BaseTest):assume_call = ast_module.Call(name="assumeNotNull", args=[inner_call])aliased = ast_module.Alias(alias="date_from", expr=assume_call)- result = PropertySwapper._ensure_constant_has_timezone(aliased, "America/New_York")+ result = PropertySwapper._anchor_to_timezone(aliased, "America/New_York")assert isinstance(result, ast_module.Alias), f"Expected Alias wrapper preserved, got {type(result).__name__}"assert result.alias == "date_from"@@ -2311,7 +2367,7 @@ class TestTimezoneIndexPruning(ClickhouseTestMixin, BaseTest):inner_call = ast_module.Call(name="toDateTime", args=[ast_module.Constant(value="2024-03-01")])assume_call = ast_module.Call(name="assumeNotNull", args=[inner_call])- result = PropertySwapper._ensure_constant_has_timezone(assume_call, "America/New_York")+ result = PropertySwapper._anchor_to_timezone(assume_call, "America/New_York")assert isinstance(result, ast_module.Call), f"Expected Call, got {type(result).__name__}"assert result.name == "assumeNotNull"diff --git a/posthog/hogql_queries/ai/test/__snapshots__/test_event_taxonomy_query_runner.ambr b/posthog/hogql_queries/ai/test/__snapshots__/test_event_taxonomy_query_runner.ambrindex 3ea5419b2c03..f5261069f3a7 100644--- a/posthog/hogql_queries/ai/test/__snapshots__/test_event_taxonomy_query_runner.ambr+++ b/posthog/hogql_queries/ai/test/__snapshots__/test_event_taxonomy_query_runner.ambr@@ -14,7 +14,7 @@(SELECT JSONExtractKeysAndValues(events.properties, 'String') AS kv,toTimeZone(events.timestamp, 'UTC') AS timestampFROM events- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, minus(now64(6, 'UTC'), toIntervalDay(30))), equals(events.event, 'event1'))+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, toDateTime64(minus(now64(6, 'UTC'), toIntervalDay(30)), 6, 'UTC')), equals(events.event, 'event1'))ORDER BY toTimeZone(events.timestamp, 'UTC') DESCLIMIT 100) ARRAYJOIN (kv).1 AS key,@@ -55,7 +55,7 @@(SELECT [tuple('zero_duration_recording_count_in_period', JSONExtractString(events.properties, 'zero_duration_recording_count_in_period'))] AS kv,toTimeZone(events.timestamp, 'UTC') AS timestampFROM events- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, minus(now64(6, 'UTC'), toIntervalDay(30))), equals(events.event, 'organization usage report'), notEquals(JSONExtractString(events.properties, 'zero_duration_recording_count_in_period'), ''))) ARRAY+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, toDateTime64(minus(now64(6, 'UTC'), toIntervalDay(30)), 6, 'UTC')), equals(events.event, 'organization usage report'), notEquals(JSONExtractString(events.properties, 'zero_duration_recording_count_in_period'), ''))) ARRAYJOIN (kv).1 AS key,(kv).2 AS valueWHERE and(isNotNull(value), ifNull(notEquals(value, ''), 1))@@ -94,7 +94,7 @@(SELECT JSONExtractKeysAndValues(events.properties, 'String') AS kv,toTimeZone(events.timestamp, 'UTC') AS timestampFROM events- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, minus(now64(6, 'UTC'), toIntervalDay(30))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, toDateTime64(minus(now64(6, 'UTC'), toIntervalDay(30)), 6, 'UTC')), equals(events.event, '$pageview'))ORDER BY toTimeZone(events.timestamp, 'UTC') DESCLIMIT 100) ARRAYJOIN (kv).1 AS key,diff --git a/posthog/hogql_queries/ai/test/__snapshots__/test_event_taxonomy_query_runner.new_events_schema.ambr b/posthog/hogql_queries/ai/test/__snapshots__/test_event_taxonomy_query_runner.new_events_schema.ambrindex e8fa6c75cfeb..8d39498ad218 100644--- a/posthog/hogql_queries/ai/test/__snapshots__/test_event_taxonomy_query_runner.new_events_schema.ambr+++ b/posthog/hogql_queries/ai/test/__snapshots__/test_event_taxonomy_query_runner.new_events_schema.ambr@@ -14,7 +14,7 @@(SELECT JSONExtractKeysAndValues(JSONStripEmptyStringsAndNulls(concat('{', arrayStringConcat(arrayMap(kv -> concat(toJSONString(kv.1), ':', kv.2), arrayFilter(kv -> kv.2 != '[]', JSONExtractKeysAndValuesRaw(toJSONString(events.properties)))), ','), '}')), 'String') AS kv,toTimeZone(events.timestamp, 'UTC') AS timestampFROM events_json AS events- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, minus(now64(6, 'UTC'), toIntervalDay(30))), equals(events.event, 'event1'))+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, toDateTime64(minus(now64(6, 'UTC'), toIntervalDay(30)), 6, 'UTC')), equals(events.event, 'event1'))ORDER BY toTimeZone(events.timestamp, 'UTC') DESCLIMIT 100) ARRAYJOIN (kv).1 AS key,@@ -56,7 +56,7 @@(SELECT [tuple('zero_duration_recording_count_in_period', JSONExtractString(ifNull(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^zero_duration_recording_count_in_period)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^zero_duration_recording_count_in_period)), if(isNull(nullIf(toString(events.properties.zero_duration_recording_count_in_period), '')), NULL, nullIf(nullIf(toJSONString(events.properties.zero_duration_recording_count_in_period), '[]'), '{}'))), '')))] AS kv,toTimeZone(events.timestamp, 'UTC') AS timestampFROM events_json AS events- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, minus(now64(6, 'UTC'), toIntervalDay(30))), equals(events.event, 'organization usage report'), notEquals(JSONExtractString(ifNull(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^zero_duration_recording_count_in_period)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^zero_duration_recording_count_in_period)), if(isNull(nullIf(toString(events.properties.zero_duration_recording_count_in_period), '')), NULL, nullIf(nullIf(toJSONString(events.properties.zero_duration_recording_count_in_period), '[]'), '{}'))), '')), ''))) ARRAY+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, toDateTime64(minus(now64(6, 'UTC'), toIntervalDay(30)), 6, 'UTC')), equals(events.event, 'organization usage report'), notEquals(JSONExtractString(ifNull(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^zero_duration_recording_count_in_period)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^zero_duration_recording_count_in_period)), if(isNull(nullIf(toString(events.properties.zero_duration_recording_count_in_period), '')), NULL, nullIf(nullIf(toJSONString(events.properties.zero_duration_recording_count_in_period), '[]'), '{}'))), '')), ''))) ARRAYJOIN (kv).1 AS key,(kv).2 AS valueWHERE and(isNotNull(value), ifNull(notEquals(value, ''), 1))@@ -96,7 +96,7 @@(SELECT JSONExtractKeysAndValues(JSONStripEmptyStringsAndNulls(concat('{', arrayStringConcat(arrayMap(kv -> concat(toJSONString(kv.1), ':', kv.2), arrayFilter(kv -> kv.2 != '[]', JSONExtractKeysAndValuesRaw(toJSONString(events.properties)))), ','), '}')), 'String') AS kv,toTimeZone(events.timestamp, 'UTC') AS timestampFROM events_json AS events- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, minus(now64(6, 'UTC'), toIntervalDay(30))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, toDateTime64(minus(now64(6, 'UTC'), toIntervalDay(30)), 6, 'UTC')), equals(events.event, '$pageview'))ORDER BY toTimeZone(events.timestamp, 'UTC') DESCLIMIT 100) ARRAYJOIN (kv).1 AS key,diff --git a/posthog/hogql_queries/ai/test/__snapshots__/test_suggested_questions_query_runner.ambr b/posthog/hogql_queries/ai/test/__snapshots__/test_suggested_questions_query_runner.ambrindex a1cea2098a3c..54096e39a5c0 100644--- a/posthog/hogql_queries/ai/test/__snapshots__/test_suggested_questions_query_runner.ambr+++ b/posthog/hogql_queries/ai/test/__snapshots__/test_suggested_questions_query_runner.ambr@@ -4,7 +4,7 @@SELECT events.event AS event,count() AS countFROM events- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, minus(now64(6, 'UTC'), toIntervalDay(30))), notIn(events.event, ['$pageleave', '$autocapture', '$$heatmap', '$copy_autocapture', '$set', '$opt_in', '$feature_flag_called', '$experiment_exposure', '$feature_view', '$feature_interaction', '$element_viewed', '$capture_metrics', '$create_alias', '$merge_dangerously', '$groupidentify', 'mcp_tool_call', 'mcp_tools_list', 'mcp_initialize', 'mcp_resources_list', 'mcp_resource_read', 'mcp_prompts_list', 'mcp_prompt_get', 'mcp_custom', 'posthog_identify', 'mcp init', 'mcp_mcpcat:identify', 'mcp_posthog:identify', 'mcp_tool_called', 'mcp tool call', 'mcp tool response', '$snapshot']))+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, toDateTime64(minus(now64(6, 'UTC'), toIntervalDay(30)), 6, 'UTC')), notIn(events.event, ['$pageleave', '$autocapture', '$$heatmap', '$copy_autocapture', '$set', '$opt_in', '$feature_flag_called', '$experiment_exposure', '$feature_view', '$feature_interaction', '$element_viewed', '$capture_metrics', '$create_alias', '$merge_dangerously', '$groupidentify', 'mcp_tool_call', 'mcp_tools_list', 'mcp_initialize', 'mcp_resources_list', 'mcp_resource_read', 'mcp_prompts_list', 'mcp_prompt_get', 'mcp_custom', 'posthog_identify', 'mcp init', 'mcp_mcpcat:identify', 'mcp_posthog:identify', 'mcp_tool_called', 'mcp tool call', 'mcp tool response', '$snapshot']))GROUP BY events.eventORDER BY count DESC, events.event ASCLIMIT 501diff --git a/posthog/hogql_queries/ai/test/__snapshots__/test_suggested_questions_query_runner.new_events_schema.ambr b/posthog/hogql_queries/ai/test/__snapshots__/test_suggested_questions_query_runner.new_events_schema.ambrindex b980577309ac..bd58a018657d 100644--- a/posthog/hogql_queries/ai/test/__snapshots__/test_suggested_questions_query_runner.new_events_schema.ambr+++ b/posthog/hogql_queries/ai/test/__snapshots__/test_suggested_questions_query_runner.new_events_schema.ambr@@ -4,7 +4,7 @@SELECT events.event AS event,count() AS countFROM events_json AS events- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, minus(now64(6, 'UTC'), toIntervalDay(30))), notIn(events.event, ['$pageleave', '$autocapture', '$$heatmap', '$copy_autocapture', '$set', '$opt_in', '$feature_flag_called', '$experiment_exposure', '$feature_view', '$feature_interaction', '$element_viewed', '$capture_metrics', '$create_alias', '$merge_dangerously', '$groupidentify', 'mcp_tool_call', 'mcp_tools_list', 'mcp_initialize', 'mcp_resources_list', 'mcp_resource_read', 'mcp_prompts_list', 'mcp_prompt_get', 'mcp_custom', 'posthog_identify', 'mcp init', 'mcp_mcpcat:identify', 'mcp_posthog:identify', 'mcp_tool_called', 'mcp tool call', 'mcp tool response', '$snapshot']))+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, toDateTime64(minus(now64(6, 'UTC'), toIntervalDay(30)), 6, 'UTC')), notIn(events.event, ['$pageleave', '$autocapture', '$$heatmap', '$copy_autocapture', '$set', '$opt_in', '$feature_flag_called', '$experiment_exposure', '$feature_view', '$feature_interaction', '$element_viewed', '$capture_metrics', '$create_alias', '$merge_dangerously', '$groupidentify', 'mcp_tool_call', 'mcp_tools_list', 'mcp_initialize', 'mcp_resources_list', 'mcp_resource_read', 'mcp_prompts_list', 'mcp_prompt_get', 'mcp_custom', 'posthog_identify', 'mcp init', 'mcp_mcpcat:identify', 'mcp_posthog:identify', 'mcp_tool_called', 'mcp tool call', 'mcp tool response', '$snapshot']))GROUP BY events.eventORDER BY count DESC, events.event ASCLIMIT 501diff --git a/posthog/hogql_queries/ai/test/__snapshots__/test_team_taxonomy_query_runner.ambr b/posthog/hogql_queries/ai/test/__snapshots__/test_team_taxonomy_query_runner.ambrindex 92a40343ea2c..cd5d1283a34f 100644--- a/posthog/hogql_queries/ai/test/__snapshots__/test_team_taxonomy_query_runner.ambr+++ b/posthog/hogql_queries/ai/test/__snapshots__/test_team_taxonomy_query_runner.ambr@@ -4,7 +4,7 @@SELECT events.event AS event,count() AS countFROM events- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, minus(now64(6, 'UTC'), toIntervalDay(30))), notIn(events.event, ['$pageleave', '$autocapture', '$$heatmap', '$copy_autocapture', '$set', '$opt_in', '$feature_flag_called', '$experiment_exposure', '$feature_view', '$feature_interaction', '$element_viewed', '$capture_metrics', '$create_alias', '$merge_dangerously', '$groupidentify', 'mcp_tool_call', 'mcp_tools_list', 'mcp_initialize', 'mcp_resources_list', 'mcp_resource_read', 'mcp_prompts_list', 'mcp_prompt_get', 'mcp_custom', 'posthog_identify', 'mcp init', 'mcp_mcpcat:identify', 'mcp_posthog:identify', 'mcp_tool_called', 'mcp tool call', 'mcp tool response', '$snapshot']))+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, toDateTime64(minus(now64(6, 'UTC'), toIntervalDay(30)), 6, 'UTC')), notIn(events.event, ['$pageleave', '$autocapture', '$$heatmap', '$copy_autocapture', '$set', '$opt_in', '$feature_flag_called', '$experiment_exposure', '$feature_view', '$feature_interaction', '$element_viewed', '$capture_metrics', '$create_alias', '$merge_dangerously', '$groupidentify', 'mcp_tool_call', 'mcp_tools_list', 'mcp_initialize', 'mcp_resources_list', 'mcp_resource_read', 'mcp_prompts_list', 'mcp_prompt_get', 'mcp_custom', 'posthog_identify', 'mcp init', 'mcp_mcpcat:identify', 'mcp_posthog:identify', 'mcp_tool_called', 'mcp tool call', 'mcp tool response', '$snapshot']))GROUP BY events.eventORDER BY count DESC, events.event ASCLIMIT 501diff --git a/posthog/hogql_queries/ai/test/__snapshots__/test_team_taxonomy_query_runner.new_events_schema.ambr b/posthog/hogql_queries/ai/test/__snapshots__/test_team_taxonomy_query_runner.new_events_schema.ambrindex 8ddf629327e5..1801650c38ba 100644--- a/posthog/hogql_queries/ai/test/__snapshots__/test_team_taxonomy_query_runner.new_events_schema.ambr+++ b/posthog/hogql_queries/ai/test/__snapshots__/test_team_taxonomy_query_runner.new_events_schema.ambr@@ -4,7 +4,7 @@SELECT events.event AS event,count() AS countFROM events_json AS events- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, minus(now64(6, 'UTC'), toIntervalDay(30))), notIn(events.event, ['$pageleave', '$autocapture', '$$heatmap', '$copy_autocapture', '$set', '$opt_in', '$feature_flag_called', '$experiment_exposure', '$feature_view', '$feature_interaction', '$element_viewed', '$capture_metrics', '$create_alias', '$merge_dangerously', '$groupidentify', 'mcp_tool_call', 'mcp_tools_list', 'mcp_initialize', 'mcp_resources_list', 'mcp_resource_read', 'mcp_prompts_list', 'mcp_prompt_get', 'mcp_custom', 'posthog_identify', 'mcp init', 'mcp_mcpcat:identify', 'mcp_posthog:identify', 'mcp_tool_called', 'mcp tool call', 'mcp tool response', '$snapshot']))+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, toDateTime64(minus(now64(6, 'UTC'), toIntervalDay(30)), 6, 'UTC')), notIn(events.event, ['$pageleave', '$autocapture', '$$heatmap', '$copy_autocapture', '$set', '$opt_in', '$feature_flag_called', '$experiment_exposure', '$feature_view', '$feature_interaction', '$element_viewed', '$capture_metrics', '$create_alias', '$merge_dangerously', '$groupidentify', 'mcp_tool_call', 'mcp_tools_list', 'mcp_initialize', 'mcp_resources_list', 'mcp_resource_read', 'mcp_prompts_list', 'mcp_prompt_get', 'mcp_custom', 'posthog_identify', 'mcp init', 'mcp_mcpcat:identify', 'mcp_posthog:identify', 'mcp_tool_called', 'mcp tool call', 'mcp tool response', '$snapshot']))GROUP BY events.eventORDER BY count DESC, events.event ASCLIMIT 501diff --git a/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_by_top_level_event_property.ambr b/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_by_top_level_event_property.ambrindex 3b93e78101dd..e326d73eb191 100644--- a/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_by_top_level_event_property.ambr+++ b/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_by_top_level_event_property.ambr@@ -26,7 +26,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'something'), ''), 'null'), '^"|"$', '')), '%paul.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'something'), ''), 'null'), '^"|"$', '')), '%paul.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')LIMIT 1000000)))GROUP BY s.session_id@@ -74,7 +74,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(match(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$host'), ''), 'null'), '^"|"$', '')), '^(localhost|127\\.0\\.0\\.1)($|:)'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(match(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$host'), ''), 'null'), '^"|"$', '')), '^(localhost|127\\.0\\.0\\.1)($|:)'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')LIMIT 1000000)))GROUP BY s.session_id@@ -122,7 +122,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(in(events.event, ['$pageview', 'bar', 'baz', 'foo']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature/target-flag'), ''), 'null'), '^"|"$', ''), 'true'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(in(events.event, ['$pageview', 'bar', 'baz', 'foo']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature/target-flag'), ''), 'null'), '^"|"$', ''), 'true'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -171,7 +171,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(in(events.event, ['$pageview', 'bar', 'baz', 'foo']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature/target-flag'), ''), 'null'), '^"|"$', ''), 'false'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(in(events.event, ['$pageview', 'bar', 'baz', 'foo']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature/target-flag'), ''), 'null'), '^"|"$', ''), 'false'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -220,7 +220,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(in(events.event, ['$pageview', 'bar', 'baz', 'foo']), isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature/target-flag'), ''), 'null'), '^"|"$', ''))), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(in(events.event, ['$pageview', 'bar', 'baz', 'foo']), isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature/target-flag'), ''), 'null'), '^"|"$', ''))), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -269,7 +269,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature/target-flag'), ''), 'null'), '^"|"$', '')), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature/target-flag'), ''), 'null'), '^"|"$', '')), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')LIMIT 1000000)))GROUP BY s.session_id@@ -317,7 +317,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), or(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'probe-one'), ''), 'null'), '^"|"$', ''), 'val'), 0), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'probe-two'), ''), 'null'), '^"|"$', ''), 'val'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), or(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'probe-one'), ''), 'null'), '^"|"$', ''), 'val'), 0), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'probe-two'), ''), 'null'), '^"|"$', ''), 'val'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')LIMIT 1000000)))GROUP BY s.session_id@@ -365,7 +365,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'something'), ''), 'null'), '^"|"$', '')), '%paul.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'something'), ''), 'null'), '^"|"$', '')), '%paul.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')LIMIT 1000000)))GROUP BY s.session_id@@ -413,7 +413,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(match(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$host'), ''), 'null'), '^"|"$', '')), '^(localhost|127\\.0\\.0\\.1)($|:)'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(match(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$host'), ''), 'null'), '^"|"$', '')), '^(localhost|127\\.0\\.0\\.1)($|:)'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')LIMIT 1000000)))GROUP BY s.session_id@@ -461,7 +461,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature/target-flag'), ''), 'null'), '^"|"$', ''), 'true'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature/target-flag'), ''), 'null'), '^"|"$', ''), 'true'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -510,7 +510,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature/target-flag'), ''), 'null'), '^"|"$', ''), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature/target-flag'), ''), 'null'), '^"|"$', ''), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -559,7 +559,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature/target-flag'), ''), 'null'), '^"|"$', '')), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature/target-flag'), ''), 'null'), '^"|"$', '')), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -608,7 +608,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature/target-flag'), ''), 'null'), '^"|"$', '')), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$feature/target-flag'), ''), 'null'), '^"|"$', '')), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')LIMIT 1000000)))GROUP BY s.session_id@@ -656,7 +656,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), or(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'probe-one'), ''), 'null'), '^"|"$', ''), 'val'), 0), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'probe-two'), ''), 'null'), '^"|"$', ''), 'val'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), or(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'probe-one'), ''), 'null'), '^"|"$', ''), 'val'), 0), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'probe-two'), ''), 'null'), '^"|"$', ''), 'val'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')LIMIT 1000000)))GROUP BY s.session_iddiff --git a/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_by_top_level_event_property.new_events_schema.ambr b/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_by_top_level_event_property.new_events_schema.ambrindex ff6b23635089..266e2abc53e8 100644--- a/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_by_top_level_event_property.new_events_schema.ambr+++ b/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_by_top_level_event_property.new_events_schema.ambr@@ -26,7 +26,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^something)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^something)), if(isNull(nullIf(toString(events.properties.something), '')), NULL, if(and(in(ascii(toString(events.properties.something)), tuple(91, 123)), in(ascii(toJSONString(events.properties.something)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.something), '[]'), '{}'), toString(events.properties.something))))), '%paul.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^something)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^something)), if(isNull(nullIf(toString(events.properties.something), '')), NULL, if(and(in(ascii(toString(events.properties.something)), tuple(91, 123)), in(ascii(toJSONString(events.properties.something)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.something), '[]'), '{}'), toString(events.properties.something))))), '%paul.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))LIMIT 1000000)))GROUP BY s.session_id@@ -75,7 +75,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(match(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$host`)), '{}'), JSONStripEmptyStringsAndNulls(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)($|:)'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(match(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$host`)), '{}'), JSONStripEmptyStringsAndNulls(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)($|:)'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))LIMIT 1000000)))GROUP BY s.session_id@@ -124,7 +124,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(in(events.event, ['$pageview', 'bar', 'baz', 'foo']), ifNull(equals(if(has(events.properties.`$feature_flags`, 'target-flag'), if(ifNull(equals(events.properties.`$feature_flags`['target-flag'], '$false'), 0), 'false', events.properties.`$feature_flags`['target-flag']), NULL), 'true'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(in(events.event, ['$pageview', 'bar', 'baz', 'foo']), ifNull(equals(if(has(events.properties.`$feature_flags`, 'target-flag'), if(ifNull(equals(events.properties.`$feature_flags`['target-flag'], '$false'), 0), 'false', events.properties.`$feature_flags`['target-flag']), NULL), 'true'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -174,7 +174,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(in(events.event, ['$pageview', 'bar', 'baz', 'foo']), ifNull(equals(if(has(events.properties.`$feature_flags`, 'target-flag'), if(ifNull(equals(events.properties.`$feature_flags`['target-flag'], '$false'), 0), 'false', events.properties.`$feature_flags`['target-flag']), NULL), 'false'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(in(events.event, ['$pageview', 'bar', 'baz', 'foo']), ifNull(equals(if(has(events.properties.`$feature_flags`, 'target-flag'), if(ifNull(equals(events.properties.`$feature_flags`['target-flag'], '$false'), 0), 'false', events.properties.`$feature_flags`['target-flag']), NULL), 'false'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -224,7 +224,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(in(events.event, ['$pageview', 'bar', 'baz', 'foo']), isNotNull(if(has(events.properties.`$feature_flags`, 'target-flag'), if(ifNull(equals(events.properties.`$feature_flags`['target-flag'], '$false'), 0), 'false', events.properties.`$feature_flags`['target-flag']), NULL))), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(in(events.event, ['$pageview', 'bar', 'baz', 'foo']), isNotNull(if(has(events.properties.`$feature_flags`, 'target-flag'), if(ifNull(equals(events.properties.`$feature_flags`['target-flag'], '$false'), 0), 'false', events.properties.`$feature_flags`['target-flag']), NULL))), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -274,7 +274,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), isNotNull(if(has(events.properties.`$feature_flags`, 'target-flag'), if(ifNull(equals(events.properties.`$feature_flags`['target-flag'], '$false'), 0), 'false', events.properties.`$feature_flags`['target-flag']), NULL)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), isNotNull(if(has(events.properties.`$feature_flags`, 'target-flag'), if(ifNull(equals(events.properties.`$feature_flags`['target-flag'], '$false'), 0), 'false', events.properties.`$feature_flags`['target-flag']), NULL)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))LIMIT 1000000)))GROUP BY s.session_id@@ -323,7 +323,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), or(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`probe-one`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`probe-one`)), if(isNull(nullIf(toString(events.properties.`probe-one`), '')), NULL, if(and(in(ascii(toString(events.properties.`probe-one`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`probe-one`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`probe-one`), '[]'), '{}'), toString(events.properties.`probe-one`)))), 'val'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`probe-two`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`probe-two`)), if(isNull(nullIf(toString(events.properties.`probe-two`), '')), NULL, if(and(in(ascii(toString(events.properties.`probe-two`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`probe-two`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`probe-two`), '[]'), '{}'), toString(events.properties.`probe-two`)))), 'val'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), or(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`probe-one`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`probe-one`)), if(isNull(nullIf(toString(events.properties.`probe-one`), '')), NULL, if(and(in(ascii(toString(events.properties.`probe-one`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`probe-one`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`probe-one`), '[]'), '{}'), toString(events.properties.`probe-one`)))), 'val'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`probe-two`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`probe-two`)), if(isNull(nullIf(toString(events.properties.`probe-two`), '')), NULL, if(and(in(ascii(toString(events.properties.`probe-two`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`probe-two`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`probe-two`), '[]'), '{}'), toString(events.properties.`probe-two`)))), 'val'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))LIMIT 1000000)))GROUP BY s.session_id@@ -372,7 +372,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^something)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^something)), if(isNull(nullIf(toString(events.properties.something), '')), NULL, if(and(in(ascii(toString(events.properties.something)), tuple(91, 123)), in(ascii(toJSONString(events.properties.something)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.something), '[]'), '{}'), toString(events.properties.something))))), '%paul.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^something)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^something)), if(isNull(nullIf(toString(events.properties.something), '')), NULL, if(and(in(ascii(toString(events.properties.something)), tuple(91, 123)), in(ascii(toJSONString(events.properties.something)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.something), '[]'), '{}'), toString(events.properties.something))))), '%paul.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))LIMIT 1000000)))GROUP BY s.session_id@@ -421,7 +421,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(match(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$host`)), '{}'), JSONStripEmptyStringsAndNulls(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)($|:)'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(match(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$host`)), '{}'), JSONStripEmptyStringsAndNulls(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)($|:)'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))LIMIT 1000000)))GROUP BY s.session_id@@ -470,7 +470,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(has(events.properties.`$feature_flags`, 'target-flag'), if(ifNull(equals(events.properties.`$feature_flags`['target-flag'], '$false'), 0), 'false', events.properties.`$feature_flags`['target-flag']), NULL), 'true'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(has(events.properties.`$feature_flags`, 'target-flag'), if(ifNull(equals(events.properties.`$feature_flags`['target-flag'], '$false'), 0), 'false', events.properties.`$feature_flags`['target-flag']), NULL), 'true'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -520,7 +520,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(has(events.properties.`$feature_flags`, 'target-flag'), if(ifNull(equals(events.properties.`$feature_flags`['target-flag'], '$false'), 0), 'false', events.properties.`$feature_flags`['target-flag']), NULL), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(has(events.properties.`$feature_flags`, 'target-flag'), if(ifNull(equals(events.properties.`$feature_flags`['target-flag'], '$false'), 0), 'false', events.properties.`$feature_flags`['target-flag']), NULL), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -570,7 +570,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), isNotNull(if(has(events.properties.`$feature_flags`, 'target-flag'), if(ifNull(equals(events.properties.`$feature_flags`['target-flag'], '$false'), 0), 'false', events.properties.`$feature_flags`['target-flag']), NULL)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), isNotNull(if(has(events.properties.`$feature_flags`, 'target-flag'), if(ifNull(equals(events.properties.`$feature_flags`['target-flag'], '$false'), 0), 'false', events.properties.`$feature_flags`['target-flag']), NULL)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -620,7 +620,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), isNotNull(if(has(events.properties.`$feature_flags`, 'target-flag'), if(ifNull(equals(events.properties.`$feature_flags`['target-flag'], '$false'), 0), 'false', events.properties.`$feature_flags`['target-flag']), NULL)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), isNotNull(if(has(events.properties.`$feature_flags`, 'target-flag'), if(ifNull(equals(events.properties.`$feature_flags`['target-flag'], '$false'), 0), 'false', events.properties.`$feature_flags`['target-flag']), NULL)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))LIMIT 1000000)))GROUP BY s.session_id@@ -669,7 +669,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), or(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`probe-one`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`probe-one`)), if(isNull(nullIf(toString(events.properties.`probe-one`), '')), NULL, if(and(in(ascii(toString(events.properties.`probe-one`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`probe-one`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`probe-one`), '[]'), '{}'), toString(events.properties.`probe-one`)))), 'val'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`probe-two`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`probe-two`)), if(isNull(nullIf(toString(events.properties.`probe-two`), '')), NULL, if(and(in(ascii(toString(events.properties.`probe-two`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`probe-two`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`probe-two`), '[]'), '{}'), toString(events.properties.`probe-two`)))), 'val'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), or(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`probe-one`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`probe-one`)), if(isNull(nullIf(toString(events.properties.`probe-one`), '')), NULL, if(and(in(ascii(toString(events.properties.`probe-one`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`probe-one`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`probe-one`), '[]'), '{}'), toString(events.properties.`probe-one`)))), 'val'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`probe-two`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`probe-two`)), if(isNull(nullIf(toString(events.properties.`probe-two`), '')), NULL, if(and(in(ascii(toString(events.properties.`probe-two`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`probe-two`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`probe-two`), '[]'), '{}'), toString(events.properties.`probe-two`)))), 'val'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))LIMIT 1000000)))GROUP BY s.session_iddiff --git a/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_from_query.ambr b/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_from_query.ambrindex 895a627e9048..a34f22a78cc7 100644--- a/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_from_query.ambr+++ b/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_from_query.ambr@@ -26,7 +26,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, %(hogql_val_7)s)), equals(events.mat_pp_rgInternal, %(hogql_val_8)s), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, %(hogql_val_7)s), 6, %(hogql_val_8)s)), equals(events.mat_pp_rgInternal, %(hogql_val_9)s), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -76,7 +76,7 @@WHERE equals(person.team_id, 99999)GROUP BY person.idHAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, %(hogql_val_8)s), person.version), plus(now64(6, %(hogql_val_9)s), toIntervalDay(1)))) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id)- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, %(hogql_val_10)s)), ifNull(equals(events__person.properties___rgInternal, %(hogql_val_11)s), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, %(hogql_val_10)s), 6, %(hogql_val_11)s)), ifNull(equals(events__person.properties___rgInternal, %(hogql_val_12)s), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -126,7 +126,7 @@WHERE equals(person.team_id, 99999)GROUP BY person.idHAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, %(hogql_val_8)s), person.version), plus(now64(6, %(hogql_val_9)s), toIntervalDay(1)))) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id)- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, %(hogql_val_10)s)), ifNull(equals(events__person.properties___rgInternal, %(hogql_val_11)s), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, %(hogql_val_10)s), 6, %(hogql_val_11)s)), ifNull(equals(events__person.properties___rgInternal, %(hogql_val_12)s), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -164,7 +164,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, %(hogql_val_7)s)), equals(events.mat_pp_rgInternal, %(hogql_val_8)s), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, %(hogql_val_7)s), 6, %(hogql_val_8)s)), equals(events.mat_pp_rgInternal, %(hogql_val_9)s), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -202,7 +202,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, %(hogql_val_7)s)), equals(events.mat_pp_rgInternal, %(hogql_val_8)s), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, %(hogql_val_7)s), 6, %(hogql_val_8)s)), equals(events.mat_pp_rgInternal, %(hogql_val_9)s), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -283,7 +283,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.mat_pp_email, 'bla'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.mat_pp_email, 'bla'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -375,7 +375,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$session_id'), ''), 'null'), '^"|"$', '') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$session_id'), ''), 'null'), '^"|"$', '')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$session_id'), ''), 'null'), '^"|"$', '')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$session_id'), ''), 'null'), '^"|"$', '')HAVING 1LIMIT 1000000)))@@ -467,7 +467,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.mat_pp_email, 'bla'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.mat_pp_email, 'bla'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -559,7 +559,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$session_id'), ''), 'null'), '^"|"$', '') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$session_id'), ''), 'null'), '^"|"$', '')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$session_id'), ''), 'null'), '^"|"$', '')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$session_id'), ''), 'null'), '^"|"$', '')HAVING 1LIMIT 1000000)))@@ -666,7 +666,7 @@WHERE equals(person.team_id, 99999)GROUP BY person.idHAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))))))) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id)- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__person.properties___email, 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__person.properties___email, 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -773,7 +773,7 @@WHERE equals(person.team_id, 99999)GROUP BY person.idHAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))))))) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id)- WHERE and(equals(events.team_id, 99999), notEmpty(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$session_id'), ''), 'null'), '^"|"$', '')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__person.properties___email, 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$session_id'), ''), 'null'), '^"|"$', '')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__person.properties___email, 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$session_id'), ''), 'null'), '^"|"$', '')HAVING 1LIMIT 1000000)))@@ -880,7 +880,7 @@WHERE equals(person.team_id, 99999)GROUP BY person.idHAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))))))) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id)- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__person.properties___email, 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__person.properties___email, 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -987,7 +987,7 @@WHERE equals(person.team_id, 99999)GROUP BY person.idHAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))))))) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id)- WHERE and(equals(events.team_id, 99999), notEmpty(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$session_id'), ''), 'null'), '^"|"$', '')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__person.properties___email, 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$session_id'), ''), 'null'), '^"|"$', '')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__person.properties___email, 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$session_id'), ''), 'null'), '^"|"$', '')HAVING 1LIMIT 1000000)))@@ -1079,7 +1079,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.mat_pp_email, 'bla'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.mat_pp_email, 'bla'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -1171,7 +1171,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$session_id'), ''), 'null'), '^"|"$', '') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$session_id'), ''), 'null'), '^"|"$', '')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$session_id'), ''), 'null'), '^"|"$', '')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$session_id'), ''), 'null'), '^"|"$', '')HAVING 1LIMIT 1000000)))@@ -1263,7 +1263,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.mat_pp_email, 'bla'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.mat_pp_email, 'bla'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -1355,7 +1355,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$session_id'), ''), 'null'), '^"|"$', '') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$session_id'), ''), 'null'), '^"|"$', '')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$session_id'), ''), 'null'), '^"|"$', '')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$session_id'), ''), 'null'), '^"|"$', '')HAVING 1LIMIT 1000000)))@@ -2004,7 +2004,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2023-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2023-01-04 00:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'custom-event'), and(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0), equals(events.`$session_id`, 'test_action_filter-session-one'), equals(events.`$window_id`, 'test_action_filter-window-id'))), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'custom-event'), and(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0), equals(events.`$session_id`, 'test_action_filter-session-one'), equals(events.`$window_id`, 'test_action_filter-window-id'))), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -2053,7 +2053,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2023-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2023-01-04 00:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'custom-event'), and(equals(events.`$session_id`, 'test_action_filter-session-one'), equals(events.`$window_id`, 'test_action_filter-window-id'))), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'custom-event'), and(equals(events.`$session_id`, 'test_action_filter-session-one'), equals(events.`$window_id`, 'test_action_filter-window-id'))), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -2102,7 +2102,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2023-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2023-01-04 00:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(and(equals(events.event, 'custom-event'), and(equals(events.`$session_id`, 'test_action_filter-session-one'), equals(events.`$window_id`, 'test_action_filter-window-id'))), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(and(equals(events.event, 'custom-event'), and(equals(events.`$session_id`, 'test_action_filter-session-one'), equals(events.`$window_id`, 'test_action_filter-window-id'))), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -2151,7 +2151,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2023-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2023-01-04 00:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(and(equals(events.event, 'custom-event'), and(equals(events.`$session_id`, 'test_action_filter-session-one'), equals(events.`$window_id`, 'test_action_filter-window-id'))), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(and(equals(events.event, 'custom-event'), and(equals(events.`$session_id`, 'test_action_filter-session-one'), equals(events.`$window_id`, 'test_action_filter-window-id'))), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -2209,13 +2209,13 @@WHERE and(equals(events.team_id, 99999), equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), '00000000-0000-0000-0000-000000000000'), lessOrEquals(events.timestamp, toDateTime64(toDateTime64('today', 6, 'UTC'), 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null'))))), greaterOrEquals(s.min_first_timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), and(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'custom-event'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'custom-event'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -2264,7 +2264,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2021-01-21 20:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -2313,7 +2313,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2021-01-21 20:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -2362,7 +2362,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2021-01-21 20:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -3234,7 +3234,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -3283,7 +3283,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$autocapture'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$autocapture'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -3332,7 +3332,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -3424,7 +3424,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -3473,7 +3473,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -3527,7 +3527,7 @@FROM groupsWHERE and(equals(groups.team_id, 99999), equals(index, 1))GROUP BY groups.group_type_index, groups.group_key) AS events__group_1 ON equals(events.`$group_1`, events__group_1.key)- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(events__group_1.properties___name, 'org one'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(events__group_1.properties___name, 'org one'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -3581,7 +3581,7 @@FROM groupsWHERE and(equals(groups.team_id, 99999), equals(index, 1))GROUP BY groups.group_type_index, groups.group_key) AS events__group_1 ON equals(events.`$group_1`, events__group_1.key)- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__group_1.properties___name, 'org one'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__group_1.properties___name, 'org one'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -3635,7 +3635,7 @@FROM groupsWHERE and(equals(groups.team_id, 99999), equals(index, 2))GROUP BY groups.group_type_index, groups.group_key) AS events__group_2 ON equals(events.`$group_2`, events__group_2.key)- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__group_2.properties___name, 'org one'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__group_2.properties___name, 'org one'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -3684,7 +3684,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -3733,13 +3733,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -3788,13 +3788,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -3843,7 +3843,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -3892,7 +3892,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'something else'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'something else'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -3941,7 +3941,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -3990,7 +3990,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -4039,7 +4039,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -4088,7 +4088,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$autocapture'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$autocapture'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -4137,7 +4137,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -4186,7 +4186,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -4235,7 +4235,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'a_different_event'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'a_different_event'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -4284,7 +4284,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'a_different_event'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Safari'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'a_different_event'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Safari'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -4333,25 +4333,25 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'is_internal_user'), ''), 'null'), '^"|"$', ''), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'is_internal_user'), ''), 'null'), '^"|"$', ''), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING equals(countIf(ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 0)), 0)LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING equals(countIf(ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 0)), 0)LIMIT 1000000)), globalNotIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')LIMIT 1000000)))GROUP BY s.session_id@@ -4399,7 +4399,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -4448,13 +4448,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageleave'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageleave'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -5803,7 +5803,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -5852,7 +5852,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%gmail.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%gmail.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')LIMIT 1000000)))GROUP BY s.session_id@@ -5943,13 +5943,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'new-event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'new-event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -5998,13 +5998,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'new-event2'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'new-event2'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -6053,13 +6053,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), or(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'new-event2'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'new-event2'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -6108,13 +6108,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'foo'), ''), 'null'), '^"|"$', ''), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'foo'), ''), 'null'), '^"|"$', ''), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'bar'), ''), 'null'), '^"|"$', ''), 'foo'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'bar'), ''), 'null'), '^"|"$', ''), 'foo'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -6163,13 +6163,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'foo'), ''), 'null'), '^"|"$', ''), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'foo'), ''), 'null'), '^"|"$', ''), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'new-event'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'foo'), ''), 'null'), '^"|"$', ''), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'new-event'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'foo'), ''), 'null'), '^"|"$', ''), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -6218,13 +6218,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), or(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'foo'), ''), 'null'), '^"|"$', ''), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'foo'), ''), 'null'), '^"|"$', ''), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'new-event'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'foo'), ''), 'null'), '^"|"$', ''), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'new-event'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'foo'), ''), 'null'), '^"|"$', ''), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -6273,13 +6273,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'custom_event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'custom_event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -6328,13 +6328,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), or(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'custom_event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'custom_event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -6632,7 +6632,7 @@WHERE and(equals(events.team_id, 99999), equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), '00000000-0000-0000-0000-000000000000'), lessOrEquals(events.timestamp, toDateTime64(toDateTime64('today', 6, 'UTC'), 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('today', 6, 'UTC')), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null'))))), greaterOrEquals(s.min_first_timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -6690,7 +6690,7 @@WHERE and(equals(events.team_id, 99999), equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), '00000000-0000-0000-0000-000000000000'), lessOrEquals(events.timestamp, toDateTime64(toDateTime64('today', 6, 'UTC'), 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('today', 6, 'UTC')), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null'))))), greaterOrEquals(s.min_first_timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -6739,7 +6739,7 @@WHERE and(equals(s.team_id, 99999), in(s.session_id, ['session_id_one']), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')), in(nullIf(nullIf(events.`$session_id`, ''), 'null'), ['session_id_one']))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')), in(nullIf(nullIf(events.`$session_id`, ''), 'null'), ['session_id_one']))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -6788,7 +6788,7 @@WHERE and(equals(s.team_id, 99999), in(s.session_id, ['session_id_two']), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')), in(nullIf(nullIf(events.`$session_id`, ''), 'null'), ['session_id_two']))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')), in(nullIf(nullIf(events.`$session_id`, ''), 'null'), ['session_id_two']))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -6837,13 +6837,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -6892,13 +6892,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), or(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -7223,7 +7223,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -7272,13 +7272,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalNotIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(match(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$host'), ''), 'null'), '^"|"$', '')), '^(localhost|127\\.0\\.0\\.1)($|:)'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(match(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$host'), ''), 'null'), '^"|"$', '')), '^(localhost|127\\.0\\.0\\.1)($|:)'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')LIMIT 1000000)))GROUP BY s.session_id@@ -7326,7 +7326,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -7375,7 +7375,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'is_internal_user'), ''), 'null'), '^"|"$', ''), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'is_internal_user'), ''), 'null'), '^"|"$', ''), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -7424,7 +7424,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -7473,7 +7473,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'is_internal_user'), ''), 'null'), '^"|"$', ''), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'is_internal_user'), ''), 'null'), '^"|"$', ''), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -7522,7 +7522,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -7571,7 +7571,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'is_internal_user'), ''), 'null'), '^"|"$', ''), 'true'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'is_internal_user'), ''), 'null'), '^"|"$', ''), 'true'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -7620,7 +7620,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -7669,7 +7669,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -7718,7 +7718,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -7767,7 +7767,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -7816,7 +7816,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2023-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2023-01-04 00:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'custom-event'), and(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0), equals(events.`$session_id`, 'test_action_filter-session-one'), equals(events.`$window_id`, 'test_action_filter-window-id'))), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'custom-event'), and(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0), equals(events.`$session_id`, 'test_action_filter-session-one'), equals(events.`$window_id`, 'test_action_filter-window-id'))), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -7865,7 +7865,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2023-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2023-01-04 00:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'custom-event'), and(equals(events.`$session_id`, 'test_action_filter-session-one'), equals(events.`$window_id`, 'test_action_filter-window-id'))), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'custom-event'), and(equals(events.`$session_id`, 'test_action_filter-session-one'), equals(events.`$window_id`, 'test_action_filter-window-id'))), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -7914,7 +7914,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2023-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2023-01-04 00:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(and(equals(events.event, 'custom-event'), and(equals(events.`$session_id`, 'test_action_filter-session-one'), equals(events.`$window_id`, 'test_action_filter-window-id'))), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(and(equals(events.event, 'custom-event'), and(equals(events.`$session_id`, 'test_action_filter-session-one'), equals(events.`$window_id`, 'test_action_filter-window-id'))), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -7963,7 +7963,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2023-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2023-01-04 00:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(and(equals(events.event, 'custom-event'), and(equals(events.`$session_id`, 'test_action_filter-session-one'), equals(events.`$window_id`, 'test_action_filter-window-id'))), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(and(equals(events.event, 'custom-event'), and(equals(events.`$session_id`, 'test_action_filter-session-one'), equals(events.`$window_id`, 'test_action_filter-window-id'))), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -8021,13 +8021,13 @@WHERE and(equals(events.team_id, 99999), equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), '00000000-0000-0000-0000-000000000000'), lessOrEquals(events.timestamp, toDateTime64(toDateTime64('today', 6, 'UTC'), 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null'))))), greaterOrEquals(s.min_first_timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), and(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'custom-event'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'custom-event'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -8076,7 +8076,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2021-01-21 20:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -8125,7 +8125,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2021-01-21 20:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -8174,7 +8174,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2021-01-21 20:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -9046,7 +9046,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -9095,7 +9095,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$autocapture'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$autocapture'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -9144,7 +9144,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -9236,7 +9236,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -9285,7 +9285,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -9339,7 +9339,7 @@FROM groupsWHERE and(equals(groups.team_id, 99999), equals(index, 1))GROUP BY groups.group_type_index, groups.group_key) AS events__group_1 ON equals(events.`$group_1`, events__group_1.key)- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(events__group_1.properties___name, 'org one'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(events__group_1.properties___name, 'org one'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -9393,7 +9393,7 @@FROM groupsWHERE and(equals(groups.team_id, 99999), equals(index, 1))GROUP BY groups.group_type_index, groups.group_key) AS events__group_1 ON equals(events.`$group_1`, events__group_1.key)- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__group_1.properties___name, 'org one'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__group_1.properties___name, 'org one'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -9447,7 +9447,7 @@FROM groupsWHERE and(equals(groups.team_id, 99999), equals(index, 2))GROUP BY groups.group_type_index, groups.group_key) AS events__group_2 ON equals(events.`$group_2`, events__group_2.key)- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__group_2.properties___name, 'org one'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__group_2.properties___name, 'org one'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -9496,7 +9496,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -9545,13 +9545,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -9600,13 +9600,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -9655,7 +9655,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -9704,7 +9704,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'something else'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'something else'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -9753,7 +9753,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -9802,7 +9802,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -9851,7 +9851,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -9900,7 +9900,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$autocapture'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$autocapture'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -9949,7 +9949,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -9998,7 +9998,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -10047,7 +10047,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'a_different_event'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'a_different_event'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -10096,7 +10096,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'a_different_event'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Safari'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'a_different_event'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Safari'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -10145,25 +10145,25 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'is_internal_user'), ''), 'null'), '^"|"$', ''), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'is_internal_user'), ''), 'null'), '^"|"$', ''), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING equals(countIf(ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 0)), 0)LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING equals(countIf(ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 0)), 0)LIMIT 1000000)), globalNotIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')LIMIT 1000000)))GROUP BY s.session_id@@ -10211,7 +10211,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -10260,13 +10260,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageleave'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageleave'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -11615,7 +11615,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -11664,7 +11664,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%gmail.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%gmail.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')LIMIT 1000000)))GROUP BY s.session_id@@ -11755,13 +11755,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'new-event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'new-event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -11810,13 +11810,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'new-event2'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'new-event2'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -11865,13 +11865,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), or(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'new-event2'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'new-event2'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -11920,13 +11920,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'foo'), ''), 'null'), '^"|"$', ''), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'foo'), ''), 'null'), '^"|"$', ''), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'bar'), ''), 'null'), '^"|"$', ''), 'foo'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'bar'), ''), 'null'), '^"|"$', ''), 'foo'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -11975,13 +11975,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'foo'), ''), 'null'), '^"|"$', ''), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'foo'), ''), 'null'), '^"|"$', ''), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'new-event'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'foo'), ''), 'null'), '^"|"$', ''), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'new-event'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'foo'), ''), 'null'), '^"|"$', ''), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -12030,13 +12030,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), or(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'foo'), ''), 'null'), '^"|"$', ''), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'foo'), ''), 'null'), '^"|"$', ''), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'new-event'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'foo'), ''), 'null'), '^"|"$', ''), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'new-event'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'foo'), ''), 'null'), '^"|"$', ''), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -12085,13 +12085,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'custom_event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'custom_event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -12140,13 +12140,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), or(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'custom_event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'custom_event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -12444,7 +12444,7 @@WHERE and(equals(events.team_id, 99999), equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), '00000000-0000-0000-0000-000000000000'), lessOrEquals(events.timestamp, toDateTime64(toDateTime64('today', 6, 'UTC'), 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('today', 6, 'UTC')), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null'))))), greaterOrEquals(s.min_first_timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -12502,7 +12502,7 @@WHERE and(equals(events.team_id, 99999), equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), '00000000-0000-0000-0000-000000000000'), lessOrEquals(events.timestamp, toDateTime64(toDateTime64('today', 6, 'UTC'), 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('today', 6, 'UTC')), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null'))))), greaterOrEquals(s.min_first_timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -12551,7 +12551,7 @@WHERE and(equals(s.team_id, 99999), in(s.session_id, ['session_id_one']), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')), in(nullIf(nullIf(events.`$session_id`, ''), 'null'), ['session_id_one']))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')), in(nullIf(nullIf(events.`$session_id`, ''), 'null'), ['session_id_one']))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -12600,7 +12600,7 @@WHERE and(equals(s.team_id, 99999), in(s.session_id, ['session_id_two']), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')), in(nullIf(nullIf(events.`$session_id`, ''), 'null'), ['session_id_two']))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')), in(nullIf(nullIf(events.`$session_id`, ''), 'null'), ['session_id_two']))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -12649,13 +12649,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -12704,13 +12704,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), or(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -13035,7 +13035,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -13084,13 +13084,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalNotIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(match(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$host'), ''), 'null'), '^"|"$', '')), '^(localhost|127\\.0\\.0\\.1)($|:)'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(match(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$host'), ''), 'null'), '^"|"$', '')), '^(localhost|127\\.0\\.0\\.1)($|:)'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')LIMIT 1000000)))GROUP BY s.session_id@@ -13138,7 +13138,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -13187,7 +13187,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'is_internal_user'), ''), 'null'), '^"|"$', ''), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'is_internal_user'), ''), 'null'), '^"|"$', ''), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -13236,7 +13236,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -13285,7 +13285,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'is_internal_user'), ''), 'null'), '^"|"$', ''), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'is_internal_user'), ''), 'null'), '^"|"$', ''), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -13334,7 +13334,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -13383,7 +13383,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'is_internal_user'), ''), 'null'), '^"|"$', ''), 'true'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'is_internal_user'), ''), 'null'), '^"|"$', ''), 'true'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -13432,7 +13432,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -13481,7 +13481,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -13530,7 +13530,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -13579,7 +13579,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))diff --git a/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_from_query.new_events_schema.ambr b/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_from_query.new_events_schema.ambrindex 89e30bd1ab88..e1f4b5c09d7a 100644--- a/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_from_query.new_events_schema.ambr+++ b/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_from_query.new_events_schema.ambr@@ -26,7 +26,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, %(hogql_val_7)s)), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^rgInternal)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^rgInternal)), if(isNull(nullIf(toString(events.person_properties.rgInternal), '')), NULL, if(and(in(ascii(toString(events.person_properties.rgInternal)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.rgInternal)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.rgInternal), '[]'), '{}'), toString(events.person_properties.rgInternal)))), %(hogql_val_8)s), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, %(hogql_val_7)s), 6, %(hogql_val_8)s)), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^rgInternal)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^rgInternal)), if(isNull(nullIf(toString(events.person_properties.rgInternal), '')), NULL, if(and(in(ascii(toString(events.person_properties.rgInternal)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.rgInternal)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.rgInternal), '[]'), '{}'), toString(events.person_properties.rgInternal)))), %(hogql_val_9)s), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -76,7 +76,7 @@WHERE equals(person.team_id, 99999)GROUP BY person.idHAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, %(hogql_val_8)s), person.version), plus(now64(6, %(hogql_val_9)s), toIntervalDay(1)))) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id)- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, %(hogql_val_10)s)), ifNull(equals(events__person.properties___rgInternal, %(hogql_val_11)s), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, %(hogql_val_10)s), 6, %(hogql_val_11)s)), ifNull(equals(events__person.properties___rgInternal, %(hogql_val_12)s), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -126,7 +126,7 @@WHERE equals(person.team_id, 99999)GROUP BY person.idHAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, %(hogql_val_8)s), person.version), plus(now64(6, %(hogql_val_9)s), toIntervalDay(1)))) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id)- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, %(hogql_val_10)s)), ifNull(equals(events__person.properties___rgInternal, %(hogql_val_11)s), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, %(hogql_val_10)s), 6, %(hogql_val_11)s)), ifNull(equals(events__person.properties___rgInternal, %(hogql_val_12)s), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -164,7 +164,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, %(hogql_val_7)s)), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^rgInternal)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^rgInternal)), if(isNull(nullIf(toString(events.person_properties.rgInternal), '')), NULL, if(and(in(ascii(toString(events.person_properties.rgInternal)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.rgInternal)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.rgInternal), '[]'), '{}'), toString(events.person_properties.rgInternal)))), %(hogql_val_8)s), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, %(hogql_val_7)s), 6, %(hogql_val_8)s)), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^rgInternal)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^rgInternal)), if(isNull(nullIf(toString(events.person_properties.rgInternal), '')), NULL, if(and(in(ascii(toString(events.person_properties.rgInternal)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.rgInternal)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.rgInternal), '[]'), '{}'), toString(events.person_properties.rgInternal)))), %(hogql_val_9)s), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -202,7 +202,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, %(hogql_val_7)s)), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^rgInternal)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^rgInternal)), if(isNull(nullIf(toString(events.person_properties.rgInternal), '')), NULL, if(and(in(ascii(toString(events.person_properties.rgInternal)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.rgInternal)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.rgInternal), '[]'), '{}'), toString(events.person_properties.rgInternal)))), %(hogql_val_8)s), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, %(hogql_val_7)s), 6, %(hogql_val_8)s)), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^rgInternal)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^rgInternal)), if(isNull(nullIf(toString(events.person_properties.rgInternal), '')), NULL, if(and(in(ascii(toString(events.person_properties.rgInternal)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.rgInternal)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.rgInternal), '[]'), '{}'), toString(events.person_properties.rgInternal)))), %(hogql_val_9)s), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -240,7 +240,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -290,7 +290,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -340,7 +340,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -390,7 +390,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -455,7 +455,7 @@WHERE equals(person.team_id, 99999)GROUP BY person.idHAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))))))) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id)- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__person.properties___email, 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__person.properties___email, 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -520,7 +520,7 @@WHERE equals(person.team_id, 99999)GROUP BY person.idHAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))))))) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id)- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__person.properties___email, 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__person.properties___email, 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -585,7 +585,7 @@WHERE equals(person.team_id, 99999)GROUP BY person.idHAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))))))) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id)- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__person.properties___email, 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__person.properties___email, 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -650,7 +650,7 @@WHERE equals(person.team_id, 99999)GROUP BY person.idHAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))))))) SETTINGS optimize_aggregation_in_order=1) AS events__person ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), events__person.id)- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__person.properties___email, 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__person.properties___email, 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -700,7 +700,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -750,7 +750,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -800,7 +800,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -850,7 +850,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -1512,7 +1512,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2023-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2023-01-04 00:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'custom-event'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'test_action_filter-session-one'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), if(isNull(nullIf(toString(events.properties.`$window_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$window_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$window_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$window_id`), '[]'), '{}'), toString(events.properties.`$window_id`)))), 'test_action_filter-window-id'), 0))), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'custom-event'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'test_action_filter-session-one'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), if(isNull(nullIf(toString(events.properties.`$window_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$window_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$window_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$window_id`), '[]'), '{}'), toString(events.properties.`$window_id`)))), 'test_action_filter-window-id'), 0))), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -1562,7 +1562,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2023-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2023-01-04 00:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(and(equals(events.event, 'custom-event'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'test_action_filter-session-one'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), if(isNull(nullIf(toString(events.properties.`$window_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$window_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$window_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$window_id`), '[]'), '{}'), toString(events.properties.`$window_id`)))), 'test_action_filter-window-id'), 0))), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(and(equals(events.event, 'custom-event'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'test_action_filter-session-one'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), if(isNull(nullIf(toString(events.properties.`$window_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$window_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$window_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$window_id`), '[]'), '{}'), toString(events.properties.`$window_id`)))), 'test_action_filter-window-id'), 0))), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -1612,7 +1612,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2023-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2023-01-04 00:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(and(equals(events.event, 'custom-event'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'test_action_filter-session-one'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), if(isNull(nullIf(toString(events.properties.`$window_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$window_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$window_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$window_id`), '[]'), '{}'), toString(events.properties.`$window_id`)))), 'test_action_filter-window-id'), 0))), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(and(equals(events.event, 'custom-event'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'test_action_filter-session-one'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), if(isNull(nullIf(toString(events.properties.`$window_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$window_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$window_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$window_id`), '[]'), '{}'), toString(events.properties.`$window_id`)))), 'test_action_filter-window-id'), 0))), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -1662,7 +1662,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2023-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2023-01-04 00:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'custom-event'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Firefox'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'test_action_filter-session-one'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), if(isNull(nullIf(toString(events.properties.`$window_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$window_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$window_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$window_id`), '[]'), '{}'), toString(events.properties.`$window_id`)))), 'test_action_filter-window-id'), 0))), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'custom-event'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Firefox'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'test_action_filter-session-one'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), if(isNull(nullIf(toString(events.properties.`$window_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$window_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$window_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$window_id`), '[]'), '{}'), toString(events.properties.`$window_id`)))), 'test_action_filter-window-id'), 0))), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -1721,13 +1721,13 @@WHERE and(equals(events.team_id, 99999), equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), '00000000-0000-0000-0000-000000000000'), lessOrEquals(events.timestamp, toDateTime64(toDateTime64('today', 6, 'UTC'), 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))))))), greaterOrEquals(s.min_first_timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), and(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'custom-event'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'custom-event'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -1777,7 +1777,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2021-01-21 20:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -1827,7 +1827,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2021-01-21 20:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Firefox'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Firefox'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -1877,7 +1877,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2021-01-21 20:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -1927,7 +1927,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$autocapture'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$autocapture'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -1977,7 +1977,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -2027,7 +2027,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -2077,7 +2077,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -2127,7 +2127,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -2182,7 +2182,7 @@FROM groupsWHERE and(equals(groups.team_id, 99999), equals(index, 1))GROUP BY groups.group_type_index, groups.group_key) AS events__group_1 ON equals(events.properties.`$group_1`, events__group_1.key)- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__group_1.properties___name, 'org one'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__group_1.properties___name, 'org one'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -2237,7 +2237,7 @@FROM groupsWHERE and(equals(groups.team_id, 99999), equals(index, 2))GROUP BY groups.group_type_index, groups.group_key) AS events__group_2 ON equals(events.properties.`$group_2`, events__group_2.key)- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__group_2.properties___name, 'org one'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__group_2.properties___name, 'org one'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -2292,7 +2292,7 @@FROM groupsWHERE and(equals(groups.team_id, 99999), equals(index, 1))GROUP BY groups.group_type_index, groups.group_key) AS events__group_1 ON equals(events.properties.`$group_1`, events__group_1.key)- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(events__group_1.properties___name, 'org one'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(events__group_1.properties___name, 'org one'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -2342,13 +2342,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -2398,13 +2398,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -2454,7 +2454,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -2504,7 +2504,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'something else'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'something else'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -2554,7 +2554,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -2604,7 +2604,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -2654,7 +2654,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -2704,7 +2704,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$autocapture'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$autocapture'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -2754,7 +2754,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -2804,7 +2804,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -2854,7 +2854,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'a_different_event'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'a_different_event'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -2904,7 +2904,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'a_different_event'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Safari'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'a_different_event'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Safari'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -2954,7 +2954,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -3004,7 +3004,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -3054,25 +3054,25 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), if(isNull(nullIf(toString(events.properties.is_internal_user), '')), NULL, if(and(in(ascii(toString(events.properties.is_internal_user)), tuple(91, 123)), in(ascii(toJSONString(events.properties.is_internal_user)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.is_internal_user), '[]'), '{}'), toString(events.properties.is_internal_user)))), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), if(isNull(nullIf(toString(events.properties.is_internal_user), '')), NULL, if(and(in(ascii(toString(events.properties.is_internal_user)), tuple(91, 123)), in(ascii(toJSONString(events.properties.is_internal_user)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.is_internal_user), '[]'), '{}'), toString(events.properties.is_internal_user)))), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING equals(countIf(ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 0)), 0)LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING equals(countIf(ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 0)), 0)LIMIT 1000000)), globalNotIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))LIMIT 1000000)))GROUP BY s.session_id@@ -3121,13 +3121,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageleave'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageleave'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -3177,7 +3177,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -3227,7 +3227,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%gmail.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%gmail.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))LIMIT 1000000)))GROUP BY s.session_id@@ -3276,13 +3276,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'new-event2'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'new-event2'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -3332,13 +3332,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), or(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'new-event2'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'new-event2'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -3388,13 +3388,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), if(isNull(nullIf(toString(events.properties.foo), '')), NULL, if(and(in(ascii(toString(events.properties.foo)), tuple(91, 123)), in(ascii(toJSONString(events.properties.foo)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.foo), '[]'), '{}'), toString(events.properties.foo)))), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), if(isNull(nullIf(toString(events.properties.foo), '')), NULL, if(and(in(ascii(toString(events.properties.foo)), tuple(91, 123)), in(ascii(toJSONString(events.properties.foo)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.foo), '[]'), '{}'), toString(events.properties.foo)))), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^bar)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^bar)), if(isNull(nullIf(toString(events.properties.bar), '')), NULL, if(and(in(ascii(toString(events.properties.bar)), tuple(91, 123)), in(ascii(toJSONString(events.properties.bar)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.bar), '[]'), '{}'), toString(events.properties.bar)))), 'foo'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^bar)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^bar)), if(isNull(nullIf(toString(events.properties.bar), '')), NULL, if(and(in(ascii(toString(events.properties.bar)), tuple(91, 123)), in(ascii(toJSONString(events.properties.bar)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.bar), '[]'), '{}'), toString(events.properties.bar)))), 'foo'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -3444,13 +3444,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), if(isNull(nullIf(toString(events.properties.foo), '')), NULL, if(and(in(ascii(toString(events.properties.foo)), tuple(91, 123)), in(ascii(toJSONString(events.properties.foo)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.foo), '[]'), '{}'), toString(events.properties.foo)))), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), if(isNull(nullIf(toString(events.properties.foo), '')), NULL, if(and(in(ascii(toString(events.properties.foo)), tuple(91, 123)), in(ascii(toJSONString(events.properties.foo)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.foo), '[]'), '{}'), toString(events.properties.foo)))), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'new-event'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), if(isNull(nullIf(toString(events.properties.foo), '')), NULL, if(and(in(ascii(toString(events.properties.foo)), tuple(91, 123)), in(ascii(toJSONString(events.properties.foo)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.foo), '[]'), '{}'), toString(events.properties.foo)))), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'new-event'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), if(isNull(nullIf(toString(events.properties.foo), '')), NULL, if(and(in(ascii(toString(events.properties.foo)), tuple(91, 123)), in(ascii(toJSONString(events.properties.foo)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.foo), '[]'), '{}'), toString(events.properties.foo)))), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -3500,13 +3500,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), or(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), if(isNull(nullIf(toString(events.properties.foo), '')), NULL, if(and(in(ascii(toString(events.properties.foo)), tuple(91, 123)), in(ascii(toJSONString(events.properties.foo)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.foo), '[]'), '{}'), toString(events.properties.foo)))), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), if(isNull(nullIf(toString(events.properties.foo), '')), NULL, if(and(in(ascii(toString(events.properties.foo)), tuple(91, 123)), in(ascii(toJSONString(events.properties.foo)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.foo), '[]'), '{}'), toString(events.properties.foo)))), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'new-event'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), if(isNull(nullIf(toString(events.properties.foo), '')), NULL, if(and(in(ascii(toString(events.properties.foo)), tuple(91, 123)), in(ascii(toJSONString(events.properties.foo)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.foo), '[]'), '{}'), toString(events.properties.foo)))), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'new-event'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), if(isNull(nullIf(toString(events.properties.foo), '')), NULL, if(and(in(ascii(toString(events.properties.foo)), tuple(91, 123)), in(ascii(toJSONString(events.properties.foo)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.foo), '[]'), '{}'), toString(events.properties.foo)))), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -3556,13 +3556,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'new-event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'new-event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -3612,13 +3612,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), or(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'custom_event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'custom_event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -3668,13 +3668,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'custom_event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'custom_event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -3733,7 +3733,7 @@WHERE and(equals(events.team_id, 99999), equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), '00000000-0000-0000-0000-000000000000'), lessOrEquals(events.timestamp, toDateTime64(toDateTime64('today', 6, 'UTC'), 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('today', 6, 'UTC')), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))))))), greaterOrEquals(s.min_first_timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -3783,7 +3783,7 @@WHERE and(equals(s.team_id, 99999), in(s.session_id, ['session_id_one']), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')), in(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), ['session_id_one']))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')), in(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), ['session_id_one']))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -3833,7 +3833,7 @@WHERE and(equals(s.team_id, 99999), in(s.session_id, ['session_id_two']), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')), in(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), ['session_id_two']))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')), in(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), ['session_id_two']))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -3892,7 +3892,7 @@WHERE and(equals(events.team_id, 99999), equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), '00000000-0000-0000-0000-000000000000'), lessOrEquals(events.timestamp, toDateTime64(toDateTime64('today', 6, 'UTC'), 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('today', 6, 'UTC')), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))))))), greaterOrEquals(s.min_first_timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -3942,13 +3942,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), or(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -3998,13 +3998,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -4160,13 +4160,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalNotIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(match(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$host`)), '{}'), JSONStripEmptyStringsAndNulls(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)($|:)'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(match(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$host`)), '{}'), JSONStripEmptyStringsAndNulls(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)($|:)'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))LIMIT 1000000)))GROUP BY s.session_id@@ -4215,7 +4215,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -4265,7 +4265,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), if(isNull(nullIf(toString(events.properties.is_internal_user), '')), NULL, if(and(in(ascii(toString(events.properties.is_internal_user)), tuple(91, 123)), in(ascii(toJSONString(events.properties.is_internal_user)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.is_internal_user), '[]'), '{}'), toString(events.properties.is_internal_user)))), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), if(isNull(nullIf(toString(events.properties.is_internal_user), '')), NULL, if(and(in(ascii(toString(events.properties.is_internal_user)), tuple(91, 123)), in(ascii(toJSONString(events.properties.is_internal_user)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.is_internal_user), '[]'), '{}'), toString(events.properties.is_internal_user)))), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -4315,7 +4315,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -4365,7 +4365,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), if(isNull(nullIf(toString(events.properties.is_internal_user), '')), NULL, if(and(in(ascii(toString(events.properties.is_internal_user)), tuple(91, 123)), in(ascii(toJSONString(events.properties.is_internal_user)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.is_internal_user), '[]'), '{}'), toString(events.properties.is_internal_user)))), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), if(isNull(nullIf(toString(events.properties.is_internal_user), '')), NULL, if(and(in(ascii(toString(events.properties.is_internal_user)), tuple(91, 123)), in(ascii(toJSONString(events.properties.is_internal_user)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.is_internal_user), '[]'), '{}'), toString(events.properties.is_internal_user)))), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -4415,7 +4415,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -4465,7 +4465,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), if(isNull(nullIf(toString(events.properties.is_internal_user), '')), NULL, if(and(in(ascii(toString(events.properties.is_internal_user)), tuple(91, 123)), in(ascii(toJSONString(events.properties.is_internal_user)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.is_internal_user), '[]'), '{}'), toString(events.properties.is_internal_user)))), 'true'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), if(isNull(nullIf(toString(events.properties.is_internal_user), '')), NULL, if(and(in(ascii(toString(events.properties.is_internal_user)), tuple(91, 123)), in(ascii(toJSONString(events.properties.is_internal_user)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.is_internal_user), '[]'), '{}'), toString(events.properties.is_internal_user)))), 'true'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -4515,7 +4515,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -4565,7 +4565,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -4615,7 +4615,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -4665,7 +4665,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -4715,7 +4715,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -4765,7 +4765,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2023-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2023-01-04 00:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'custom-event'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'test_action_filter-session-one'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), if(isNull(nullIf(toString(events.properties.`$window_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$window_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$window_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$window_id`), '[]'), '{}'), toString(events.properties.`$window_id`)))), 'test_action_filter-window-id'), 0))), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'custom-event'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'test_action_filter-session-one'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), if(isNull(nullIf(toString(events.properties.`$window_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$window_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$window_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$window_id`), '[]'), '{}'), toString(events.properties.`$window_id`)))), 'test_action_filter-window-id'), 0))), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -4815,7 +4815,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2023-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2023-01-04 00:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(and(equals(events.event, 'custom-event'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'test_action_filter-session-one'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), if(isNull(nullIf(toString(events.properties.`$window_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$window_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$window_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$window_id`), '[]'), '{}'), toString(events.properties.`$window_id`)))), 'test_action_filter-window-id'), 0))), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(and(equals(events.event, 'custom-event'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'test_action_filter-session-one'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), if(isNull(nullIf(toString(events.properties.`$window_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$window_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$window_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$window_id`), '[]'), '{}'), toString(events.properties.`$window_id`)))), 'test_action_filter-window-id'), 0))), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -4865,7 +4865,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2023-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2023-01-04 00:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(and(equals(events.event, 'custom-event'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'test_action_filter-session-one'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), if(isNull(nullIf(toString(events.properties.`$window_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$window_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$window_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$window_id`), '[]'), '{}'), toString(events.properties.`$window_id`)))), 'test_action_filter-window-id'), 0))), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(and(equals(events.event, 'custom-event'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'test_action_filter-session-one'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), if(isNull(nullIf(toString(events.properties.`$window_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$window_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$window_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$window_id`), '[]'), '{}'), toString(events.properties.`$window_id`)))), 'test_action_filter-window-id'), 0))), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -4915,7 +4915,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2023-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2023-01-04 00:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'custom-event'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Firefox'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'test_action_filter-session-one'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), if(isNull(nullIf(toString(events.properties.`$window_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$window_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$window_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$window_id`), '[]'), '{}'), toString(events.properties.`$window_id`)))), 'test_action_filter-window-id'), 0))), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'custom-event'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Firefox'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'test_action_filter-session-one'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$window_id`)), if(isNull(nullIf(toString(events.properties.`$window_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$window_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$window_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$window_id`), '[]'), '{}'), toString(events.properties.`$window_id`)))), 'test_action_filter-window-id'), 0))), greaterOrEquals(events.timestamp, toDateTime64('2022-12-31 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -4974,13 +4974,13 @@WHERE and(equals(events.team_id, 99999), equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), '00000000-0000-0000-0000-000000000000'), lessOrEquals(events.timestamp, toDateTime64(toDateTime64('today', 6, 'UTC'), 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))))))), greaterOrEquals(s.min_first_timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), and(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'custom-event'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'custom-event'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -5030,7 +5030,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2021-01-21 20:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -5080,7 +5080,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2021-01-21 20:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Firefox'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Firefox'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -5130,7 +5130,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2021-01-21 20:00:00.000000', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -5180,7 +5180,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$autocapture'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$autocapture'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -5230,7 +5230,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -5280,7 +5280,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -5330,7 +5330,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -5380,7 +5380,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -5435,7 +5435,7 @@FROM groupsWHERE and(equals(groups.team_id, 99999), equals(index, 1))GROUP BY groups.group_type_index, groups.group_key) AS events__group_1 ON equals(events.properties.`$group_1`, events__group_1.key)- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__group_1.properties___name, 'org one'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__group_1.properties___name, 'org one'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -5490,7 +5490,7 @@FROM groupsWHERE and(equals(groups.team_id, 99999), equals(index, 2))GROUP BY groups.group_type_index, groups.group_key) AS events__group_2 ON equals(events.properties.`$group_2`, events__group_2.key)- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__group_2.properties___name, 'org one'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__group_2.properties___name, 'org one'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -5545,7 +5545,7 @@FROM groupsWHERE and(equals(groups.team_id, 99999), equals(index, 1))GROUP BY groups.group_type_index, groups.group_key) AS events__group_1 ON equals(events.properties.`$group_1`, events__group_1.key)- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(events__group_1.properties___name, 'org one'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(events__group_1.properties___name, 'org one'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -5595,13 +5595,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -5651,13 +5651,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -5707,7 +5707,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -5757,7 +5757,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'something else'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'something else'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -5807,7 +5807,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -5857,7 +5857,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -5907,7 +5907,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -5957,7 +5957,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$autocapture'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$autocapture'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -6007,7 +6007,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -6057,7 +6057,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Firefox'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -6107,7 +6107,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'a_different_event'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'a_different_event'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -6157,7 +6157,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'a_different_event'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Safari'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'a_different_event'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Safari'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -6207,7 +6207,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -6257,7 +6257,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -6307,25 +6307,25 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), if(isNull(nullIf(toString(events.properties.is_internal_user), '')), NULL, if(and(in(ascii(toString(events.properties.is_internal_user)), tuple(91, 123)), in(ascii(toJSONString(events.properties.is_internal_user)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.is_internal_user), '[]'), '{}'), toString(events.properties.is_internal_user)))), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), if(isNull(nullIf(toString(events.properties.is_internal_user), '')), NULL, if(and(in(ascii(toString(events.properties.is_internal_user)), tuple(91, 123)), in(ascii(toJSONString(events.properties.is_internal_user)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.is_internal_user), '[]'), '{}'), toString(events.properties.is_internal_user)))), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING equals(countIf(ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 0)), 0)LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), 'Chrome'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING equals(countIf(ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 0)), 0)LIMIT 1000000)), globalNotIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))LIMIT 1000000)))GROUP BY s.session_id@@ -6374,13 +6374,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageleave'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageleave'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -6430,7 +6430,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -6480,7 +6480,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%gmail.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%gmail.com%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))LIMIT 1000000)))GROUP BY s.session_id@@ -6529,13 +6529,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'new-event2'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'new-event2'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -6585,13 +6585,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), or(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'new-event2'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'new-event2'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -6641,13 +6641,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), if(isNull(nullIf(toString(events.properties.foo), '')), NULL, if(and(in(ascii(toString(events.properties.foo)), tuple(91, 123)), in(ascii(toJSONString(events.properties.foo)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.foo), '[]'), '{}'), toString(events.properties.foo)))), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), if(isNull(nullIf(toString(events.properties.foo), '')), NULL, if(and(in(ascii(toString(events.properties.foo)), tuple(91, 123)), in(ascii(toJSONString(events.properties.foo)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.foo), '[]'), '{}'), toString(events.properties.foo)))), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^bar)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^bar)), if(isNull(nullIf(toString(events.properties.bar), '')), NULL, if(and(in(ascii(toString(events.properties.bar)), tuple(91, 123)), in(ascii(toJSONString(events.properties.bar)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.bar), '[]'), '{}'), toString(events.properties.bar)))), 'foo'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^bar)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^bar)), if(isNull(nullIf(toString(events.properties.bar), '')), NULL, if(and(in(ascii(toString(events.properties.bar)), tuple(91, 123)), in(ascii(toJSONString(events.properties.bar)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.bar), '[]'), '{}'), toString(events.properties.bar)))), 'foo'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -6697,13 +6697,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), if(isNull(nullIf(toString(events.properties.foo), '')), NULL, if(and(in(ascii(toString(events.properties.foo)), tuple(91, 123)), in(ascii(toJSONString(events.properties.foo)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.foo), '[]'), '{}'), toString(events.properties.foo)))), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), if(isNull(nullIf(toString(events.properties.foo), '')), NULL, if(and(in(ascii(toString(events.properties.foo)), tuple(91, 123)), in(ascii(toJSONString(events.properties.foo)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.foo), '[]'), '{}'), toString(events.properties.foo)))), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'new-event'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), if(isNull(nullIf(toString(events.properties.foo), '')), NULL, if(and(in(ascii(toString(events.properties.foo)), tuple(91, 123)), in(ascii(toJSONString(events.properties.foo)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.foo), '[]'), '{}'), toString(events.properties.foo)))), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'new-event'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), if(isNull(nullIf(toString(events.properties.foo), '')), NULL, if(and(in(ascii(toString(events.properties.foo)), tuple(91, 123)), in(ascii(toJSONString(events.properties.foo)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.foo), '[]'), '{}'), toString(events.properties.foo)))), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -6753,13 +6753,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), or(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), if(isNull(nullIf(toString(events.properties.foo), '')), NULL, if(and(in(ascii(toString(events.properties.foo)), tuple(91, 123)), in(ascii(toJSONString(events.properties.foo)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.foo), '[]'), '{}'), toString(events.properties.foo)))), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), if(isNull(nullIf(toString(events.properties.foo), '')), NULL, if(and(in(ascii(toString(events.properties.foo)), tuple(91, 123)), in(ascii(toJSONString(events.properties.foo)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.foo), '[]'), '{}'), toString(events.properties.foo)))), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, 'new-event'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), if(isNull(nullIf(toString(events.properties.foo), '')), NULL, if(and(in(ascii(toString(events.properties.foo)), tuple(91, 123)), in(ascii(toJSONString(events.properties.foo)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.foo), '[]'), '{}'), toString(events.properties.foo)))), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, 'new-event'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^foo)), if(isNull(nullIf(toString(events.properties.foo), '')), NULL, if(and(in(ascii(toString(events.properties.foo)), tuple(91, 123)), in(ascii(toJSONString(events.properties.foo)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.foo), '[]'), '{}'), toString(events.properties.foo)))), 'bar'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -6809,13 +6809,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'new-event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'new-event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -6865,13 +6865,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), or(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'custom_event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'custom_event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -6921,13 +6921,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'custom_event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'custom_event'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -6986,7 +6986,7 @@WHERE and(equals(events.team_id, 99999), equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), '00000000-0000-0000-0000-000000000000'), lessOrEquals(events.timestamp, toDateTime64(toDateTime64('today', 6, 'UTC'), 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('today', 6, 'UTC')), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))))))), greaterOrEquals(s.min_first_timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -7036,7 +7036,7 @@WHERE and(equals(s.team_id, 99999), in(s.session_id, ['session_id_one']), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')), in(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), ['session_id_one']))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')), in(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), ['session_id_one']))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -7086,7 +7086,7 @@WHERE and(equals(s.team_id, 99999), in(s.session_id, ['session_id_two']), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')), in(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), ['session_id_two']))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')), in(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))), ['session_id_two']))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -7145,7 +7145,7 @@WHERE and(equals(events.team_id, 99999), equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), '00000000-0000-0000-0000-000000000000'), lessOrEquals(events.timestamp, toDateTime64(toDateTime64('today', 6, 'UTC'), 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('today', 6, 'UTC')), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`)))))))), greaterOrEquals(s.min_first_timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -7195,13 +7195,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), or(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -7251,13 +7251,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), '[email protected]'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -7413,13 +7413,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalNotIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(match(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$host`)), '{}'), JSONStripEmptyStringsAndNulls(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)($|:)'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(match(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$host`)), '{}'), JSONStripEmptyStringsAndNulls(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)($|:)'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))LIMIT 1000000)))GROUP BY s.session_id@@ -7468,7 +7468,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -7518,7 +7518,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), if(isNull(nullIf(toString(events.properties.is_internal_user), '')), NULL, if(and(in(ascii(toString(events.properties.is_internal_user)), tuple(91, 123)), in(ascii(toJSONString(events.properties.is_internal_user)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.is_internal_user), '[]'), '{}'), toString(events.properties.is_internal_user)))), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), if(isNull(nullIf(toString(events.properties.is_internal_user), '')), NULL, if(and(in(ascii(toString(events.properties.is_internal_user)), tuple(91, 123)), in(ascii(toJSONString(events.properties.is_internal_user)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.is_internal_user), '[]'), '{}'), toString(events.properties.is_internal_user)))), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -7568,7 +7568,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -7618,7 +7618,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), if(isNull(nullIf(toString(events.properties.is_internal_user), '')), NULL, if(and(in(ascii(toString(events.properties.is_internal_user)), tuple(91, 123)), in(ascii(toJSONString(events.properties.is_internal_user)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.is_internal_user), '[]'), '{}'), toString(events.properties.is_internal_user)))), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), if(isNull(nullIf(toString(events.properties.is_internal_user), '')), NULL, if(and(in(ascii(toString(events.properties.is_internal_user)), tuple(91, 123)), in(ascii(toJSONString(events.properties.is_internal_user)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.is_internal_user), '[]'), '{}'), toString(events.properties.is_internal_user)))), 'false'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -7668,7 +7668,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -7718,7 +7718,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), if(isNull(nullIf(toString(events.properties.is_internal_user), '')), NULL, if(and(in(ascii(toString(events.properties.is_internal_user)), tuple(91, 123)), in(ascii(toJSONString(events.properties.is_internal_user)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.is_internal_user), '[]'), '{}'), toString(events.properties.is_internal_user)))), 'true'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^is_internal_user)), if(isNull(nullIf(toString(events.properties.is_internal_user), '')), NULL, if(and(in(ascii(toString(events.properties.is_internal_user)), tuple(91, 123)), in(ascii(toJSONString(events.properties.is_internal_user)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.is_internal_user), '[]'), '{}'), toString(events.properties.is_internal_user)))), 'true'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -7768,7 +7768,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -7818,7 +7818,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -7868,7 +7868,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -7918,7 +7918,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), 'bla'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -7968,7 +7968,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-01-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))diff --git a/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_operands_queries.ambr b/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_operands_queries.ambrindex a580ba2997ed..69c37f5715fd 100644--- a/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_operands_queries.ambr+++ b/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_operands_queries.ambr@@ -26,13 +26,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'vip'), ''), 'null'), '^"|"$', ''), 'true'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'vip'), ''), 'null'), '^"|"$', ''), 'true'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$pathname'), ''), 'null'), '^"|"$', '')), '%target%'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$pathname'), ''), 'null'), '^"|"$', '')), '%target%'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -81,13 +81,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), or(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'vip'), ''), 'null'), '^"|"$', ''), 'true'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'vip'), ''), 'null'), '^"|"$', ''), 'true'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$pathname'), ''), 'null'), '^"|"$', '')), '%target%'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$pathname'), ''), 'null'), '^"|"$', '')), '%target%'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -136,18 +136,18 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$pathname'), ''), 'null'), '^"|"$', '')), '%target%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$pathname'), ''), 'null'), '^"|"$', '')), '%target%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')LIMIT 1000000)), and(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'vip'), ''), 'null'), '^"|"$', ''), 'true'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'vip'), ''), 'null'), '^"|"$', ''), 'true'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING equals(countIf(ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$pathname'), ''), 'null'), '^"|"$', '')), '%target%'), 0)), 0)LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$pathname'), ''), 'null'), '^"|"$', '')), '%target%'), 1)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$pathname'), ''), 'null'), '^"|"$', '')), '%target%'), 1)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING equals(countIf(ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$pathname'), ''), 'null'), '^"|"$', '')), '%target%'), 0)), 0)LIMIT 1000000))))@@ -196,13 +196,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), or(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(notEquals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'vip'), ''), 'null'), '^"|"$', ''), 'true'), 1)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(notEquals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'vip'), ''), 'null'), '^"|"$', ''), 'true'), 1)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$pathname'), ''), 'null'), '^"|"$', '')), '%target%'), 1)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$pathname'), ''), 'null'), '^"|"$', '')), '%target%'), 1)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000))))@@ -251,18 +251,18 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), or(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'vip'), ''), 'null'), '^"|"$', ''), 'true'), 0), ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$pathname'), ''), 'null'), '^"|"$', '')), '%target%'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), or(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'vip'), ''), 'null'), '^"|"$', ''), 'true'), 0), ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$pathname'), ''), 'null'), '^"|"$', '')), '%target%'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')LIMIT 1000000)), and(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(notEquals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'vip'), ''), 'null'), '^"|"$', ''), 'true'), 1)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(notEquals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'vip'), ''), 'null'), '^"|"$', ''), 'true'), 1)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING and(equals(countIf(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'vip'), ''), 'null'), '^"|"$', ''), 'true'), 0)), 0), equals(countIf(ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$pathname'), ''), 'null'), '^"|"$', '')), '%target%'), 0)), 0))LIMIT 1000000)), globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$pathname'), ''), 'null'), '^"|"$', '')), '%target%'), 1)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$pathname'), ''), 'null'), '^"|"$', '')), '%target%'), 1)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING and(equals(countIf(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'vip'), ''), 'null'), '^"|"$', ''), 'true'), 0)), 0), equals(countIf(ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$pathname'), ''), 'null'), '^"|"$', '')), '%target%'), 0)), 0))LIMIT 1000000))))diff --git a/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_operands_queries.new_events_schema.ambr b/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_operands_queries.new_events_schema.ambrindex b71fe006b368..6aad2575eace 100644--- a/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_operands_queries.new_events_schema.ambr+++ b/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recording_list_operands_queries.new_events_schema.ambr@@ -26,13 +26,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), and(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), if(isNull(nullIf(toString(events.properties.vip), '')), NULL, if(and(in(ascii(toString(events.properties.vip)), tuple(91, 123)), in(ascii(toJSONString(events.properties.vip)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.vip), '[]'), '{}'), toString(events.properties.vip)))), 'true'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), if(isNull(nullIf(toString(events.properties.vip), '')), NULL, if(and(in(ascii(toString(events.properties.vip)), tuple(91, 123)), in(ascii(toJSONString(events.properties.vip)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.vip), '[]'), '{}'), toString(events.properties.vip)))), 'true'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), if(isNull(nullIf(toString(events.properties.`$pathname`), '')), NULL, if(and(in(ascii(toString(events.properties.`$pathname`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$pathname`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$pathname`), '[]'), '{}'), toString(events.properties.`$pathname`))))), '%target%'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), if(isNull(nullIf(toString(events.properties.`$pathname`), '')), NULL, if(and(in(ascii(toString(events.properties.`$pathname`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$pathname`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$pathname`), '[]'), '{}'), toString(events.properties.`$pathname`))))), '%target%'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -82,13 +82,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), or(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), if(isNull(nullIf(toString(events.properties.vip), '')), NULL, if(and(in(ascii(toString(events.properties.vip)), tuple(91, 123)), in(ascii(toJSONString(events.properties.vip)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.vip), '[]'), '{}'), toString(events.properties.vip)))), 'true'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), if(isNull(nullIf(toString(events.properties.vip), '')), NULL, if(and(in(ascii(toString(events.properties.vip)), tuple(91, 123)), in(ascii(toJSONString(events.properties.vip)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.vip), '[]'), '{}'), toString(events.properties.vip)))), 'true'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), if(isNull(nullIf(toString(events.properties.`$pathname`), '')), NULL, if(and(in(ascii(toString(events.properties.`$pathname`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$pathname`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$pathname`), '[]'), '{}'), toString(events.properties.`$pathname`))))), '%target%'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), if(isNull(nullIf(toString(events.properties.`$pathname`), '')), NULL, if(and(in(ascii(toString(events.properties.`$pathname`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$pathname`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$pathname`), '[]'), '{}'), toString(events.properties.`$pathname`))))), '%target%'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -138,18 +138,18 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), if(isNull(nullIf(toString(events.properties.`$pathname`), '')), NULL, if(and(in(ascii(toString(events.properties.`$pathname`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$pathname`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$pathname`), '[]'), '{}'), toString(events.properties.`$pathname`))))), '%target%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), if(isNull(nullIf(toString(events.properties.`$pathname`), '')), NULL, if(and(in(ascii(toString(events.properties.`$pathname`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$pathname`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$pathname`), '[]'), '{}'), toString(events.properties.`$pathname`))))), '%target%'), 0), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))LIMIT 1000000)), and(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), if(isNull(nullIf(toString(events.properties.vip), '')), NULL, if(and(in(ascii(toString(events.properties.vip)), tuple(91, 123)), in(ascii(toJSONString(events.properties.vip)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.vip), '[]'), '{}'), toString(events.properties.vip)))), 'true'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), if(isNull(nullIf(toString(events.properties.vip), '')), NULL, if(and(in(ascii(toString(events.properties.vip)), tuple(91, 123)), in(ascii(toJSONString(events.properties.vip)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.vip), '[]'), '{}'), toString(events.properties.vip)))), 'true'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING equals(countIf(ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), if(isNull(nullIf(toString(events.properties.`$pathname`), '')), NULL, if(and(in(ascii(toString(events.properties.`$pathname`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$pathname`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$pathname`), '[]'), '{}'), toString(events.properties.`$pathname`))))), '%target%'), 0)), 0)LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), if(isNull(nullIf(toString(events.properties.`$pathname`), '')), NULL, if(and(in(ascii(toString(events.properties.`$pathname`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$pathname`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$pathname`), '[]'), '{}'), toString(events.properties.`$pathname`))))), '%target%'), 1)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), if(isNull(nullIf(toString(events.properties.`$pathname`), '')), NULL, if(and(in(ascii(toString(events.properties.`$pathname`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$pathname`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$pathname`), '[]'), '{}'), toString(events.properties.`$pathname`))))), '%target%'), 1)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING equals(countIf(ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), if(isNull(nullIf(toString(events.properties.`$pathname`), '')), NULL, if(and(in(ascii(toString(events.properties.`$pathname`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$pathname`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$pathname`), '[]'), '{}'), toString(events.properties.`$pathname`))))), '%target%'), 0)), 0)LIMIT 1000000))))@@ -199,13 +199,13 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), or(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(notEquals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), if(isNull(nullIf(toString(events.properties.vip), '')), NULL, if(and(in(ascii(toString(events.properties.vip)), tuple(91, 123)), in(ascii(toJSONString(events.properties.vip)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.vip), '[]'), '{}'), toString(events.properties.vip)))), 'true'), 1)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(notEquals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), if(isNull(nullIf(toString(events.properties.vip), '')), NULL, if(and(in(ascii(toString(events.properties.vip)), tuple(91, 123)), in(ascii(toJSONString(events.properties.vip)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.vip), '[]'), '{}'), toString(events.properties.vip)))), 'true'), 1)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), if(isNull(nullIf(toString(events.properties.`$pathname`), '')), NULL, if(and(in(ascii(toString(events.properties.`$pathname`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$pathname`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$pathname`), '[]'), '{}'), toString(events.properties.`$pathname`))))), '%target%'), 1)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), if(isNull(nullIf(toString(events.properties.`$pathname`), '')), NULL, if(and(in(ascii(toString(events.properties.`$pathname`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$pathname`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$pathname`), '[]'), '{}'), toString(events.properties.`$pathname`))))), '%target%'), 1)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000))))@@ -255,18 +255,18 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2020-12-29 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('today', 6, 'UTC')), globalNotIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), or(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), if(isNull(nullIf(toString(events.properties.vip), '')), NULL, if(and(in(ascii(toString(events.properties.vip)), tuple(91, 123)), in(ascii(toJSONString(events.properties.vip)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.vip), '[]'), '{}'), toString(events.properties.vip)))), 'true'), 0), ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), if(isNull(nullIf(toString(events.properties.`$pathname`), '')), NULL, if(and(in(ascii(toString(events.properties.`$pathname`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$pathname`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$pathname`), '[]'), '{}'), toString(events.properties.`$pathname`))))), '%target%'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), or(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), if(isNull(nullIf(toString(events.properties.vip), '')), NULL, if(and(in(ascii(toString(events.properties.vip)), tuple(91, 123)), in(ascii(toJSONString(events.properties.vip)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.vip), '[]'), '{}'), toString(events.properties.vip)))), 'true'), 0), ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), if(isNull(nullIf(toString(events.properties.`$pathname`), '')), NULL, if(and(in(ascii(toString(events.properties.`$pathname`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$pathname`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$pathname`), '[]'), '{}'), toString(events.properties.`$pathname`))))), '%target%'), 0)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))LIMIT 1000000)), and(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(notEquals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), if(isNull(nullIf(toString(events.properties.vip), '')), NULL, if(and(in(ascii(toString(events.properties.vip)), tuple(91, 123)), in(ascii(toJSONString(events.properties.vip)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.vip), '[]'), '{}'), toString(events.properties.vip)))), 'true'), 1)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(notEquals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), if(isNull(nullIf(toString(events.properties.vip), '')), NULL, if(and(in(ascii(toString(events.properties.vip)), tuple(91, 123)), in(ascii(toJSONString(events.properties.vip)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.vip), '[]'), '{}'), toString(events.properties.vip)))), 'true'), 1)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING and(equals(countIf(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), if(isNull(nullIf(toString(events.properties.vip), '')), NULL, if(and(in(ascii(toString(events.properties.vip)), tuple(91, 123)), in(ascii(toJSONString(events.properties.vip)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.vip), '[]'), '{}'), toString(events.properties.vip)))), 'true'), 0)), 0), equals(countIf(ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), if(isNull(nullIf(toString(events.properties.`$pathname`), '')), NULL, if(and(in(ascii(toString(events.properties.`$pathname`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$pathname`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$pathname`), '[]'), '{}'), toString(events.properties.`$pathname`))))), '%target%'), 0)), 0))LIMIT 1000000)), globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), if(isNull(nullIf(toString(events.properties.`$pathname`), '')), NULL, if(and(in(ascii(toString(events.properties.`$pathname`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$pathname`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$pathname`), '[]'), '{}'), toString(events.properties.`$pathname`))))), '%target%'), 1)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), and(equals(events.event, '$pageview'), ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), if(isNull(nullIf(toString(events.properties.`$pathname`), '')), NULL, if(and(in(ascii(toString(events.properties.`$pathname`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$pathname`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$pathname`), '[]'), '{}'), toString(events.properties.`$pathname`))))), '%target%'), 1)), greaterOrEquals(events.timestamp, toDateTime64('2020-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING and(equals(countIf(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^vip)), if(isNull(nullIf(toString(events.properties.vip), '')), NULL, if(and(in(ascii(toString(events.properties.vip)), tuple(91, 123)), in(ascii(toJSONString(events.properties.vip)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.vip), '[]'), '{}'), toString(events.properties.vip)))), 'true'), 0)), 0), equals(countIf(ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$pathname`)), if(isNull(nullIf(toString(events.properties.`$pathname`), '')), NULL, if(and(in(ascii(toString(events.properties.`$pathname`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$pathname`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$pathname`), '[]'), '{}'), toString(events.properties.`$pathname`))))), '%target%'), 0)), 0))LIMIT 1000000))))diff --git a/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recordings_list_by_cohort.ambr b/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recordings_list_by_cohort.ambrindex abcb956c7d7c..5b121997ebc1 100644--- a/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recordings_list_by_cohort.ambr+++ b/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recordings_list_by_cohort.ambr@@ -414,7 +414,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-08-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2021-08-21 20:00:00.000000', 6, 'UTC')), and(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-08-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-08-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), in(s.distinct_id,@@ -475,7 +475,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-08-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2021-08-21 20:00:00.000000', 6, 'UTC')), and(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'custom_event'), greaterOrEquals(events.timestamp, toDateTime64('2021-08-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'custom_event'), greaterOrEquals(events.timestamp, toDateTime64('2021-08-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), in(s.distinct_id,@@ -1048,7 +1048,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-08-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2021-08-21 20:00:00.000000', 6, 'UTC')), and(globalIn(s.session_id,(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_idFROM events- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'plan'), ''), 'null'), '^"|"$', ''), 'premium'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-08-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'plan'), ''), 'null'), '^"|"$', ''), 'premium'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-08-17 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)), in(s.distinct_id,@@ -1125,19 +1125,19 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), in(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id),- (SELECT persons.id AS id- FROM- (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'user_group'), ''), 'null'), '^"|"$', '')), person.version), 1) AS properties___user_group, person.id AS id- FROM person- WHERE and(equals(person.team_id, 99999), in(id,- (SELECT where_optimization.id AS id- FROM person AS where_optimization- WHERE and(equals(where_optimization.team_id, 99999), and(multiSearchAny(where_optimization.properties, ['internal']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(where_optimization.properties, 'user_group'), ''), 'null'), '^"|"$', ''), 'internal'), 0))))))- GROUP BY person.id- HAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))))) AS persons- WHERE ifNull(equals(persons.properties___user_group, 'internal'), 0)- ORDER BY persons.id ASC SETTINGS optimize_aggregation_in_order=1, join_algorithm='auto')), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), in(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id),+ (SELECT persons.id AS id+ FROM+ (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'user_group'), ''), 'null'), '^"|"$', '')), person.version), 1) AS properties___user_group, person.id AS id+ FROM person+ WHERE and(equals(person.team_id, 99999), in(id,+ (SELECT where_optimization.id AS id+ FROM person AS where_optimization+ WHERE and(equals(where_optimization.team_id, 99999), and(multiSearchAny(where_optimization.properties, ['internal']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(where_optimization.properties, 'user_group'), ''), 'null'), '^"|"$', ''), 'internal'), 0))))))+ GROUP BY person.id+ HAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))))) AS persons+ WHERE ifNull(equals(persons.properties___user_group, 'internal'), 0)+ ORDER BY persons.id ASC SETTINGS optimize_aggregation_in_order=1, join_algorithm='auto')), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')LIMIT 1000000)))GROUP BY s.session_iddiff --git a/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recordings_list_by_cohort.new_events_schema.ambr b/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recordings_list_by_cohort.new_events_schema.ambrindex c89467a4569b..0e8b83e97c9f 100644--- a/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recordings_list_by_cohort.new_events_schema.ambr+++ b/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recordings_list_by_cohort.new_events_schema.ambr@@ -26,7 +26,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-08-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2021-08-21 20:00:00.000000', 6, 'UTC')), and(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, 'custom_event'), greaterOrEquals(events.timestamp, toDateTime64('2021-08-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, 'custom_event'), greaterOrEquals(events.timestamp, toDateTime64('2021-08-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), in(s.distinct_id,@@ -88,7 +88,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-08-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2021-08-21 20:00:00.000000', 6, 'UTC')), and(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-08-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('2021-08-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), in(s.distinct_id,@@ -150,7 +150,7 @@WHERE and(equals(s.team_id, 99999), greaterOrEquals(s.min_first_timestamp, toDateTime64('2021-08-18 00:00:00.000000', 6, 'UTC')), lessOrEquals(s.min_first_timestamp, toDateTime64('2021-08-21 20:00:00.000000', 6, 'UTC')), and(globalIn(s.session_id,(SELECT if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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_idFROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^plan)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^plan)), if(isNull(nullIf(toString(events.person_properties.plan), '')), NULL, if(and(in(ascii(toString(events.person_properties.plan)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.plan)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.plan), '[]'), '{}'), toString(events.person_properties.plan)))), 'premium'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-08-17 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^plan)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^plan)), if(isNull(nullIf(toString(events.person_properties.plan), '')), NULL, if(and(in(ascii(toString(events.person_properties.plan)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.plan)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.plan), '[]'), '{}'), toString(events.person_properties.plan)))), 'premium'), 0), greaterOrEquals(events.timestamp, toDateTime64('2021-08-17 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)), in(s.distinct_id,@@ -218,19 +218,19 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), in(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id),- (SELECT persons.id AS id- FROM- (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'user_group'), ''), 'null'), '^"|"$', '')), person.version), 1) AS properties___user_group, person.id AS id- FROM person- WHERE and(equals(person.team_id, 99999), in(id,- (SELECT where_optimization.id AS id- FROM person AS where_optimization- WHERE and(equals(where_optimization.team_id, 99999), and(multiSearchAny(where_optimization.properties, ['internal']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(where_optimization.properties, 'user_group'), ''), 'null'), '^"|"$', ''), 'internal'), 0))))))- GROUP BY person.id- HAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))))) AS persons- WHERE ifNull(equals(persons.properties___user_group, 'internal'), 0)- ORDER BY persons.id ASC SETTINGS optimize_aggregation_in_order=1, join_algorithm='auto')), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), in(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id),+ (SELECT persons.id AS id+ FROM+ (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'user_group'), ''), 'null'), '^"|"$', '')), person.version), 1) AS properties___user_group, person.id AS id+ FROM person+ WHERE and(equals(person.team_id, 99999), in(id,+ (SELECT where_optimization.id AS id+ FROM person AS where_optimization+ WHERE and(equals(where_optimization.team_id, 99999), and(multiSearchAny(where_optimization.properties, ['internal']), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(where_optimization.properties, 'user_group'), ''), 'null'), '^"|"$', ''), 'internal'), 0))))))+ GROUP BY person.id+ HAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))))) AS persons+ WHERE ifNull(equals(persons.properties___user_group, 'internal'), 0)+ ORDER BY persons.id ASC SETTINGS optimize_aggregation_in_order=1, join_algorithm='auto')), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))LIMIT 1000000)))GROUP BY s.session_iddiff --git a/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recordings_list_by_group_properties.ambr b/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recordings_list_by_group_properties.ambrindex 42424fcd2f47..02495919a7dd 100644--- a/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recordings_list_by_group_properties.ambr+++ b/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recordings_list_by_group_properties.ambr@@ -31,7 +31,7 @@FROM groupsWHERE and(equals(groups.team_id, 99999), equals(index, 1))GROUP BY groups.group_type_index, groups.group_key) AS events__group_1 ON equals(events.`$group_1`, events__group_1.key)- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__group_1.properties___another, 'value'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__group_1.properties___another, 'value'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -85,7 +85,7 @@FROM groupsWHERE and(equals(groups.team_id, 99999), equals(index, 1))GROUP BY groups.group_type_index, groups.group_key) AS events__group_1 ON equals(events.`$group_1`, events__group_1.key)- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__group_1.properties___another, 'difference'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__group_1.properties___another, 'difference'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -139,7 +139,7 @@FROM groupsWHERE and(equals(groups.team_id, 99999), equals(index, 1))GROUP BY groups.group_type_index, groups.group_key) AS events__group_1 ON equals(events.`$group_1`, events__group_1.key)- WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__group_1.properties___difference, 'value'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__group_1.properties___difference, 'value'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -193,7 +193,7 @@FROM groupsWHERE 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), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__group_0.properties___industry, 'finance'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__group_0.properties___industry, 'finance'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -247,7 +247,7 @@FROM groupsWHERE 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), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__group_0.properties___industry, 'difference'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__group_0.properties___industry, 'difference'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))@@ -301,7 +301,7 @@FROM groupsWHERE 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), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__group_0.properties___difference, 'finance'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(nullIf(nullIf(events.`$session_id`, ''), 'null')), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__group_0.properties___difference, 'finance'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')HAVING 1LIMIT 1000000)))diff --git a/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recordings_list_by_group_properties.new_events_schema.ambr b/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recordings_list_by_group_properties.new_events_schema.ambrindex 556721cb848f..66ec73ae7542 100644--- a/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recordings_list_by_group_properties.new_events_schema.ambr+++ b/posthog/session_recordings/queries/test/listing_recordings/__snapshots__/test_session_recordings_list_by_group_properties.new_events_schema.ambr@@ -31,7 +31,7 @@FROM groupsWHERE and(equals(groups.team_id, 99999), equals(index, 1))GROUP BY groups.group_type_index, groups.group_key) AS events__group_1 ON equals(events.properties.`$group_1`, events__group_1.key)- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__group_1.properties___another, 'difference'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__group_1.properties___another, 'difference'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -86,7 +86,7 @@FROM groupsWHERE and(equals(groups.team_id, 99999), equals(index, 1))GROUP BY groups.group_type_index, groups.group_key) AS events__group_1 ON equals(events.properties.`$group_1`, events__group_1.key)- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__group_1.properties___difference, 'value'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__group_1.properties___difference, 'value'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -141,7 +141,7 @@FROM groupsWHERE 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), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__group_0.properties___industry, 'finance'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__group_0.properties___industry, 'finance'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -196,7 +196,7 @@FROM groupsWHERE 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), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__group_0.properties___industry, 'difference'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__group_0.properties___industry, 'difference'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -251,7 +251,7 @@FROM groupsWHERE 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), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__group_0.properties___difference, 'finance'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__group_0.properties___difference, 'finance'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))@@ -306,7 +306,7 @@FROM groupsWHERE and(equals(groups.team_id, 99999), equals(index, 1))GROUP BY groups.group_type_index, groups.group_key) AS events__group_1 ON equals(events.properties.`$group_1`, events__group_1.key)- WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, now64(6, 'UTC')), ifNull(equals(events__group_1.properties___another, 'value'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))+ WHERE and(equals(events.team_id, 99999), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 6, 'UTC')), ifNull(equals(events__group_1.properties___another, 'value'), 0), greaterOrEquals(events.timestamp, toDateTime64('2019-12-28 00:00:00.000000', 6, 'UTC')))GROUP BY if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))HAVING 1LIMIT 1000000)))diff --git a/products/error_tracking/backend/hogql_queries/test/__snapshots__/test_error_tracking_issue_correlation_query_runner.ambr b/products/error_tracking/backend/hogql_queries/test/__snapshots__/test_error_tracking_issue_correlation_query_runner.ambrindex 4ea12f7ea807..3fb878c16855 100644--- a/products/error_tracking/backend/hogql_queries/test/__snapshots__/test_error_tracking_issue_correlation_query_runner.ambr+++ b/products/error_tracking/backend/hogql_queries/test/__snapshots__/test_error_tracking_issue_correlation_query_runner.ambr@@ -17,7 +17,7 @@WHERE equals(error_tracking_fingerprint_issue_state.team_id, 99999)GROUP BY fp_hashHAVING equals(argMax(error_tracking_fingerprint_issue_state.is_deleted, error_tracking_fingerprint_issue_state.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__fingerprint_issue_state ON equals(cityHash64(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$exception_fingerprint'), ''), 'null'), '^"|"$', '')), events__fingerprint_issue_state.fp_hash)- WHERE and(equals(events.team_id, 99999), greater(events.timestamp, minus(now64(6, 'UTC'), toIntervalHour(6))), notEmpty(events.`$session_id`), isNotNull(events__fingerprint_issue_state.issue_id), equals(events.event, '$exception'))+ WHERE and(equals(events.team_id, 99999), greater(events.timestamp, toDateTime64(minus(now64(6, 'UTC'), toIntervalHour(6)), 6, 'UTC')), notEmpty(events.`$session_id`), isNotNull(events__fingerprint_issue_state.issue_id), equals(events.event, '$exception'))GROUP BY events__fingerprint_issue_state.issue_id))SELECT event AS event,@@ -57,7 +57,7 @@WHERE equals(error_tracking_fingerprint_issue_state.team_id, 99999)GROUP BY fp_hashHAVING equals(argMax(error_tracking_fingerprint_issue_state.is_deleted, error_tracking_fingerprint_issue_state.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__fingerprint_issue_state ON equals(cityHash64(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$exception_fingerprint'), ''), 'null'), '^"|"$', '')), events__fingerprint_issue_state.fp_hash)- WHERE and(equals(events.team_id, 99999), greater(events.timestamp, minus(now64(6, 'UTC'), toIntervalHour(6))), notEmpty(events.`$session_id`))+ WHERE and(equals(events.team_id, 99999), greater(events.timestamp, toDateTime64(minus(now64(6, 'UTC'), toIntervalHour(6)), 6, 'UTC')), notEmpty(events.`$session_id`))GROUP BY events.`$session_id`) ARRAYJOIN events AS event,earliest_success_events AS earliest_success_event)diff --git a/products/error_tracking/backend/hogql_queries/test/__snapshots__/test_error_tracking_issue_correlation_query_runner.new_events_schema.ambr b/products/error_tracking/backend/hogql_queries/test/__snapshots__/test_error_tracking_issue_correlation_query_runner.new_events_schema.ambrindex 5b3037b13494..0fd771148523 100644--- a/products/error_tracking/backend/hogql_queries/test/__snapshots__/test_error_tracking_issue_correlation_query_runner.new_events_schema.ambr+++ b/products/error_tracking/backend/hogql_queries/test/__snapshots__/test_error_tracking_issue_correlation_query_runner.new_events_schema.ambr@@ -17,7 +17,7 @@WHERE equals(error_tracking_fingerprint_issue_state.team_id, 99999)GROUP BY fp_hashHAVING equals(argMax(error_tracking_fingerprint_issue_state.is_deleted, error_tracking_fingerprint_issue_state.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__fingerprint_issue_state ON equals(cityHash64(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$exception_fingerprint`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$exception_fingerprint`)), if(isNull(nullIf(toString(events.properties.`$exception_fingerprint`), '')), NULL, if(and(in(ascii(toString(events.properties.`$exception_fingerprint`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$exception_fingerprint`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$exception_fingerprint`), '[]'), '{}'), toString(events.properties.`$exception_fingerprint`))))), events__fingerprint_issue_state.fp_hash)- WHERE and(equals(events.team_id, 99999), greater(events.timestamp, minus(now64(6, 'UTC'), toIntervalHour(6))), notEmpty(events.properties.`$session_id`), isNotNull(events__fingerprint_issue_state.issue_id), equals(events.event, '$exception'))+ WHERE and(equals(events.team_id, 99999), greater(events.timestamp, toDateTime64(minus(now64(6, 'UTC'), toIntervalHour(6)), 6, 'UTC')), notEmpty(events.properties.`$session_id`), isNotNull(events__fingerprint_issue_state.issue_id), equals(events.event, '$exception'))GROUP BY events__fingerprint_issue_state.issue_id))SELECT event AS event,@@ -57,7 +57,7 @@WHERE equals(error_tracking_fingerprint_issue_state.team_id, 99999)GROUP BY fp_hashHAVING equals(argMax(error_tracking_fingerprint_issue_state.is_deleted, error_tracking_fingerprint_issue_state.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__fingerprint_issue_state ON equals(cityHash64(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$exception_fingerprint`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$exception_fingerprint`)), if(isNull(nullIf(toString(events.properties.`$exception_fingerprint`), '')), NULL, if(and(in(ascii(toString(events.properties.`$exception_fingerprint`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$exception_fingerprint`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$exception_fingerprint`), '[]'), '{}'), toString(events.properties.`$exception_fingerprint`))))), events__fingerprint_issue_state.fp_hash)- WHERE and(equals(events.team_id, 99999), greater(events.timestamp, minus(now64(6, 'UTC'), toIntervalHour(6))), notEmpty(events.properties.`$session_id`))+ WHERE and(equals(events.team_id, 99999), greater(events.timestamp, toDateTime64(minus(now64(6, 'UTC'), toIntervalHour(6)), 6, 'UTC')), notEmpty(events.properties.`$session_id`))GROUP BY events.properties.`$session_id`) ARRAYJOIN events AS event,earliest_success_events AS earliest_success_event)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.ambrindex ebe7b7f5d20b..76e6f3f59e32 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@@ -27,7 +27,7 @@HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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']))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, flag_exposures.first_flag_exposure_time))+ 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)SELECT first_exposures.day AS day,first_exposures.variant AS variant,@@ -82,7 +82,7 @@HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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']))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, flag_exposures.first_flag_exposure_time))+ 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),metric_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -161,7 +161,7 @@HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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']))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, flag_exposures.first_flag_exposure_time))+ 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),metric_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -175,7 +175,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), 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/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.ambrindex 9f9c920e7ba8..183a435db161 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@@ -27,7 +27,7 @@HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), if(isNull(nullIf(toString(events.properties.`$feature_flag`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag`), '[]'), '{}'), toString(events.properties.`$feature_flag`)))), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag_response`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag_response`)), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(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(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(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, flag_exposures.first_flag_exposure_time))+ 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(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(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)SELECT first_exposures.day AS day,first_exposures.variant AS variant,@@ -83,7 +83,7 @@HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), if(isNull(nullIf(toString(events.properties.`$feature_flag`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag`), '[]'), '{}'), toString(events.properties.`$feature_flag`)))), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag_response`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag_response`)), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(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(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(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, flag_exposures.first_flag_exposure_time))+ 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(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(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),metric_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -163,7 +163,7 @@HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), if(isNull(nullIf(toString(events.properties.`$feature_flag`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag`), '[]'), '{}'), toString(events.properties.`$feature_flag`)))), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag_response`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag_response`)), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(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(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(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, flag_exposures.first_flag_exposure_time))+ 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(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(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),metric_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -177,7 +177,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), 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/experiment_query_runner/__snapshots__/test_base.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_base.ambrindex 290c4cd4b9f6..5795286788b6 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@@ -30,7 +30,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'checkout-conversion'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'checkout-conversion'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -92,7 +92,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ 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(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -140,7 +140,7 @@toTimeZone(events.timestamp, 'UTC') AS timestamp,coalesce(accurateCastOrNull(1, 'Float64'), 0) AS valueFROM events- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -188,7 +188,7 @@toTimeZone(events.timestamp, 'UTC') AS timestamp,coalesce(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'amount'), ''), 'null'), '^"|"$', ''), 'Float64'), 0) AS valueFROM events- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -250,7 +250,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-02-01 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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-02-01 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -312,7 +312,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), and(equals(events.event, 'purchase'), ifNull(notEquals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'plan'), ''), 'null'), '^"|"$', ''), 'pro'), 1)))),+ 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(0)), 6, 'UTC')), and(equals(events.event, 'purchase'), ifNull(notEquals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'plan'), ''), 'null'), '^"|"$', ''), 'pro'), 1)))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -374,7 +374,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ 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(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -436,7 +436,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ 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(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -498,7 +498,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -560,7 +560,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -622,7 +622,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -684,7 +684,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ 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(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -746,7 +746,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -808,7 +808,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'conversion'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'conversion'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -870,7 +870,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -932,7 +932,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -994,7 +994,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1056,7 +1056,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1118,7 +1118,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1180,7 +1180,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1242,7 +1242,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1304,7 +1304,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1366,7 +1366,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1428,7 +1428,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1490,7 +1490,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1552,7 +1552,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1627,7 +1627,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1689,7 +1689,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1764,7 +1764,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1826,7 +1826,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1896,7 +1896,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1958,7 +1958,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -2020,7 +2020,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -2082,7 +2082,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -2144,7 +2144,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'test_property'), ''), 'null'), '^"|"$', ''), 'test_value'), 0))),+ 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(0)), 6, 'UTC')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'test_property'), ''), 'null'), '^"|"$', ''), 'test_value'), 0))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -2206,7 +2206,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -2268,7 +2268,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC')), toIntervalSecond(86400))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC')), toIntervalSecond(86400)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -2330,7 +2330,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC')), toIntervalSecond(172800))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC')), toIntervalSecond(172800)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -2392,7 +2392,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC')), toIntervalSecond(259200))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC')), toIntervalSecond(259200)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -2440,7 +2440,7 @@toTimeZone(events.timestamp, 'UTC') AS timestamp,1 AS valueFROM events- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -2502,7 +2502,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -2550,7 +2550,7 @@toTimeZone(t.timestamp, 'UTC') AS timestamp,accurateCastOrNull(t.entity_id, 'UUID') AS valueFROM experiment_metric_events_preaggregated AS t- WHERE and(equals(t.team_id, 99999), in(t.job_id, ['00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000']), equals(t.team_id, 99999), greaterOrEquals(t.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(t.timestamp, plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0))))+ WHERE and(equals(t.team_id, 99999), in(t.job_id, ['00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000']), equals(t.team_id, 99999), greaterOrEquals(t.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(t.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')))GROUP BY t.entity_id,toTimeZone(t.timestamp, 'UTC'),t.event_uuid),@@ -2616,7 +2616,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-02-01 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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-02-01 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), 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/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.ambrindex 5b8044c16fe8..190939e208ca 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@@ -30,7 +30,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'checkout-conversion'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'checkout-conversion'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -93,7 +93,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ 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(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -142,7 +142,7 @@toTimeZone(events.timestamp, 'UTC') AS timestamp,coalesce(accurateCastOrNull(1, 'Float64'), 0) AS valueFROM events_json AS events- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -191,7 +191,7 @@toTimeZone(events.timestamp, 'UTC') AS timestamp,coalesce(accurateCastOrNull(events.properties.amount, 'Float64'), 0) AS valueFROM events_json AS events- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -254,7 +254,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-02-01 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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-02-01 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -317,7 +317,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), and(equals(events.event, 'purchase'), ifNull(notEquals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^plan)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^plan)), if(isNull(nullIf(toString(events.properties.plan), '')), NULL, if(and(in(ascii(toString(events.properties.plan)), tuple(91, 123)), in(ascii(toJSONString(events.properties.plan)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.plan), '[]'), '{}'), toString(events.properties.plan)))), 'pro'), 1)))),+ 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(0)), 6, 'UTC')), and(equals(events.event, 'purchase'), ifNull(notEquals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^plan)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^plan)), if(isNull(nullIf(toString(events.properties.plan), '')), NULL, if(and(in(ascii(toString(events.properties.plan)), tuple(91, 123)), in(ascii(toJSONString(events.properties.plan)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.plan), '[]'), '{}'), toString(events.properties.plan)))), 'pro'), 1)))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -380,7 +380,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ 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(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -443,7 +443,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ 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(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -506,7 +506,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -569,7 +569,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -632,7 +632,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -695,7 +695,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ 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(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -758,7 +758,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -821,7 +821,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'conversion'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'conversion'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -884,7 +884,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -947,7 +947,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1010,7 +1010,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1073,7 +1073,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1136,7 +1136,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1199,7 +1199,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1262,7 +1262,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1325,7 +1325,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1388,7 +1388,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1451,7 +1451,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1514,7 +1514,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1577,7 +1577,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1640,7 +1640,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1706,7 +1706,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1769,7 +1769,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1835,7 +1835,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1898,7 +1898,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1969,7 +1969,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -2032,7 +2032,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -2095,7 +2095,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-31 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -2158,7 +2158,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^test_property)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^test_property)), if(isNull(nullIf(toString(events.properties.test_property), '')), NULL, if(and(in(ascii(toString(events.properties.test_property)), tuple(91, 123)), in(ascii(toJSONString(events.properties.test_property)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.test_property), '[]'), '{}'), toString(events.properties.test_property)))), 'test_value'), 0))),+ 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(0)), 6, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^test_property)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^test_property)), if(isNull(nullIf(toString(events.properties.test_property), '')), NULL, if(and(in(ascii(toString(events.properties.test_property)), tuple(91, 123)), in(ascii(toJSONString(events.properties.test_property)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.test_property), '[]'), '{}'), toString(events.properties.test_property)))), 'test_value'), 0))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -2221,7 +2221,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -2284,7 +2284,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC')), toIntervalSecond(86400))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC')), toIntervalSecond(86400)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -2347,7 +2347,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC')), toIntervalSecond(172800))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC')), toIntervalSecond(172800)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -2410,7 +2410,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC')), toIntervalSecond(259200))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-05 12:00:00', 'UTC')), toIntervalSecond(259200)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -2459,7 +2459,7 @@toTimeZone(events.timestamp, 'UTC') AS timestamp,1 AS valueFROM events_json AS events- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -2522,7 +2522,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -2585,7 +2585,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-02-01 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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-02-01 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), 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/experiment_query_runner/__snapshots__/test_breakdown.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_breakdown.ambrindex 824de407ac50..c4b550793158 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@@ -69,7 +69,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(1209600))), 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(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')))))),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,@@ -190,7 +190,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -258,7 +258,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -326,7 +326,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -394,7 +394,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -464,7 +464,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -536,7 +536,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -606,7 +606,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -678,7 +678,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -761,7 +761,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -833,7 +833,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -900,7 +900,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -913,20 +913,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'view_item'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'view_item'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -997,7 +997,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -1010,20 +1010,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ 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(0)), 6, 'UTC')), equals(events.event, '$pageview'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -1095,7 +1095,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -1108,20 +1108,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'view_item'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'view_item'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -1197,7 +1197,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(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(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -1211,7 +1211,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'login'))),+ 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, 'login'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1282,7 +1282,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(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(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -1296,7 +1296,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'login'))),+ 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, 'login'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1368,7 +1368,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(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(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -1382,7 +1382,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'login'))),+ 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, 'login'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,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.ambrindex a027e9cfb4a0..88314120cb42 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@@ -70,7 +70,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), if(isNull(nullIf(toString(events.properties.`$feature_flag`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag`), '[]'), '{}'), toString(events.properties.`$feature_flag`)))), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag_response`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag_response`)), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(1209600))), 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(equals(events.event, '$feature_flag_called'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), if(isNull(nullIf(toString(events.properties.`$feature_flag`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag`), '[]'), '{}'), toString(events.properties.`$feature_flag`)))), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag_response`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag_response`)), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(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,@@ -193,7 +193,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -262,7 +262,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -331,7 +331,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -400,7 +400,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -471,7 +471,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -544,7 +544,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -615,7 +615,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -688,7 +688,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -772,7 +772,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -845,7 +845,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -913,7 +913,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -926,20 +926,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'view_item'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'view_item'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -1011,7 +1011,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -1024,20 +1024,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ 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(0)), 6, 'UTC')), equals(events.event, '$pageview'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -1110,7 +1110,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -1123,20 +1123,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'view_item'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'view_item'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -1213,7 +1213,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(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(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -1227,7 +1227,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'login'))),+ 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, 'login'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1299,7 +1299,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(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(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -1313,7 +1313,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'login'))),+ 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, 'login'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1386,7 +1386,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(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(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -1400,7 +1400,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'login'))),+ 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, 'login'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,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.ambrindex 7ea641b50073..cb8251cc344a 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@@ -94,20 +94,20 @@(SELECT posthog_test_stripe_customers.customer_email AS customer_email,posthog_test_stripe_customers.customer_id AS posthog_test_stripe_subscriptions__subscription_customer___customer_idFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.hogql.experiments.queryrunner/posthog_test_stripe_customers/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`customer_id` String, `signup_count` Int32, `customer_name` String, `customer_email` String, `customer_created_at` DateTime') AS posthog_test_stripe_customers) AS posthog_test_stripe_subscriptions__subscription_customer ON equals(posthog_test_stripe_subscriptions.subscription_customer_id, posthog_test_stripe_subscriptions__subscription_customer.posthog_test_stripe_subscriptions__subscription_customer___customer_id)- WHERE and(greaterOrEquals(posthog_test_stripe_subscriptions.subscription_created_at, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(posthog_test_stripe_subscriptions.subscription_created_at, plus(assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC')), toIntervalSecond(0))))),+ WHERE and(greaterOrEquals(posthog_test_stripe_subscriptions.subscription_created_at, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(posthog_test_stripe_subscriptions.subscription_created_at, toDateTime64(plus(assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(toString(exposures.exposure_identifier_num), toString(numerator_events.entity_id))- WHERE greaterOrEquals(numerator_events.timestamp, exposures.first_exposure_time)+ WHERE ifNull(greaterOrEquals(toDateTime64(numerator_events.timestamp, 6, 'UTC'), exposures.first_exposure_time), 0)GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(toString(exposures.exposure_identifier_denom), toString(denominator_events.entity_id))- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -1455,7 +1455,7 @@(SELECT posthog_test_stripe_customers.customer_email AS customer_email,posthog_test_stripe_customers.customer_id AS posthog_test_stripe_subscriptions__subscription_customer___customer_idFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.hogql.experiments.queryrunner/posthog_test_stripe_customers/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`customer_id` String, `signup_count` Int32, `customer_name` String, `customer_email` String, `customer_created_at` DateTime') AS posthog_test_stripe_customers) AS posthog_test_stripe_subscriptions__subscription_customer ON equals(posthog_test_stripe_subscriptions.subscription_customer_id, posthog_test_stripe_subscriptions__subscription_customer.posthog_test_stripe_subscriptions__subscription_customer___customer_id)- WHERE and(greaterOrEquals(posthog_test_stripe_subscriptions.subscription_created_at, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(posthog_test_stripe_subscriptions.subscription_created_at, plus(assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC')), toIntervalSecond(0))))),+ WHERE and(greaterOrEquals(posthog_test_stripe_subscriptions.subscription_created_at, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(posthog_test_stripe_subscriptions.subscription_created_at, toDateTime64(plus(assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1525,20 +1525,20 @@(SELECT posthog_test_stripe_customers.customer_email AS customer_email,posthog_test_stripe_customers.customer_id AS posthog_test_stripe_subscriptions__subscription_customer___customer_idFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.hogql.experiments.queryrunner/posthog_test_stripe_customers/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`customer_id` String, `signup_count` Int32, `customer_name` String, `customer_email` String, `customer_created_at` DateTime') AS posthog_test_stripe_customers) AS posthog_test_stripe_subscriptions__subscription_customer ON equals(posthog_test_stripe_subscriptions.subscription_customer_id, posthog_test_stripe_subscriptions__subscription_customer.posthog_test_stripe_subscriptions__subscription_customer___customer_id)- WHERE and(greaterOrEquals(posthog_test_stripe_subscriptions.subscription_created_at, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(posthog_test_stripe_subscriptions.subscription_created_at, plus(assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC')), toIntervalSecond(0))))),+ WHERE and(greaterOrEquals(posthog_test_stripe_subscriptions.subscription_created_at, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(posthog_test_stripe_subscriptions.subscription_created_at, toDateTime64(plus(assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(toString(exposures.exposure_identifier_num), toString(numerator_events.entity_id))- WHERE greaterOrEquals(numerator_events.timestamp, exposures.first_exposure_time)+ WHERE ifNull(greaterOrEquals(toDateTime64(numerator_events.timestamp, 6, 'UTC'), exposures.first_exposure_time), 0)GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(toString(exposures.exposure_identifier_denom), toString(denominator_events.entity_id))- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,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.ambrindex 73783e0b3f2f..00b112dbbe4d 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@@ -95,20 +95,20 @@(SELECT posthog_test_stripe_customers.customer_email AS customer_email,posthog_test_stripe_customers.customer_id AS posthog_test_stripe_subscriptions__subscription_customer___customer_idFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.hogql.experiments.queryrunner/posthog_test_stripe_customers/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`customer_id` String, `signup_count` Int32, `customer_name` String, `customer_email` String, `customer_created_at` DateTime') AS posthog_test_stripe_customers) AS posthog_test_stripe_subscriptions__subscription_customer ON equals(posthog_test_stripe_subscriptions.subscription_customer_id, posthog_test_stripe_subscriptions__subscription_customer.posthog_test_stripe_subscriptions__subscription_customer___customer_id)- WHERE and(greaterOrEquals(posthog_test_stripe_subscriptions.subscription_created_at, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(posthog_test_stripe_subscriptions.subscription_created_at, plus(assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC')), toIntervalSecond(0))))),+ WHERE and(greaterOrEquals(posthog_test_stripe_subscriptions.subscription_created_at, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(posthog_test_stripe_subscriptions.subscription_created_at, toDateTime64(plus(assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(toString(exposures.exposure_identifier_num), toString(numerator_events.entity_id))- WHERE greaterOrEquals(numerator_events.timestamp, exposures.first_exposure_time)+ WHERE ifNull(greaterOrEquals(toDateTime64(numerator_events.timestamp, 6, 'UTC'), exposures.first_exposure_time), 0)GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(toString(exposures.exposure_identifier_denom), toString(denominator_events.entity_id))- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -1459,7 +1459,7 @@(SELECT posthog_test_stripe_customers.customer_email AS customer_email,posthog_test_stripe_customers.customer_id AS posthog_test_stripe_subscriptions__subscription_customer___customer_idFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.hogql.experiments.queryrunner/posthog_test_stripe_customers/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`customer_id` String, `signup_count` Int32, `customer_name` String, `customer_email` String, `customer_created_at` DateTime') AS posthog_test_stripe_customers) AS posthog_test_stripe_subscriptions__subscription_customer ON equals(posthog_test_stripe_subscriptions.subscription_customer_id, posthog_test_stripe_subscriptions__subscription_customer.posthog_test_stripe_subscriptions__subscription_customer___customer_id)- WHERE and(greaterOrEquals(posthog_test_stripe_subscriptions.subscription_created_at, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(posthog_test_stripe_subscriptions.subscription_created_at, plus(assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC')), toIntervalSecond(0))))),+ WHERE and(greaterOrEquals(posthog_test_stripe_subscriptions.subscription_created_at, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(posthog_test_stripe_subscriptions.subscription_created_at, toDateTime64(plus(assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1530,20 +1530,20 @@(SELECT posthog_test_stripe_customers.customer_email AS customer_email,posthog_test_stripe_customers.customer_id AS posthog_test_stripe_subscriptions__subscription_customer___customer_idFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.hogql.experiments.queryrunner/posthog_test_stripe_customers/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`customer_id` String, `signup_count` Int32, `customer_name` String, `customer_email` String, `customer_created_at` DateTime') AS posthog_test_stripe_customers) AS posthog_test_stripe_subscriptions__subscription_customer ON equals(posthog_test_stripe_subscriptions.subscription_customer_id, posthog_test_stripe_subscriptions__subscription_customer.posthog_test_stripe_subscriptions__subscription_customer___customer_id)- WHERE and(greaterOrEquals(posthog_test_stripe_subscriptions.subscription_created_at, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(posthog_test_stripe_subscriptions.subscription_created_at, plus(assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC')), toIntervalSecond(0))))),+ WHERE and(greaterOrEquals(posthog_test_stripe_subscriptions.subscription_created_at, assumeNotNull(toDateTime('2023-01-01 00:00:00', 'UTC'))), less(posthog_test_stripe_subscriptions.subscription_created_at, toDateTime64(plus(assumeNotNull(toDateTime('2023-01-10 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(toString(exposures.exposure_identifier_num), toString(numerator_events.entity_id))- WHERE greaterOrEquals(numerator_events.timestamp, exposures.first_exposure_time)+ WHERE ifNull(greaterOrEquals(toDateTime64(numerator_events.timestamp, 6, 'UTC'), exposures.first_exposure_time), 0)GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(toString(exposures.exposure_identifier_denom), toString(denominator_events.entity_id))- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT 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.ambrindex b6f53ce5a0a5..9ac01bf72859 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@@ -30,7 +30,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), 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/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.ambrindex bf33a08cd601..36107de84e41 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@@ -30,7 +30,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), 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/experiment_query_runner/__snapshots__/test_funnel_metric.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_funnel_metric.ambrindex 8b542139d8f4..2b9bcc26a0b4 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@@ -78,7 +78,7 @@arraySort(x -> minus(0, x.1), arrayMap(result -> tuple(result.1, if(and(ifNull(greaterOrEquals(result.1, 0), 0), ifNull(greater(length(result.4), result.1), 0)), if(ifNull(greater(length(arrayElement(result.4, plus(result.1, 1))), 0), 0), toString(arrayElement(result.4, plus(result.1, 1))[1]), ''), '')), aggregate_funnel_array(3, 94608000, 'first_touch', 'unordered', array(array('')), [], arraySort(t -> t.1, arrayFilter(t -> and(isNotNull(t.1), isNotNull(t.2)), groupArray(tuple(accurateCastOrNull(toTimeZone(base_events.timestamp, 'UTC'), 'Float64'), base_events.uuid, array(''), arrayFilter(x -> ifNull(greater(x, 0), 0), [multiply(1, base_events.step_0), multiply(2, base_events.step_1), multiply(3, base_events.step_2)]))))))))[1] AS valueFROM base_eventsINNER JOIN first_exposures ON equals(base_events.entity_id, first_exposures.entity_id)- WHERE greaterOrEquals(base_events.timestamp, toTimeZone(first_exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(base_events.timestamp, toDateTime64(toTimeZone(first_exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY base_events.entity_id)SELECT entity_metrics.variant AS variant,count(entity_metrics.entity_id) AS num_users,@@ -276,7 +276,7 @@arraySort(x -> minus(0, x.1), arrayMap(result -> tuple(result.1, if(and(ifNull(greaterOrEquals(result.1, 0), 0), ifNull(greater(length(result.4), result.1), 0)), if(ifNull(greater(length(arrayElement(result.4, plus(result.1, 1))), 0), 0), toString(arrayElement(result.4, plus(result.1, 1))[1]), ''), '')), aggregate_funnel_array(3, 94608000, 'first_touch', 'unordered', array(array('')), [], arraySort(t -> t.1, arrayFilter(t -> and(isNotNull(t.1), isNotNull(t.2)), groupArray(tuple(accurateCastOrNull(toTimeZone(base_events.timestamp, 'UTC'), 'Float64'), base_events.uuid, array(''), arrayFilter(x -> ifNull(greater(x, 0), 0), [multiply(1, base_events.step_0), multiply(2, base_events.step_1), multiply(3, base_events.step_2)]))))))))[1] AS valueFROM base_eventsINNER JOIN first_exposures ON equals(base_events.entity_id, first_exposures.entity_id)- WHERE greaterOrEquals(base_events.timestamp, toTimeZone(first_exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(base_events.timestamp, toDateTime64(toTimeZone(first_exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY base_events.entity_id)SELECT entity_metrics.variant AS variant,count(entity_metrics.entity_id) AS num_users,@@ -414,7 +414,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(86400))), 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(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')))))),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 @@arraySort(x -> minus(0, x.1), arrayMap(result -> tuple(result.1, if(and(ifNull(greaterOrEquals(result.1, 0), 0), ifNull(greater(length(result.4), result.1), 0)), if(ifNull(greater(length(arrayElement(result.4, plus(result.1, 1))), 0), 0), toString(arrayElement(result.4, plus(result.1, 1))[1]), ''), '')), aggregate_funnel_array(3, 94608000, 'first_touch', 'unordered', array(array('')), [], arraySort(t -> t.1, arrayFilter(t -> and(isNotNull(t.1), isNotNull(t.2)), groupArray(tuple(accurateCastOrNull(toTimeZone(base_events.timestamp, 'UTC'), 'Float64'), base_events.uuid, array(''), arrayFilter(x -> ifNull(greater(x, 0), 0), [multiply(1, base_events.step_0), multiply(2, base_events.step_1), multiply(3, base_events.step_2)]))))))))[1] AS valueFROM base_eventsINNER JOIN first_exposures ON equals(base_events.entity_id, first_exposures.entity_id)- WHERE greaterOrEquals(base_events.timestamp, toTimeZone(first_exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(base_events.timestamp, toDateTime64(toTimeZone(first_exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY base_events.entity_id)SELECT entity_metrics.variant AS variant,count(entity_metrics.entity_id) AS num_users,@@ -666,7 +666,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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, plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800))), 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(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')))))),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,@@ -714,7 +714,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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, plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800))), 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(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')))))),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.ambrindex 5d4e14ff536d..243965ba4060 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@@ -79,7 +79,7 @@arraySort(x -> minus(0, x.1), arrayMap(result -> tuple(result.1, if(and(ifNull(greaterOrEquals(result.1, 0), 0), ifNull(greater(length(result.4), result.1), 0)), if(ifNull(greater(length(arrayElement(result.4, plus(result.1, 1))), 0), 0), toString(arrayElement(result.4, plus(result.1, 1))[1]), ''), '')), aggregate_funnel_array(3, 94608000, 'first_touch', 'unordered', array(array('')), [], arraySort(t -> t.1, arrayFilter(t -> and(isNotNull(t.1), isNotNull(t.2)), groupArray(tuple(accurateCastOrNull(toTimeZone(base_events.timestamp, 'UTC'), 'Float64'), base_events.uuid, array(''), arrayFilter(x -> ifNull(greater(x, 0), 0), [multiply(1, base_events.step_0), multiply(2, base_events.step_1), multiply(3, base_events.step_2)]))))))))[1] AS valueFROM base_eventsINNER JOIN first_exposures ON equals(base_events.entity_id, first_exposures.entity_id)- WHERE greaterOrEquals(base_events.timestamp, toTimeZone(first_exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(base_events.timestamp, toDateTime64(toTimeZone(first_exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY base_events.entity_id)SELECT entity_metrics.variant AS variant,count(entity_metrics.entity_id) AS num_users,@@ -232,7 +232,7 @@arraySort(x -> minus(0, x.1), arrayMap(result -> tuple(result.1, if(and(ifNull(greaterOrEquals(result.1, 0), 0), ifNull(greater(length(result.4), result.1), 0)), if(ifNull(greater(length(arrayElement(result.4, plus(result.1, 1))), 0), 0), toString(arrayElement(result.4, plus(result.1, 1))[1]), ''), '')), aggregate_funnel_array(3, 94608000, 'first_touch', 'unordered', array(array('')), [], arraySort(t -> t.1, arrayFilter(t -> and(isNotNull(t.1), isNotNull(t.2)), groupArray(tuple(accurateCastOrNull(toTimeZone(base_events.timestamp, 'UTC'), 'Float64'), base_events.uuid, array(''), arrayFilter(x -> ifNull(greater(x, 0), 0), [multiply(1, base_events.step_0), multiply(2, base_events.step_1), multiply(3, base_events.step_2)]))))))))[1] AS valueFROM base_eventsINNER JOIN first_exposures ON equals(base_events.entity_id, first_exposures.entity_id)- WHERE greaterOrEquals(base_events.timestamp, toTimeZone(first_exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(base_events.timestamp, toDateTime64(toTimeZone(first_exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY base_events.entity_id)SELECT entity_metrics.variant AS variant,count(entity_metrics.entity_id) AS num_users,@@ -422,7 +422,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), if(isNull(nullIf(toString(events.properties.`$feature_flag`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag`), '[]'), '{}'), toString(events.properties.`$feature_flag`)))), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag_response`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag_response`)), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(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, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(86400))), 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(equals(events.event, '$feature_flag_called'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), if(isNull(nullIf(toString(events.properties.`$feature_flag`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag`), '[]'), '{}'), toString(events.properties.`$feature_flag`)))), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag_response`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag_response`)), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(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,@@ -636,7 +636,7 @@arraySort(x -> minus(0, x.1), arrayMap(result -> tuple(result.1, if(and(ifNull(greaterOrEquals(result.1, 0), 0), ifNull(greater(length(result.4), result.1), 0)), if(ifNull(greater(length(arrayElement(result.4, plus(result.1, 1))), 0), 0), toString(arrayElement(result.4, plus(result.1, 1))[1]), ''), '')), aggregate_funnel_array(3, 94608000, 'first_touch', 'unordered', array(array('')), [], arraySort(t -> t.1, arrayFilter(t -> and(isNotNull(t.1), isNotNull(t.2)), groupArray(tuple(accurateCastOrNull(toTimeZone(base_events.timestamp, 'UTC'), 'Float64'), base_events.uuid, array(''), arrayFilter(x -> ifNull(greater(x, 0), 0), [multiply(1, base_events.step_0), multiply(2, base_events.step_1), multiply(3, base_events.step_2)]))))))))[1] AS valueFROM base_eventsINNER JOIN first_exposures ON equals(base_events.entity_id, first_exposures.entity_id)- WHERE greaterOrEquals(base_events.timestamp, toTimeZone(first_exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(base_events.timestamp, toDateTime64(toTimeZone(first_exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY base_events.entity_id)SELECT entity_metrics.variant AS variant,count(entity_metrics.entity_id) AS num_users,@@ -679,7 +679,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), if(isNull(nullIf(toString(events.properties.`$feature_flag`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag`), '[]'), '{}'), toString(events.properties.`$feature_flag`)))), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag_response`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag_response`)), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(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, plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800))), 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(equals(events.event, '$feature_flag_called'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), if(isNull(nullIf(toString(events.properties.`$feature_flag`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag`), '[]'), '{}'), toString(events.properties.`$feature_flag`)))), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag_response`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag_response`)), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(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,@@ -728,7 +728,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), if(isNull(nullIf(toString(events.properties.`$feature_flag`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag`), '[]'), '{}'), toString(events.properties.`$feature_flag`)))), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag_response`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag_response`)), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(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, plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800))), 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(equals(events.event, '$feature_flag_called'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), if(isNull(nullIf(toString(events.properties.`$feature_flag`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$feature_flag`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$feature_flag`), '[]'), '{}'), toString(events.properties.`$feature_flag`)))), 'test-experiment'), 0)), ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email))))), '%@posthog.com%'), 1), in(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag_response`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag_response`)), if(isNull(nullIf(toString(events.properties.`$feature_flag_response`), '')), NULL, if(and(in(ascii(toString(events.properties.`$feature_flag_response`)), tuple(91, 123)), in(ascii(toJSONString(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,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.ambrindex e1ce65af49ea..b970f3640eec 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@@ -30,7 +30,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(86400))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(86400)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -92,7 +92,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -154,7 +154,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -227,7 +227,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -289,7 +289,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -361,7 +361,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -433,7 +433,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -505,7 +505,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -567,7 +567,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -629,7 +629,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -691,7 +691,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -739,7 +739,7 @@toTimeZone(t.timestamp, 'UTC') AS timestamp,any(t.numeric_value) AS valueFROM experiment_metric_events_preaggregated AS t- WHERE and(equals(t.team_id, 99999), in(t.job_id, ['00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000']), equals(t.team_id, 99999), greaterOrEquals(t.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(t.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))))+ WHERE and(equals(t.team_id, 99999), in(t.job_id, ['00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000']), equals(t.team_id, 99999), greaterOrEquals(t.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(t.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')))GROUP BY t.entity_id,toTimeZone(t.timestamp, 'UTC'),t.event_uuid),@@ -805,7 +805,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -867,7 +867,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,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.ambrindex e0e12e642e94..5532dee24674 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@@ -30,7 +30,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(86400))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(86400)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -93,7 +93,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -156,7 +156,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -230,7 +230,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -293,7 +293,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -366,7 +366,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -439,7 +439,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -512,7 +512,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -575,7 +575,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -638,7 +638,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -701,7 +701,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -764,7 +764,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -827,7 +827,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,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.ambrindex ab782ea912cb..7d38aa5c8468 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@@ -30,7 +30,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -43,20 +43,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -115,7 +115,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -128,20 +128,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -209,7 +209,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -222,20 +222,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, 'purchase'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE and(greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')), less(numerator_events.timestamp, plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(604800))))+ WHERE and(greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')), less(numerator_events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(604800)), 6, 'UTC')))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE and(greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')), less(denominator_events.timestamp, plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(604800))))+ WHERE and(greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')), less(denominator_events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(604800)), 6, 'UTC')))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -301,7 +301,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -314,20 +314,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'pageview'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -406,7 +406,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -419,20 +419,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'pageview'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -512,7 +512,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -525,20 +525,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'pageview'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -624,7 +624,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -637,20 +637,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'pageview'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -716,7 +716,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -729,20 +729,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'pageview'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,coalesce(avg(accurateCastOrNull(numerator_events.value, 'Float64')), 0) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,accurateCastOrNull(count(DISTINCT multiIf(isNull(denominator_events.value), NULL, and(in(toTypeName(denominator_events.value), tuple('UUID', 'Nullable(UUID)')), equals(reinterpretAsUInt128(assumeNotNull(denominator_events.value)), 0)), NULL, equals(toString(denominator_events.value), ''), NULL, denominator_events.value)), 'Float64') AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -808,7 +808,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -821,20 +821,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -900,7 +900,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(3600))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(3600)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -913,20 +913,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(3600))), equals(events.event, 'pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(3600)), 6, 'UTC')), equals(events.event, 'pageview'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE and(greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')), less(numerator_events.timestamp, plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(3600))))+ WHERE and(greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')), less(numerator_events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(3600)), 6, 'UTC')))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE and(greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')), less(denominator_events.timestamp, plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(3600))))+ WHERE and(greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')), less(denominator_events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(3600)), 6, 'UTC')))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -992,7 +992,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -1005,20 +1005,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,coalesce(quantile(0.95)(accurateCastOrNull(numerator_events.value, 'Float64')), 0) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,coalesce(accurateCastOrNull(uniqExact(denominator_events.value), 'Float64'), 0) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -1084,7 +1084,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -1097,20 +1097,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'special_event'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'special_event'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,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.ambrindex 53c25e9320ac..f1f0e5303018 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@@ -30,7 +30,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -43,20 +43,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ 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(0)), 6, 'UTC')), equals(events.event, 'purchase'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -116,7 +116,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -129,20 +129,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -211,7 +211,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -224,20 +224,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 00:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, 'purchase'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE and(greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')), less(numerator_events.timestamp, plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(604800))))+ WHERE and(greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')), less(numerator_events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(604800)), 6, 'UTC')))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE and(greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')), less(denominator_events.timestamp, plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(604800))))+ WHERE and(greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')), less(denominator_events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(604800)), 6, 'UTC')))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -304,7 +304,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -317,20 +317,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'pageview'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -410,7 +410,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -423,20 +423,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'pageview'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -517,7 +517,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -530,20 +530,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'pageview'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -630,7 +630,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -643,20 +643,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'pageview'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -723,7 +723,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -736,20 +736,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'pageview'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,coalesce(avg(accurateCastOrNull(numerator_events.value, 'Float64')), 0) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,accurateCastOrNull(count(DISTINCT multiIf(isNull(denominator_events.value), NULL, and(in(toTypeName(denominator_events.value), tuple('UUID', 'Nullable(UUID)')), equals(reinterpretAsUInt128(assumeNotNull(denominator_events.value)), 0)), NULL, equals(toString(denominator_events.value), ''), NULL, denominator_events.value)), 'Float64') AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -816,7 +816,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -829,20 +829,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -909,7 +909,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(3600))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(3600)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -922,20 +922,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(3600))), equals(events.event, 'pageview'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(3600)), 6, 'UTC')), equals(events.event, 'pageview'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE and(greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')), less(numerator_events.timestamp, plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(3600))))+ WHERE and(greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')), less(numerator_events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(3600)), 6, 'UTC')))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE and(greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')), less(denominator_events.timestamp, plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(3600))))+ WHERE and(greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')), less(denominator_events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(3600)), 6, 'UTC')))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -1002,7 +1002,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -1015,20 +1015,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-10 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,coalesce(quantile(0.95)(accurateCastOrNull(numerator_events.value, 'Float64')), 0) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,coalesce(accurateCastOrNull(uniqExact(denominator_events.value), 'Float64'), 0) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,@@ -1095,7 +1095,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'purchase'))),denominator_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,@@ -1108,20 +1108,20 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'special_event'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'special_event'))),numerator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS valueFROM numerator_eventsJOIN exposures ON equals(exposures.entity_id, numerator_events.entity_id)- WHERE greaterOrEquals(numerator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(numerator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),denominator_agg AS(SELECT exposures.entity_id AS entity_id,sum(coalesce(accurateCastOrNull(denominator_events.value, 'Float64'), 0)) AS valueFROM denominator_eventsJOIN exposures ON equals(exposures.entity_id, denominator_events.entity_id)- WHERE greaterOrEquals(denominator_events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC'))+ WHERE greaterOrEquals(denominator_events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC'))GROUP BY exposures.entity_id),entity_metrics AS(SELECT exposures.variant AS variant,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.ambrindex 68193426f9fe..f76e4e4b51ad 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@@ -31,7 +31,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(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(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -45,7 +45,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'login'))),+ 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, 'login'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -100,16 +100,16 @@toTimeZone(t.timestamp, 'UTC') AS timestamp,t.event_uuid AS uuidFROM experiment_metric_events_preaggregated AS t- WHERE and(equals(t.team_id, 99999), in(t.job_id, ['00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000']), equals(t.team_id, 99999), ifNull(equals(arrayElement(t.steps, 1), 1), 0), greaterOrEquals(t.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(t.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))))) AS events+ WHERE and(equals(t.team_id, 99999), in(t.job_id, ['00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000']), equals(t.team_id, 99999), ifNull(equals(arrayElement(t.steps, 1), 1), 0), greaterOrEquals(t.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(t.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')))) AS eventsINNER JOIN exposures ON equals(events.entity_id, exposures.entity_id)- WHERE greaterOrEquals(events.timestamp, exposures.first_exposure_time)+ WHERE ifNull(greaterOrEquals(toDateTime64(events.timestamp, 6, 'UTC'), exposures.first_exposure_time), 0)GROUP BY exposures.entity_id),completion_events AS(SELECT accurateCastOrNull(t.entity_id, 'UUID') AS entity_id,t.event_uuid AS completion_uuid,toTimeZone(t.timestamp, 'UTC') AS completion_timestampFROM experiment_metric_events_preaggregated AS t- WHERE and(equals(t.team_id, 99999), in(t.job_id, ['00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000']), equals(t.team_id, 99999), ifNull(equals(arrayElement(t.steps, 2), 1), 0), greaterOrEquals(t.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(t.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))))),+ WHERE and(equals(t.team_id, 99999), in(t.job_id, ['00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000', '00000000-0000-0000-0000-000000000000']), equals(t.team_id, 99999), ifNull(equals(arrayElement(t.steps, 2), 1), 0), greaterOrEquals(t.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(t.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -176,7 +176,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(259200))), equals(events.event, 'signup')), and(greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')), lessOrEquals(events.timestamp, plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(259200)))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(259200)), 6, 'UTC')), equals(events.event, 'signup')), and(greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(259200)), 6, 'UTC'))))GROUP BY exposures.entity_idHAVING lessOrEquals(plus(min(toTimeZone(events.timestamp, 'UTC')), toIntervalSecond(604800)), parseDateTime64BestEffortOrNull('2020-01-25 12:00:00', 6, 'UTC'))),completion_events AS@@ -191,7 +191,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(864000))), equals(events.event, 'login'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(864000)), 6, 'UTC')), equals(events.event, 'login'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -257,7 +257,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_idHAVING lessOrEquals(plus(min(toTimeZone(events.timestamp, 'UTC')), toIntervalSecond(604800)), parseDateTime64BestEffortOrNull('2020-01-25 12:00:00', 6, 'UTC'))),completion_events AS@@ -272,7 +272,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'login'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, 'login'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -343,7 +343,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'return_visit'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, 'return_visit'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -409,7 +409,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_idHAVING lessOrEquals(plus(min(toTimeZone(events.timestamp, 'UTC')), toIntervalSecond(604800)), parseDateTime64BestEffortOrNull('2020-01-25 12:00:00', 6, 'UTC'))),completion_events AS@@ -424,7 +424,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'login'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, 'login'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -495,7 +495,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'return_visit'))),+ 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, 'return_visit'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -561,7 +561,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -575,7 +575,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'first_action'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'first_action'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -646,7 +646,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'entered_experiment'))),+ 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, 'entered_experiment'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -712,7 +712,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -726,7 +726,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -792,7 +792,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -806,7 +806,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -872,7 +872,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'session_start')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'session_start')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_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_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'key_action'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'key_action'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -952,7 +952,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -966,7 +966,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1032,7 +1032,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'app_open')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'app_open')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -1046,7 +1046,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'feature_used'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, 'feature_used'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1112,7 +1112,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -1126,7 +1126,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1192,7 +1192,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'action_performed')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(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(0)), 6, 'UTC')), equals(events.event, 'action_performed')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -1206,7 +1206,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'action_performed'))),+ 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, 'action_performed'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1272,7 +1272,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -1286,7 +1286,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(1209600))), equals(events.event, 'return_visit'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(1209600)), 6, 'UTC')), equals(events.event, 'return_visit'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1352,7 +1352,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(7200))), equals(events.event, 'signup')), and(greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')), lessOrEquals(events.timestamp, plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(7200)))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(7200)), 6, 'UTC')), equals(events.event, 'signup')), and(greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(7200)), 6, 'UTC'))))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -1366,7 +1366,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(266400))), equals(events.event, 'return_visit'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(266400)), 6, 'UTC')), equals(events.event, 'return_visit'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,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.ambrindex 0816e7aba39b..82aeb640a99e 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@@ -31,7 +31,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(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(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -45,7 +45,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'login'))),+ 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, 'login'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -112,7 +112,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(259200))), equals(events.event, 'signup')), and(greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')), lessOrEquals(events.timestamp, plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(259200)))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(259200)), 6, 'UTC')), equals(events.event, 'signup')), and(greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(259200)), 6, 'UTC'))))GROUP BY exposures.entity_idHAVING lessOrEquals(plus(min(toTimeZone(events.timestamp, 'UTC')), toIntervalSecond(604800)), parseDateTime64BestEffortOrNull('2020-01-25 12:00:00', 6, 'UTC'))),completion_events AS@@ -127,7 +127,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(864000))), equals(events.event, 'login'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(864000)), 6, 'UTC')), equals(events.event, 'login'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -194,7 +194,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_idHAVING lessOrEquals(plus(min(toTimeZone(events.timestamp, 'UTC')), toIntervalSecond(604800)), parseDateTime64BestEffortOrNull('2020-01-25 12:00:00', 6, 'UTC'))),completion_events AS@@ -209,7 +209,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'login'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, 'login'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -281,7 +281,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'return_visit'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, 'return_visit'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -348,7 +348,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_idHAVING lessOrEquals(plus(min(toTimeZone(events.timestamp, 'UTC')), toIntervalSecond(604800)), parseDateTime64BestEffortOrNull('2020-01-25 12:00:00', 6, 'UTC'))),completion_events AS@@ -363,7 +363,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'login'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2020-01-25 00:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, 'login'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -435,7 +435,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'return_visit'))),+ 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, 'return_visit'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -502,7 +502,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -516,7 +516,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'first_action'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'first_action'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -588,7 +588,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'entered_experiment'))),+ 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, 'entered_experiment'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -655,7 +655,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -669,7 +669,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -736,7 +736,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -750,7 +750,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -817,7 +817,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'session_start')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'session_start')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -831,7 +831,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'key_action'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'key_action'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -898,7 +898,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_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_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -979,7 +979,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'app_open')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'app_open')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -993,7 +993,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'feature_used'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, 'feature_used'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1060,7 +1060,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -1074,7 +1074,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'purchase'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(604800)), 6, 'UTC')), equals(events.event, 'purchase'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1141,7 +1141,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'action_performed')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(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(0)), 6, 'UTC')), equals(events.event, 'action_performed')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -1155,7 +1155,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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, plus(assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC')), toIntervalSecond(604800))), equals(events.event, 'action_performed'))),+ 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, 'action_performed'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1222,7 +1222,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -1236,7 +1236,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(1209600))), equals(events.event, 'return_visit'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(1209600)), 6, 'UTC')), equals(events.event, 'return_visit'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,@@ -1303,7 +1303,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)INNER JOIN exposures ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), exposures.entity_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(7200))), equals(events.event, 'signup')), and(greaterOrEquals(events.timestamp, toTimeZone(exposures.first_exposure_time, 'UTC')), lessOrEquals(events.timestamp, plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(7200)))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(7200)), 6, 'UTC')), equals(events.event, 'signup')), and(greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(7200)), 6, 'UTC'))))GROUP BY exposures.entity_id),completion_events AS(SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS entity_id,@@ -1317,7 +1317,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(266400))), equals(events.event, 'return_visit'))),+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(266400)), 6, 'UTC')), equals(events.event, 'return_visit'))),entity_metrics AS(SELECT exposures.entity_id AS entity_id,exposures.variant AS variant,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.ambrindex fdfc9b1ae069..4fbe88b11eae 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@@ -37,7 +37,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview')), isNotNull(events.`$session_id`), notEquals(events.`$session_id`, ''))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview')), isNotNull(events.`$session_id`), notEquals(events.`$session_id`, ''))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id),events.`$session_id`),metric_events ASdiff --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.ambrindex a21d4e0d0d4b..daad8707de51 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@@ -37,7 +37,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0))), equals(events.event, '$pageview')), isNotNull(events.properties.`$session_id`), notEquals(events.properties.`$session_id`, ''))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2024-01-01 12:00:00', 'UTC'))), less(events.timestamp, toDateTime64(plus(assumeNotNull(toDateTime('2024-01-15 12:00:00', 'UTC')), toIntervalSecond(0)), 6, 'UTC')), equals(events.event, '$pageview')), isNotNull(events.properties.`$session_id`), notEquals(events.properties.`$session_id`, ''))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id),events.properties.`$session_id`),metric_events ASdiff --git a/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_attribution_paths_query_runner.ambr b/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_attribution_paths_query_runner.ambrindex 0abad9a9913e..8e7b1dc74d79 100644--- a/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_attribution_paths_query_runner.ambr+++ b/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_attribution_paths_query_runner.ambr@@ -24,7 +24,7 @@SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_14)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_15)s, %(hogql_val_16)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_17)s, 6, %(hogql_val_18)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS conv_bounds ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), conv_bounds.person_id)- WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_38)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_39)s, %(hogql_val_40)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_41)s, 6, %(hogql_val_42)s))), and(equals(events.event, %(hogql_val_43)s), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_44)s, %(hogql_val_45)s), toIntervalSecond(345600))), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_46)s, 6, %(hogql_val_47)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_48)s)), minus(conv_bounds.first_conversion, 345600)))))+ WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_38)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_39)s, %(hogql_val_40)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_41)s, 6, %(hogql_val_42)s))), and(equals(events.event, %(hogql_val_43)s), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_44)s, %(hogql_val_45)s), toIntervalSecond(345600)), 6, %(hogql_val_46)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_47)s, 6, %(hogql_val_48)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_49)s)), minus(conv_bounds.first_conversion, 345600)))))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)HAVING greater(length(conversions), 0)), per_conversion_path AS MATERIALIZED (SELECT i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).2 AS conv_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, (person_arrays.conversions[i]).1), 0), ifNull(greaterOrEquals(t.1, minus((person_arrays.conversions[i]).1, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.2, tps) AS path_full, length(path_full) AS orig_len, arraySlice(path_full, -10) AS path, ifNull(greater(orig_len, 10), 0) AS truncated@@ -67,7 +67,7 @@SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_14)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_15)s, %(hogql_val_16)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_17)s, 6, %(hogql_val_18)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS conv_bounds ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), conv_bounds.person_id)- WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_91)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_92)s, %(hogql_val_93)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_94)s, 6, %(hogql_val_95)s))), and(equals(events.event, %(hogql_val_96)s), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_97)s, %(hogql_val_98)s), toIntervalSecond(345600))), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_99)s, 6, %(hogql_val_100)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_101)s)), minus(conv_bounds.first_conversion, 345600)))))+ WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_91)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_92)s, %(hogql_val_93)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_94)s, 6, %(hogql_val_95)s))), and(equals(events.event, %(hogql_val_96)s), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_97)s, %(hogql_val_98)s), toIntervalSecond(345600)), 6, %(hogql_val_99)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_100)s, 6, %(hogql_val_101)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_102)s)), minus(conv_bounds.first_conversion, 345600)))))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)HAVING greater(length(conversions), 0)), per_conversion_path AS MATERIALIZED (SELECT i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).2 AS conv_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, (person_arrays.conversions[i]).1), 0), ifNull(greaterOrEquals(t.1, minus((person_arrays.conversions[i]).1, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.2, tps) AS path_full, length(path_full) AS orig_len, arraySlice(path_full, -10) AS path, ifNull(greater(orig_len, 10), 0) AS truncated@@ -110,7 +110,7 @@SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_131)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_132)s, %(hogql_val_133)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_134)s, 6, %(hogql_val_135)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS conv_bounds ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), conv_bounds.person_id)- WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_156)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_157)s, %(hogql_val_158)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_159)s, 6, %(hogql_val_160)s))), and(equals(events.event, %(hogql_val_161)s), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_162)s, %(hogql_val_163)s), toIntervalSecond(345600))), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_164)s, 6, %(hogql_val_165)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_166)s)), minus(conv_bounds.first_conversion, 345600)))))+ WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_156)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_157)s, %(hogql_val_158)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_159)s, 6, %(hogql_val_160)s))), and(equals(events.event, %(hogql_val_161)s), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_162)s, %(hogql_val_163)s), toIntervalSecond(345600)), 6, %(hogql_val_164)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_165)s, 6, %(hogql_val_166)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_167)s)), minus(conv_bounds.first_conversion, 345600)))))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)HAVING greater(length(conversions), 0)), per_conversion_path AS MATERIALIZED (SELECT i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).2 AS conv_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, (person_arrays.conversions[i]).1), 0), ifNull(greaterOrEquals(t.1, minus((person_arrays.conversions[i]).1, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.2, tps) AS path_full, length(path_full) AS orig_len, arraySlice(path_full, -10) AS path, ifNull(greater(orig_len, 10), 0) AS truncated@@ -140,18 +140,18 @@WHERE and(equals(web_sessions_dimensional_preaggregated.team_id, 420), in(web_sessions_dimensional_preaggregated.job_id, tuple(%(hogql_val_12)s))) UNION ALLSELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priorityFROM (- SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_19)s)), `$start_timestamp`, %(hogql_val_20)s, toString(ifNull(`$entry_utm_source`, %(hogql_val_21)s)), %(hogql_val_22)s, toString(ifNull(`$entry_utm_campaign`, %(hogql_val_23)s)), %(hogql_val_24)s, %(hogql_val_25)s, %(hogql_val_26)s, %(hogql_val_27)s) AS dimensions, now64(6, %(hogql_val_28)s) AS computed_at, 1 AS source_priority+ SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_21)s)), `$start_timestamp`, %(hogql_val_22)s, toString(ifNull(`$entry_utm_source`, %(hogql_val_23)s)), %(hogql_val_24)s, toString(ifNull(`$entry_utm_campaign`, %(hogql_val_25)s)), %(hogql_val_26)s, %(hogql_val_27)s, %(hogql_val_28)s, %(hogql_val_29)s) AS dimensions, now64(6, %(hogql_val_30)s) AS computed_at, 1 AS source_priorityFROM (SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_13)s)) AS `$start_timestamp`, max(toTimeZone(raw_sessions.max_timestamp, %(hogql_val_14)s)) AS `$end_timestamp`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_15)s), %(hogql_val_16)s) AS `$entry_utm_source`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_17)s), %(hogql_val_18)s) AS `$entry_utm_campaign`, raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessions- WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1))), greater(raw_sessions.max_timestamp, plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800))))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, toDateTime64(minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1)), 6, %(hogql_val_19)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 6, %(hogql_val_20)s)))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))GROUP BY raw_sessions.session_id_v7HAVING and(greaterOrEquals(`$end_timestamp`, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(`$start_timestamp`, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')), or(less(`$start_timestamp`, toDateTime64('2022-12-27 00:00:00.000000', 6, 'UTC')), greater(`$end_timestamp`, plus(`$start_timestamp`, toIntervalSecond(259200)))))))) AS dGROUP BY d.session_id_v7)), identities AS (- SELECT events.`$session_id_uuid` AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_29)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_30)s)) AS max_event_timestamp, count() AS pageview_count+ SELECT events.`$session_id_uuid` AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_31)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_32)s)) AS max_event_timestamp, count() AS pageview_countFROM 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_idFROM person_distinct_id_overrides@@ -159,11 +159,11 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_31)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_33)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))GROUP BY session_id_v7, person_id)SELECT i.session_id_v7 AS session_id_v7, i.person_id AS person_id, toTimeZone(i.min_event_timestamp, %(hogql_val_0)s) AS min_event_timestamp, toTimeZone(i.max_event_timestamp, %(hogql_val_1)s) AS max_event_timestamp, i.pageview_count AS pageview_count, (d.latest).1 AS period_bucket, (d.latest).2 AS start_timestamp, (d.latest).3 AS channel_type, (d.latest).4 AS utm_source, (d.latest).5 AS utm_medium, (d.latest).6 AS utm_campaign, (d.latest).7 AS utm_term, (d.latest).8 AS utm_content, (d.latest).9 AS referring_domain, (d.latest).10 AS entry_pathname, toTimeZone(d.computed_at, %(hogql_val_2)s) AS computed_atFROM identities AS i INNER JOIN dimensions AS d ON equals(i.session_id_v7, d.session_id_v7)), cached_session_conversions AS MATERIALIZED (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_32)s)), coalesce(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_33)s), ''), 'null'), '^"|"$', ''), %(hogql_val_34)s), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_35)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_36)s))) AS last_conversion+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_34)s)), coalesce(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_35)s), ''), 'null'), '^"|"$', ''), %(hogql_val_36)s), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_37)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_38)s))) AS last_conversionFROM 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_idFROM person_distinct_id_overrides@@ -171,7 +171,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_37)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_38)s, %(hogql_val_39)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_40)s, 6, %(hogql_val_41)s)))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_39)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_40)s, %(hogql_val_41)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_42)s, 6, %(hogql_val_43)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)), person_arrays AS (SELECT c.conv_person_id AS person_id, c.conversions AS conversions, c.conversion_count AS conversion_count, t.touchpoints AS touchpointsFROM (@@ -179,7 +179,7 @@FROM cached_session_conversions) AS c LEFT JOIN (SELECT d.person_id AS person_id, arraySlice(arraySort(groupUniqArray(tuple(d.session_ts, d.session_dim))), -500) AS touchpointsFROM (- SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, toString(ifNull(cached_sessions.utm_campaign, %(hogql_val_42)s)) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_bound+ SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, toString(ifNull(cached_sessions.utm_campaign, %(hogql_val_44)s)) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_boundFROM resolved_cached_sessions AS cached_sessions INNER JOIN (SELECT cached_session_conversions.conv_person_id AS conv_person_id, cached_session_conversions.first_conversion AS first_conversion, cached_session_conversions.last_conversion AS last_conversionFROM cached_session_conversions) AS conv ON equals(cached_sessions.person_id, conv.conv_person_id)@@ -215,18 +215,18 @@WHERE and(equals(web_sessions_dimensional_preaggregated.team_id, 420), in(web_sessions_dimensional_preaggregated.job_id, tuple(%(hogql_val_13)s))) UNION ALLSELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priorityFROM (- SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_18)s)), `$start_timestamp`, %(hogql_val_19)s, toString(ifNull(`$entry_utm_source`, %(hogql_val_20)s)), %(hogql_val_21)s, %(hogql_val_22)s, %(hogql_val_23)s, %(hogql_val_24)s, %(hogql_val_25)s, %(hogql_val_26)s) AS dimensions, now64(6, %(hogql_val_27)s) AS computed_at, 1 AS source_priority+ SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_20)s)), `$start_timestamp`, %(hogql_val_21)s, toString(ifNull(`$entry_utm_source`, %(hogql_val_22)s)), %(hogql_val_23)s, %(hogql_val_24)s, %(hogql_val_25)s, %(hogql_val_26)s, %(hogql_val_27)s, %(hogql_val_28)s) AS dimensions, now64(6, %(hogql_val_29)s) AS computed_at, 1 AS source_priorityFROM (SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_14)s)) AS `$start_timestamp`, max(toTimeZone(raw_sessions.max_timestamp, %(hogql_val_15)s)) AS `$end_timestamp`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_16)s), %(hogql_val_17)s) AS `$entry_utm_source`, raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessions- WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1))), greater(raw_sessions.max_timestamp, plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800))))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, toDateTime64(minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1)), 6, %(hogql_val_18)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 6, %(hogql_val_19)s)))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))GROUP BY raw_sessions.session_id_v7HAVING and(greaterOrEquals(`$end_timestamp`, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(`$start_timestamp`, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')), or(less(`$start_timestamp`, toDateTime64('2022-12-27 00:00:00.000000', 6, 'UTC')), greater(`$end_timestamp`, plus(`$start_timestamp`, toIntervalSecond(259200)))))))) AS dGROUP BY d.session_id_v7)), identities AS (- SELECT events.`$session_id_uuid` AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_28)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_29)s)) AS max_event_timestamp, count() AS pageview_count+ SELECT events.`$session_id_uuid` AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_30)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_31)s)) AS max_event_timestamp, count() AS pageview_countFROM 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_idFROM person_distinct_id_overrides@@ -234,11 +234,11 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_30)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_32)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))GROUP BY session_id_v7, person_id)SELECT i.session_id_v7 AS session_id_v7, i.person_id AS person_id, toTimeZone(i.min_event_timestamp, %(hogql_val_0)s) AS min_event_timestamp, toTimeZone(i.max_event_timestamp, %(hogql_val_1)s) AS max_event_timestamp, i.pageview_count AS pageview_count, (d.latest).1 AS period_bucket, (d.latest).2 AS start_timestamp, (d.latest).3 AS channel_type, (d.latest).4 AS utm_source, (d.latest).5 AS utm_medium, (d.latest).6 AS utm_campaign, (d.latest).7 AS utm_term, (d.latest).8 AS utm_content, (d.latest).9 AS referring_domain, (d.latest).10 AS entry_pathname, toTimeZone(d.computed_at, %(hogql_val_2)s) AS computed_atFROM identities AS i INNER JOIN dimensions AS d ON equals(i.session_id_v7, d.session_id_v7)), cached_session_conversions AS MATERIALIZED (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_31)s)), coalesce(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_32)s), ''), 'null'), '^"|"$', ''), %(hogql_val_33)s), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_34)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_35)s))) AS last_conversion+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_33)s)), coalesce(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_34)s), ''), 'null'), '^"|"$', ''), %(hogql_val_35)s), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_36)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_37)s))) AS last_conversionFROM 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_idFROM person_distinct_id_overrides@@ -246,7 +246,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_36)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_37)s, %(hogql_val_38)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_39)s, 6, %(hogql_val_40)s)))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_38)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_39)s, %(hogql_val_40)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_41)s, 6, %(hogql_val_42)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)), person_arrays AS (SELECT c.conv_person_id AS person_id, c.conversions AS conversions, c.conversion_count AS conversion_count, t.touchpoints AS touchpointsFROM (@@ -254,7 +254,7 @@FROM cached_session_conversions) AS c LEFT JOIN (SELECT d.person_id AS person_id, arraySlice(arraySort(groupUniqArray(tuple(d.session_ts, d.session_dim))), -500) AS touchpointsFROM (- SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_41)s)), cached_sessions.utm_source, %(hogql_val_42)s)), [%(hogql_val_43)s, %(hogql_val_44)s, %(hogql_val_45)s]), %(hogql_val_46)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_47)s)), cached_sessions.utm_source, %(hogql_val_48)s)), [%(hogql_val_49)s, %(hogql_val_50)s, %(hogql_val_51)s, %(hogql_val_52)s, %(hogql_val_53)s, %(hogql_val_54)s, %(hogql_val_55)s, %(hogql_val_56)s]), %(hogql_val_57)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_58)s)), cached_sessions.utm_source, %(hogql_val_59)s)), [%(hogql_val_60)s]), %(hogql_val_61)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_62)s)), cached_sessions.utm_source, %(hogql_val_63)s)), [%(hogql_val_64)s, %(hogql_val_65)s, %(hogql_val_66)s, %(hogql_val_67)s, %(hogql_val_68)s, %(hogql_val_69)s, %(hogql_val_70)s, %(hogql_val_71)s, %(hogql_val_72)s]), %(hogql_val_73)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_74)s)), cached_sessions.utm_source, %(hogql_val_75)s)), [%(hogql_val_76)s]), %(hogql_val_77)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_78)s)), cached_sessions.utm_source, %(hogql_val_79)s)), [%(hogql_val_80)s, %(hogql_val_81)s]), %(hogql_val_82)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_83)s)), cached_sessions.utm_source, %(hogql_val_84)s)), [%(hogql_val_85)s, %(hogql_val_86)s, %(hogql_val_87)s]), %(hogql_val_88)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_89)s)), cached_sessions.utm_source, %(hogql_val_90)s)), [%(hogql_val_91)s]), %(hogql_val_92)s, if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_93)s)), cached_sessions.utm_source, %(hogql_val_94)s))))))))) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_bound+ SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_43)s)), cached_sessions.utm_source, %(hogql_val_44)s)), [%(hogql_val_45)s, %(hogql_val_46)s, %(hogql_val_47)s]), %(hogql_val_48)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_49)s)), cached_sessions.utm_source, %(hogql_val_50)s)), [%(hogql_val_51)s, %(hogql_val_52)s, %(hogql_val_53)s, %(hogql_val_54)s, %(hogql_val_55)s, %(hogql_val_56)s, %(hogql_val_57)s, %(hogql_val_58)s]), %(hogql_val_59)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_60)s)), cached_sessions.utm_source, %(hogql_val_61)s)), [%(hogql_val_62)s]), %(hogql_val_63)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_64)s)), cached_sessions.utm_source, %(hogql_val_65)s)), [%(hogql_val_66)s, %(hogql_val_67)s, %(hogql_val_68)s, %(hogql_val_69)s, %(hogql_val_70)s, %(hogql_val_71)s, %(hogql_val_72)s, %(hogql_val_73)s, %(hogql_val_74)s]), %(hogql_val_75)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_76)s)), cached_sessions.utm_source, %(hogql_val_77)s)), [%(hogql_val_78)s]), %(hogql_val_79)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_80)s)), cached_sessions.utm_source, %(hogql_val_81)s)), [%(hogql_val_82)s, %(hogql_val_83)s]), %(hogql_val_84)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_85)s)), cached_sessions.utm_source, %(hogql_val_86)s)), [%(hogql_val_87)s, %(hogql_val_88)s, %(hogql_val_89)s]), %(hogql_val_90)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_91)s)), cached_sessions.utm_source, %(hogql_val_92)s)), [%(hogql_val_93)s]), %(hogql_val_94)s, if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_95)s)), cached_sessions.utm_source, %(hogql_val_96)s))))))))) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_boundFROM resolved_cached_sessions AS cached_sessions INNER JOIN (SELECT cached_session_conversions.conv_person_id AS conv_person_id, cached_session_conversions.first_conversion AS first_conversion, cached_session_conversions.last_conversion AS last_conversionFROM cached_session_conversions) AS conv ON equals(cached_sessions.person_id, conv.conv_person_id)@@ -290,18 +290,18 @@WHERE and(equals(web_sessions_dimensional_preaggregated.team_id, 420), in(web_sessions_dimensional_preaggregated.job_id, tuple(%(hogql_val_13)s))) UNION ALLSELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priorityFROM (- SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_135)s)), `$start_timestamp`, if(notEmpty(ifNull(`$channel_type`, %(hogql_val_136)s)), `$channel_type`, %(hogql_val_137)s), %(hogql_val_138)s, %(hogql_val_139)s, %(hogql_val_140)s, %(hogql_val_141)s, %(hogql_val_142)s, %(hogql_val_143)s, %(hogql_val_144)s) AS dimensions, now64(6, %(hogql_val_145)s) AS computed_at, 1 AS source_priority+ SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_137)s)), `$start_timestamp`, if(notEmpty(ifNull(`$channel_type`, %(hogql_val_138)s)), `$channel_type`, %(hogql_val_139)s), %(hogql_val_140)s, %(hogql_val_141)s, %(hogql_val_142)s, %(hogql_val_143)s, %(hogql_val_144)s, %(hogql_val_145)s, %(hogql_val_146)s) AS dimensions, now64(6, %(hogql_val_147)s) AS computed_at, 1 AS source_priorityFROM (SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_14)s)) AS `$start_timestamp`, max(toTimeZone(raw_sessions.max_timestamp, %(hogql_val_15)s)) AS `$end_timestamp`, multiIf(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_16)s), %(hogql_val_17)s), %(hogql_val_18)s), %(hogql_val_19)s)), %(hogql_val_20)s), %(hogql_val_21)s, or(in(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_22)s), %(hogql_val_23)s), %(hogql_val_24)s), %(hogql_val_25)s)), tuple(%(hogql_val_26)s, %(hogql_val_27)s, %(hogql_val_28)s, %(hogql_val_29)s, %(hogql_val_30)s, %(hogql_val_31)s)), startsWith(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_32)s), %(hogql_val_33)s), %(hogql_val_34)s), %(hogql_val_35)s)), %(hogql_val_36)s), isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_gclid), %(hogql_val_37)s), %(hogql_val_38)s)), isNotNull(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_gad_source), %(hogql_val_39)s), %(hogql_val_40)s), %(hogql_val_41)s), %(hogql_val_42)s))), coalesce(coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_43)s), %(hogql_val_44)s), %(hogql_val_45)s), %(hogql_val_46)s)), ''), 'source')) , dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (cutToFirstSignificantSubdomain(coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_43)s), %(hogql_val_44)s), %(hogql_val_45)s), %(hogql_val_46)s)), '')), 'source'))), if(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_47)s), %(hogql_val_48)s), %(hogql_val_49)s), %(hogql_val_50)s)), %(hogql_val_51)s), %(hogql_val_52)s, NULL), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_53)s), %(hogql_val_54)s), %(hogql_val_55)s), %(hogql_val_56)s)), ''), 'medium')), coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_57)s), %(hogql_val_58)s), ''), 'source')) , dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (cutToFirstSignificantSubdomain(coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_57)s), %(hogql_val_58)s), '')), 'source'))), multiIf(ifNull(equals(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_gad_source), %(hogql_val_59)s), %(hogql_val_60)s), %(hogql_val_61)s), %(hogql_val_62)s), %(hogql_val_63)s), 0), %(hogql_val_64)s, match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_65)s), %(hogql_val_66)s), %(hogql_val_67)s), %(hogql_val_68)s)), %(hogql_val_69)s), %(hogql_val_70)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_71)s), %(hogql_val_72)s)), %(hogql_val_73)s, %(hogql_val_74)s)), and(ifNull(equals(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_75)s), %(hogql_val_76)s), %(hogql_val_77)s), 0), isNull(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_78)s), %(hogql_val_79)s), %(hogql_val_80)s), %(hogql_val_81)s))), or(isNull(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_82)s), %(hogql_val_83)s), %(hogql_val_84)s), %(hogql_val_85)s))), in(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_86)s), %(hogql_val_87)s), %(hogql_val_88)s), %(hogql_val_89)s)), tuple(%(hogql_val_90)s, %(hogql_val_91)s, %(hogql_val_92)s))), not(isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_93)s), %(hogql_val_94)s)))), %(hogql_val_95)s, coalesce(coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_96)s), %(hogql_val_97)s), %(hogql_val_98)s), %(hogql_val_99)s)), ''), 'source')), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (cutToFirstSignificantSubdomain(coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_96)s), %(hogql_val_97)s), %(hogql_val_98)s), %(hogql_val_99)s)), '')), 'source'))), if(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_100)s), %(hogql_val_101)s), %(hogql_val_102)s), %(hogql_val_103)s)), %(hogql_val_104)s), %(hogql_val_105)s, NULL), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_106)s), %(hogql_val_107)s), %(hogql_val_108)s), %(hogql_val_109)s)), ''), 'medium')), coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_110)s), %(hogql_val_111)s), ''), 'source')), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (cutToFirstSignificantSubdomain(coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_110)s), %(hogql_val_111)s), '')), 'source'))), multiIf(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_112)s), %(hogql_val_113)s), %(hogql_val_114)s), %(hogql_val_115)s)), %(hogql_val_116)s), %(hogql_val_117)s, match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_118)s), %(hogql_val_119)s), %(hogql_val_120)s), %(hogql_val_121)s)), %(hogql_val_122)s), %(hogql_val_123)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_124)s), %(hogql_val_125)s)), %(hogql_val_126)s, ifNull(equals(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_127)s), %(hogql_val_128)s), %(hogql_val_129)s), 0), %(hogql_val_130)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_131)s), %(hogql_val_132)s)), %(hogql_val_133)s, %(hogql_val_134)s))) AS `$channel_type`, raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessions- WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1))), greater(raw_sessions.max_timestamp, plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800))))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, toDateTime64(minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1)), 6, %(hogql_val_135)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 6, %(hogql_val_136)s)))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))GROUP BY raw_sessions.session_id_v7HAVING and(greaterOrEquals(`$end_timestamp`, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(`$start_timestamp`, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')), or(less(`$start_timestamp`, toDateTime64('2022-12-27 00:00:00.000000', 6, 'UTC')), greater(`$end_timestamp`, plus(`$start_timestamp`, toIntervalSecond(259200)))))))) AS dGROUP BY d.session_id_v7)), identities AS (- SELECT events.`$session_id_uuid` AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_146)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_147)s)) AS max_event_timestamp, count() AS pageview_count+ SELECT events.`$session_id_uuid` AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_148)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_149)s)) AS max_event_timestamp, count() AS pageview_countFROM 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_idFROM person_distinct_id_overrides@@ -309,11 +309,11 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_148)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_150)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))GROUP BY session_id_v7, person_id)SELECT i.session_id_v7 AS session_id_v7, i.person_id AS person_id, toTimeZone(i.min_event_timestamp, %(hogql_val_0)s) AS min_event_timestamp, toTimeZone(i.max_event_timestamp, %(hogql_val_1)s) AS max_event_timestamp, i.pageview_count AS pageview_count, (d.latest).1 AS period_bucket, (d.latest).2 AS start_timestamp, (d.latest).3 AS channel_type, (d.latest).4 AS utm_source, (d.latest).5 AS utm_medium, (d.latest).6 AS utm_campaign, (d.latest).7 AS utm_term, (d.latest).8 AS utm_content, (d.latest).9 AS referring_domain, (d.latest).10 AS entry_pathname, toTimeZone(d.computed_at, %(hogql_val_2)s) AS computed_atFROM identities AS i INNER JOIN dimensions AS d ON equals(i.session_id_v7, d.session_id_v7)), cached_session_conversions AS MATERIALIZED (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_149)s)), coalesce(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_150)s), ''), 'null'), '^"|"$', ''), %(hogql_val_151)s), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_152)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_153)s))) AS last_conversion+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_151)s)), coalesce(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_152)s), ''), 'null'), '^"|"$', ''), %(hogql_val_153)s), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_154)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_155)s))) AS last_conversionFROM 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_idFROM person_distinct_id_overrides@@ -321,7 +321,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_154)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_155)s, %(hogql_val_156)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_157)s, 6, %(hogql_val_158)s)))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_156)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_157)s, %(hogql_val_158)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_159)s, 6, %(hogql_val_160)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)), person_arrays AS (SELECT c.conv_person_id AS person_id, c.conversions AS conversions, c.conversion_count AS conversion_count, t.touchpoints AS touchpointsFROM (@@ -329,7 +329,7 @@FROM cached_session_conversions) AS c LEFT JOIN (SELECT d.person_id AS person_id, arraySlice(arraySort(groupUniqArray(tuple(d.session_ts, d.session_dim))), -500) AS touchpointsFROM (- SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, if(notEmpty(ifNull(cached_sessions.channel_type, %(hogql_val_159)s)), cached_sessions.channel_type, %(hogql_val_160)s) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_bound+ SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, if(notEmpty(ifNull(cached_sessions.channel_type, %(hogql_val_161)s)), cached_sessions.channel_type, %(hogql_val_162)s) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_boundFROM resolved_cached_sessions AS cached_sessions INNER JOIN (SELECT cached_session_conversions.conv_person_id AS conv_person_id, cached_session_conversions.first_conversion AS first_conversion, cached_session_conversions.last_conversion AS last_conversionFROM cached_session_conversions) AS conv ON equals(cached_sessions.person_id, conv.conv_person_id)diff --git a/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_attribution_paths_query_runner.new_events_schema.ambr b/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_attribution_paths_query_runner.new_events_schema.ambrindex 50f061f38411..74484741104d 100644--- a/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_attribution_paths_query_runner.new_events_schema.ambr+++ b/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_attribution_paths_query_runner.new_events_schema.ambr@@ -24,7 +24,7 @@SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_14)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_15)s, %(hogql_val_16)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_17)s, 6, %(hogql_val_18)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS conv_bounds ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), conv_bounds.person_id)- WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_36)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_37)s, %(hogql_val_38)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_39)s, 6, %(hogql_val_40)s))), and(equals(events.event, %(hogql_val_41)s), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_42)s, %(hogql_val_43)s), toIntervalSecond(345600))), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_44)s, 6, %(hogql_val_45)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_46)s)), minus(conv_bounds.first_conversion, 345600)))))+ WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_36)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_37)s, %(hogql_val_38)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_39)s, 6, %(hogql_val_40)s))), and(equals(events.event, %(hogql_val_41)s), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_42)s, %(hogql_val_43)s), toIntervalSecond(345600)), 6, %(hogql_val_44)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_45)s, 6, %(hogql_val_46)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_47)s)), minus(conv_bounds.first_conversion, 345600)))))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)HAVING greater(length(conversions), 0)), per_conversion_path AS MATERIALIZED (SELECT i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).2 AS conv_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, (person_arrays.conversions[i]).1), 0), ifNull(greaterOrEquals(t.1, minus((person_arrays.conversions[i]).1, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.2, tps) AS path_full, length(path_full) AS orig_len, arraySlice(path_full, -10) AS path, ifNull(greater(orig_len, 10), 0) AS truncated@@ -67,7 +67,7 @@SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_14)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_15)s, %(hogql_val_16)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_17)s, 6, %(hogql_val_18)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS conv_bounds ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), conv_bounds.person_id)- WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_89)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_90)s, %(hogql_val_91)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_92)s, 6, %(hogql_val_93)s))), and(equals(events.event, %(hogql_val_94)s), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_95)s, %(hogql_val_96)s), toIntervalSecond(345600))), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_97)s, 6, %(hogql_val_98)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_99)s)), minus(conv_bounds.first_conversion, 345600)))))+ WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_89)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_90)s, %(hogql_val_91)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_92)s, 6, %(hogql_val_93)s))), and(equals(events.event, %(hogql_val_94)s), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_95)s, %(hogql_val_96)s), toIntervalSecond(345600)), 6, %(hogql_val_97)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_98)s, 6, %(hogql_val_99)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_100)s)), minus(conv_bounds.first_conversion, 345600)))))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)HAVING greater(length(conversions), 0)), per_conversion_path AS MATERIALIZED (SELECT i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).2 AS conv_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, (person_arrays.conversions[i]).1), 0), ifNull(greaterOrEquals(t.1, minus((person_arrays.conversions[i]).1, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.2, tps) AS path_full, length(path_full) AS orig_len, arraySlice(path_full, -10) AS path, ifNull(greater(orig_len, 10), 0) AS truncated@@ -110,7 +110,7 @@SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_131)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_132)s, %(hogql_val_133)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_134)s, 6, %(hogql_val_135)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS conv_bounds ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), conv_bounds.person_id)- WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_154)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_155)s, %(hogql_val_156)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_157)s, 6, %(hogql_val_158)s))), and(equals(events.event, %(hogql_val_159)s), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_160)s, %(hogql_val_161)s), toIntervalSecond(345600))), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_162)s, 6, %(hogql_val_163)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_164)s)), minus(conv_bounds.first_conversion, 345600)))))+ WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_154)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_155)s, %(hogql_val_156)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_157)s, 6, %(hogql_val_158)s))), and(equals(events.event, %(hogql_val_159)s), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_160)s, %(hogql_val_161)s), toIntervalSecond(345600)), 6, %(hogql_val_162)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_163)s, 6, %(hogql_val_164)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_165)s)), minus(conv_bounds.first_conversion, 345600)))))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)HAVING greater(length(conversions), 0)), per_conversion_path AS MATERIALIZED (SELECT i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).2 AS conv_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, (person_arrays.conversions[i]).1), 0), ifNull(greaterOrEquals(t.1, minus((person_arrays.conversions[i]).1, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.2, tps) AS path_full, length(path_full) AS orig_len, arraySlice(path_full, -10) AS path, ifNull(greater(orig_len, 10), 0) AS truncated@@ -140,18 +140,18 @@WHERE and(equals(web_sessions_dimensional_preaggregated.team_id, 420), in(web_sessions_dimensional_preaggregated.job_id, tuple(%(hogql_val_12)s))) UNION ALLSELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priorityFROM (- SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_19)s)), `$start_timestamp`, %(hogql_val_20)s, toString(ifNull(`$entry_utm_source`, %(hogql_val_21)s)), %(hogql_val_22)s, toString(ifNull(`$entry_utm_campaign`, %(hogql_val_23)s)), %(hogql_val_24)s, %(hogql_val_25)s, %(hogql_val_26)s, %(hogql_val_27)s) AS dimensions, now64(6, %(hogql_val_28)s) AS computed_at, 1 AS source_priority+ SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_21)s)), `$start_timestamp`, %(hogql_val_22)s, toString(ifNull(`$entry_utm_source`, %(hogql_val_23)s)), %(hogql_val_24)s, toString(ifNull(`$entry_utm_campaign`, %(hogql_val_25)s)), %(hogql_val_26)s, %(hogql_val_27)s, %(hogql_val_28)s, %(hogql_val_29)s) AS dimensions, now64(6, %(hogql_val_30)s) AS computed_at, 1 AS source_priorityFROM (SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_13)s)) AS `$start_timestamp`, max(toTimeZone(raw_sessions.max_timestamp, %(hogql_val_14)s)) AS `$end_timestamp`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_15)s), %(hogql_val_16)s) AS `$entry_utm_source`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_17)s), %(hogql_val_18)s) AS `$entry_utm_campaign`, raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessions- WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1))), greater(raw_sessions.max_timestamp, plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800))))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, toDateTime64(minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1)), 6, %(hogql_val_19)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 6, %(hogql_val_20)s)))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))GROUP BY raw_sessions.session_id_v7HAVING and(greaterOrEquals(`$end_timestamp`, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(`$start_timestamp`, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')), or(less(`$start_timestamp`, toDateTime64('2022-12-27 00:00:00.000000', 6, 'UTC')), greater(`$end_timestamp`, plus(`$start_timestamp`, toIntervalSecond(259200)))))))) AS dGROUP BY d.session_id_v7)), identities AS (- SELECT toUInt128(toUUIDOrNull(events.properties.`$session_id`)) AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_29)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_30)s)) AS max_event_timestamp, count() AS pageview_count+ SELECT toUInt128(toUUIDOrNull(events.properties.`$session_id`)) AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_31)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_32)s)) AS max_event_timestamp, count() AS pageview_countFROM 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_idFROM person_distinct_id_overrides@@ -159,11 +159,11 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_31)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_33)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))GROUP BY session_id_v7, person_id)SELECT i.session_id_v7 AS session_id_v7, i.person_id AS person_id, toTimeZone(i.min_event_timestamp, %(hogql_val_0)s) AS min_event_timestamp, toTimeZone(i.max_event_timestamp, %(hogql_val_1)s) AS max_event_timestamp, i.pageview_count AS pageview_count, (d.latest).1 AS period_bucket, (d.latest).2 AS start_timestamp, (d.latest).3 AS channel_type, (d.latest).4 AS utm_source, (d.latest).5 AS utm_medium, (d.latest).6 AS utm_campaign, (d.latest).7 AS utm_term, (d.latest).8 AS utm_content, (d.latest).9 AS referring_domain, (d.latest).10 AS entry_pathname, toTimeZone(d.computed_at, %(hogql_val_2)s) AS computed_atFROM identities AS i INNER JOIN dimensions AS d ON equals(i.session_id_v7, d.session_id_v7)), cached_session_conversions AS MATERIALIZED (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_32)s)), coalesce(accurateCastOrNull(events.properties.revenue, 'Float64'), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_33)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_34)s))) AS last_conversion+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_34)s)), coalesce(accurateCastOrNull(events.properties.revenue, 'Float64'), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_35)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_36)s))) AS last_conversionFROM 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_idFROM person_distinct_id_overrides@@ -171,7 +171,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_35)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_36)s, %(hogql_val_37)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_38)s, 6, %(hogql_val_39)s)))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_37)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_38)s, %(hogql_val_39)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_40)s, 6, %(hogql_val_41)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)), person_arrays AS (SELECT c.conv_person_id AS person_id, c.conversions AS conversions, c.conversion_count AS conversion_count, t.touchpoints AS touchpointsFROM (@@ -179,7 +179,7 @@FROM cached_session_conversions) AS c LEFT JOIN (SELECT d.person_id AS person_id, arraySlice(arraySort(groupUniqArray(tuple(d.session_ts, d.session_dim))), -500) AS touchpointsFROM (- SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, toString(ifNull(cached_sessions.utm_campaign, %(hogql_val_40)s)) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_bound+ SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, toString(ifNull(cached_sessions.utm_campaign, %(hogql_val_42)s)) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_boundFROM resolved_cached_sessions AS cached_sessions INNER JOIN (SELECT cached_session_conversions.conv_person_id AS conv_person_id, cached_session_conversions.first_conversion AS first_conversion, cached_session_conversions.last_conversion AS last_conversionFROM cached_session_conversions) AS conv ON equals(cached_sessions.person_id, conv.conv_person_id)@@ -215,18 +215,18 @@WHERE and(equals(web_sessions_dimensional_preaggregated.team_id, 420), in(web_sessions_dimensional_preaggregated.job_id, tuple(%(hogql_val_13)s))) UNION ALLSELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priorityFROM (- SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_18)s)), `$start_timestamp`, %(hogql_val_19)s, toString(ifNull(`$entry_utm_source`, %(hogql_val_20)s)), %(hogql_val_21)s, %(hogql_val_22)s, %(hogql_val_23)s, %(hogql_val_24)s, %(hogql_val_25)s, %(hogql_val_26)s) AS dimensions, now64(6, %(hogql_val_27)s) AS computed_at, 1 AS source_priority+ SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_20)s)), `$start_timestamp`, %(hogql_val_21)s, toString(ifNull(`$entry_utm_source`, %(hogql_val_22)s)), %(hogql_val_23)s, %(hogql_val_24)s, %(hogql_val_25)s, %(hogql_val_26)s, %(hogql_val_27)s, %(hogql_val_28)s) AS dimensions, now64(6, %(hogql_val_29)s) AS computed_at, 1 AS source_priorityFROM (SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_14)s)) AS `$start_timestamp`, max(toTimeZone(raw_sessions.max_timestamp, %(hogql_val_15)s)) AS `$end_timestamp`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_16)s), %(hogql_val_17)s) AS `$entry_utm_source`, raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessions- WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1))), greater(raw_sessions.max_timestamp, plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800))))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, toDateTime64(minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1)), 6, %(hogql_val_18)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 6, %(hogql_val_19)s)))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))GROUP BY raw_sessions.session_id_v7HAVING and(greaterOrEquals(`$end_timestamp`, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(`$start_timestamp`, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')), or(less(`$start_timestamp`, toDateTime64('2022-12-27 00:00:00.000000', 6, 'UTC')), greater(`$end_timestamp`, plus(`$start_timestamp`, toIntervalSecond(259200)))))))) AS dGROUP BY d.session_id_v7)), identities AS (- SELECT toUInt128(toUUIDOrNull(events.properties.`$session_id`)) AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_28)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_29)s)) AS max_event_timestamp, count() AS pageview_count+ SELECT toUInt128(toUUIDOrNull(events.properties.`$session_id`)) AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_30)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_31)s)) AS max_event_timestamp, count() AS pageview_countFROM 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_idFROM person_distinct_id_overrides@@ -234,11 +234,11 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_30)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_32)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))GROUP BY session_id_v7, person_id)SELECT i.session_id_v7 AS session_id_v7, i.person_id AS person_id, toTimeZone(i.min_event_timestamp, %(hogql_val_0)s) AS min_event_timestamp, toTimeZone(i.max_event_timestamp, %(hogql_val_1)s) AS max_event_timestamp, i.pageview_count AS pageview_count, (d.latest).1 AS period_bucket, (d.latest).2 AS start_timestamp, (d.latest).3 AS channel_type, (d.latest).4 AS utm_source, (d.latest).5 AS utm_medium, (d.latest).6 AS utm_campaign, (d.latest).7 AS utm_term, (d.latest).8 AS utm_content, (d.latest).9 AS referring_domain, (d.latest).10 AS entry_pathname, toTimeZone(d.computed_at, %(hogql_val_2)s) AS computed_atFROM identities AS i INNER JOIN dimensions AS d ON equals(i.session_id_v7, d.session_id_v7)), cached_session_conversions AS MATERIALIZED (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_31)s)), coalesce(accurateCastOrNull(events.properties.revenue, 'Float64'), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_32)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_33)s))) AS last_conversion+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_33)s)), coalesce(accurateCastOrNull(events.properties.revenue, 'Float64'), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_34)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_35)s))) AS last_conversionFROM 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_idFROM person_distinct_id_overrides@@ -246,7 +246,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_34)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_35)s, %(hogql_val_36)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_37)s, 6, %(hogql_val_38)s)))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_36)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_37)s, %(hogql_val_38)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_39)s, 6, %(hogql_val_40)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)), person_arrays AS (SELECT c.conv_person_id AS person_id, c.conversions AS conversions, c.conversion_count AS conversion_count, t.touchpoints AS touchpointsFROM (@@ -254,7 +254,7 @@FROM cached_session_conversions) AS c LEFT JOIN (SELECT d.person_id AS person_id, arraySlice(arraySort(groupUniqArray(tuple(d.session_ts, d.session_dim))), -500) AS touchpointsFROM (- SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_39)s)), cached_sessions.utm_source, %(hogql_val_40)s)), [%(hogql_val_41)s, %(hogql_val_42)s, %(hogql_val_43)s]), %(hogql_val_44)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_45)s)), cached_sessions.utm_source, %(hogql_val_46)s)), [%(hogql_val_47)s, %(hogql_val_48)s, %(hogql_val_49)s, %(hogql_val_50)s, %(hogql_val_51)s, %(hogql_val_52)s, %(hogql_val_53)s, %(hogql_val_54)s]), %(hogql_val_55)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_56)s)), cached_sessions.utm_source, %(hogql_val_57)s)), [%(hogql_val_58)s]), %(hogql_val_59)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_60)s)), cached_sessions.utm_source, %(hogql_val_61)s)), [%(hogql_val_62)s, %(hogql_val_63)s, %(hogql_val_64)s, %(hogql_val_65)s, %(hogql_val_66)s, %(hogql_val_67)s, %(hogql_val_68)s, %(hogql_val_69)s, %(hogql_val_70)s]), %(hogql_val_71)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_72)s)), cached_sessions.utm_source, %(hogql_val_73)s)), [%(hogql_val_74)s]), %(hogql_val_75)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_76)s)), cached_sessions.utm_source, %(hogql_val_77)s)), [%(hogql_val_78)s, %(hogql_val_79)s]), %(hogql_val_80)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_81)s)), cached_sessions.utm_source, %(hogql_val_82)s)), [%(hogql_val_83)s, %(hogql_val_84)s, %(hogql_val_85)s]), %(hogql_val_86)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_87)s)), cached_sessions.utm_source, %(hogql_val_88)s)), [%(hogql_val_89)s]), %(hogql_val_90)s, if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_91)s)), cached_sessions.utm_source, %(hogql_val_92)s))))))))) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_bound+ SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_41)s)), cached_sessions.utm_source, %(hogql_val_42)s)), [%(hogql_val_43)s, %(hogql_val_44)s, %(hogql_val_45)s]), %(hogql_val_46)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_47)s)), cached_sessions.utm_source, %(hogql_val_48)s)), [%(hogql_val_49)s, %(hogql_val_50)s, %(hogql_val_51)s, %(hogql_val_52)s, %(hogql_val_53)s, %(hogql_val_54)s, %(hogql_val_55)s, %(hogql_val_56)s]), %(hogql_val_57)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_58)s)), cached_sessions.utm_source, %(hogql_val_59)s)), [%(hogql_val_60)s]), %(hogql_val_61)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_62)s)), cached_sessions.utm_source, %(hogql_val_63)s)), [%(hogql_val_64)s, %(hogql_val_65)s, %(hogql_val_66)s, %(hogql_val_67)s, %(hogql_val_68)s, %(hogql_val_69)s, %(hogql_val_70)s, %(hogql_val_71)s, %(hogql_val_72)s]), %(hogql_val_73)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_74)s)), cached_sessions.utm_source, %(hogql_val_75)s)), [%(hogql_val_76)s]), %(hogql_val_77)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_78)s)), cached_sessions.utm_source, %(hogql_val_79)s)), [%(hogql_val_80)s, %(hogql_val_81)s]), %(hogql_val_82)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_83)s)), cached_sessions.utm_source, %(hogql_val_84)s)), [%(hogql_val_85)s, %(hogql_val_86)s, %(hogql_val_87)s]), %(hogql_val_88)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_89)s)), cached_sessions.utm_source, %(hogql_val_90)s)), [%(hogql_val_91)s]), %(hogql_val_92)s, if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_93)s)), cached_sessions.utm_source, %(hogql_val_94)s))))))))) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_boundFROM resolved_cached_sessions AS cached_sessions INNER JOIN (SELECT cached_session_conversions.conv_person_id AS conv_person_id, cached_session_conversions.first_conversion AS first_conversion, cached_session_conversions.last_conversion AS last_conversionFROM cached_session_conversions) AS conv ON equals(cached_sessions.person_id, conv.conv_person_id)@@ -290,18 +290,18 @@WHERE and(equals(web_sessions_dimensional_preaggregated.team_id, 420), in(web_sessions_dimensional_preaggregated.job_id, tuple(%(hogql_val_13)s))) UNION ALLSELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priorityFROM (- SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_135)s)), `$start_timestamp`, if(notEmpty(ifNull(`$channel_type`, %(hogql_val_136)s)), `$channel_type`, %(hogql_val_137)s), %(hogql_val_138)s, %(hogql_val_139)s, %(hogql_val_140)s, %(hogql_val_141)s, %(hogql_val_142)s, %(hogql_val_143)s, %(hogql_val_144)s) AS dimensions, now64(6, %(hogql_val_145)s) AS computed_at, 1 AS source_priority+ SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_137)s)), `$start_timestamp`, if(notEmpty(ifNull(`$channel_type`, %(hogql_val_138)s)), `$channel_type`, %(hogql_val_139)s), %(hogql_val_140)s, %(hogql_val_141)s, %(hogql_val_142)s, %(hogql_val_143)s, %(hogql_val_144)s, %(hogql_val_145)s, %(hogql_val_146)s) AS dimensions, now64(6, %(hogql_val_147)s) AS computed_at, 1 AS source_priorityFROM (SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_14)s)) AS `$start_timestamp`, max(toTimeZone(raw_sessions.max_timestamp, %(hogql_val_15)s)) AS `$end_timestamp`, multiIf(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_16)s), %(hogql_val_17)s), %(hogql_val_18)s), %(hogql_val_19)s)), %(hogql_val_20)s), %(hogql_val_21)s, or(in(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_22)s), %(hogql_val_23)s), %(hogql_val_24)s), %(hogql_val_25)s)), tuple(%(hogql_val_26)s, %(hogql_val_27)s, %(hogql_val_28)s, %(hogql_val_29)s, %(hogql_val_30)s, %(hogql_val_31)s)), startsWith(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_32)s), %(hogql_val_33)s), %(hogql_val_34)s), %(hogql_val_35)s)), %(hogql_val_36)s), isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_gclid), %(hogql_val_37)s), %(hogql_val_38)s)), isNotNull(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_gad_source), %(hogql_val_39)s), %(hogql_val_40)s), %(hogql_val_41)s), %(hogql_val_42)s))), coalesce(coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_43)s), %(hogql_val_44)s), %(hogql_val_45)s), %(hogql_val_46)s)), ''), 'source')) , dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (cutToFirstSignificantSubdomain(coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_43)s), %(hogql_val_44)s), %(hogql_val_45)s), %(hogql_val_46)s)), '')), 'source'))), if(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_47)s), %(hogql_val_48)s), %(hogql_val_49)s), %(hogql_val_50)s)), %(hogql_val_51)s), %(hogql_val_52)s, NULL), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_53)s), %(hogql_val_54)s), %(hogql_val_55)s), %(hogql_val_56)s)), ''), 'medium')), coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_57)s), %(hogql_val_58)s), ''), 'source')) , dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (cutToFirstSignificantSubdomain(coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_57)s), %(hogql_val_58)s), '')), 'source'))), multiIf(ifNull(equals(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_gad_source), %(hogql_val_59)s), %(hogql_val_60)s), %(hogql_val_61)s), %(hogql_val_62)s), %(hogql_val_63)s), 0), %(hogql_val_64)s, match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_65)s), %(hogql_val_66)s), %(hogql_val_67)s), %(hogql_val_68)s)), %(hogql_val_69)s), %(hogql_val_70)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_71)s), %(hogql_val_72)s)), %(hogql_val_73)s, %(hogql_val_74)s)), and(ifNull(equals(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_75)s), %(hogql_val_76)s), %(hogql_val_77)s), 0), isNull(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_78)s), %(hogql_val_79)s), %(hogql_val_80)s), %(hogql_val_81)s))), or(isNull(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_82)s), %(hogql_val_83)s), %(hogql_val_84)s), %(hogql_val_85)s))), in(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_86)s), %(hogql_val_87)s), %(hogql_val_88)s), %(hogql_val_89)s)), tuple(%(hogql_val_90)s, %(hogql_val_91)s, %(hogql_val_92)s))), not(isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_93)s), %(hogql_val_94)s)))), %(hogql_val_95)s, coalesce(coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_96)s), %(hogql_val_97)s), %(hogql_val_98)s), %(hogql_val_99)s)), ''), 'source')), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (cutToFirstSignificantSubdomain(coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_96)s), %(hogql_val_97)s), %(hogql_val_98)s), %(hogql_val_99)s)), '')), 'source'))), if(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_100)s), %(hogql_val_101)s), %(hogql_val_102)s), %(hogql_val_103)s)), %(hogql_val_104)s), %(hogql_val_105)s, NULL), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_106)s), %(hogql_val_107)s), %(hogql_val_108)s), %(hogql_val_109)s)), ''), 'medium')), coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_110)s), %(hogql_val_111)s), ''), 'source')), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (cutToFirstSignificantSubdomain(coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_110)s), %(hogql_val_111)s), '')), 'source'))), multiIf(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_112)s), %(hogql_val_113)s), %(hogql_val_114)s), %(hogql_val_115)s)), %(hogql_val_116)s), %(hogql_val_117)s, match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_118)s), %(hogql_val_119)s), %(hogql_val_120)s), %(hogql_val_121)s)), %(hogql_val_122)s), %(hogql_val_123)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_124)s), %(hogql_val_125)s)), %(hogql_val_126)s, ifNull(equals(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_127)s), %(hogql_val_128)s), %(hogql_val_129)s), 0), %(hogql_val_130)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_131)s), %(hogql_val_132)s)), %(hogql_val_133)s, %(hogql_val_134)s))) AS `$channel_type`, raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessions- WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1))), greater(raw_sessions.max_timestamp, plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800))))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, toDateTime64(minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1)), 6, %(hogql_val_135)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 6, %(hogql_val_136)s)))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))GROUP BY raw_sessions.session_id_v7HAVING and(greaterOrEquals(`$end_timestamp`, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(`$start_timestamp`, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')), or(less(`$start_timestamp`, toDateTime64('2022-12-27 00:00:00.000000', 6, 'UTC')), greater(`$end_timestamp`, plus(`$start_timestamp`, toIntervalSecond(259200)))))))) AS dGROUP BY d.session_id_v7)), identities AS (- SELECT toUInt128(toUUIDOrNull(events.properties.`$session_id`)) AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_146)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_147)s)) AS max_event_timestamp, count() AS pageview_count+ SELECT toUInt128(toUUIDOrNull(events.properties.`$session_id`)) AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_148)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_149)s)) AS max_event_timestamp, count() AS pageview_countFROM 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_idFROM person_distinct_id_overrides@@ -309,11 +309,11 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_148)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_150)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))GROUP BY session_id_v7, person_id)SELECT i.session_id_v7 AS session_id_v7, i.person_id AS person_id, toTimeZone(i.min_event_timestamp, %(hogql_val_0)s) AS min_event_timestamp, toTimeZone(i.max_event_timestamp, %(hogql_val_1)s) AS max_event_timestamp, i.pageview_count AS pageview_count, (d.latest).1 AS period_bucket, (d.latest).2 AS start_timestamp, (d.latest).3 AS channel_type, (d.latest).4 AS utm_source, (d.latest).5 AS utm_medium, (d.latest).6 AS utm_campaign, (d.latest).7 AS utm_term, (d.latest).8 AS utm_content, (d.latest).9 AS referring_domain, (d.latest).10 AS entry_pathname, toTimeZone(d.computed_at, %(hogql_val_2)s) AS computed_atFROM identities AS i INNER JOIN dimensions AS d ON equals(i.session_id_v7, d.session_id_v7)), cached_session_conversions AS MATERIALIZED (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_149)s)), coalesce(accurateCastOrNull(events.properties.revenue, 'Float64'), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_150)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_151)s))) AS last_conversion+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_151)s)), coalesce(accurateCastOrNull(events.properties.revenue, 'Float64'), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_152)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_153)s))) AS last_conversionFROM 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_idFROM person_distinct_id_overrides@@ -321,7 +321,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_152)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_153)s, %(hogql_val_154)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_155)s, 6, %(hogql_val_156)s)))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_154)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_155)s, %(hogql_val_156)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_157)s, 6, %(hogql_val_158)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)), person_arrays AS (SELECT c.conv_person_id AS person_id, c.conversions AS conversions, c.conversion_count AS conversion_count, t.touchpoints AS touchpointsFROM (@@ -329,7 +329,7 @@FROM cached_session_conversions) AS c LEFT JOIN (SELECT d.person_id AS person_id, arraySlice(arraySort(groupUniqArray(tuple(d.session_ts, d.session_dim))), -500) AS touchpointsFROM (- SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, if(notEmpty(ifNull(cached_sessions.channel_type, %(hogql_val_157)s)), cached_sessions.channel_type, %(hogql_val_158)s) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_bound+ SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, if(notEmpty(ifNull(cached_sessions.channel_type, %(hogql_val_159)s)), cached_sessions.channel_type, %(hogql_val_160)s) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_boundFROM resolved_cached_sessions AS cached_sessions INNER JOIN (SELECT cached_session_conversions.conv_person_id AS conv_person_id, cached_session_conversions.first_conversion AS first_conversion, cached_session_conversions.last_conversion AS last_conversionFROM cached_session_conversions) AS conv ON equals(cached_sessions.person_id, conv.conv_person_id)diff --git a/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_attribution_table_query_runner.ambr b/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_attribution_table_query_runner.ambrindex 76cd5a584a11..b0915710a85e 100644--- a/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_attribution_table_query_runner.ambr+++ b/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_attribution_table_query_runner.ambr@@ -14,21 +14,21 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(minus(toDateTime(%(hogql_val_3)s, %(hogql_val_4)s), toIntervalSecond(345600)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_5)s, 6, %(hogql_val_6)s), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.`$session_id`, %(hogql_val_7)s)), events__session.session_id_v7)- WHERE and(equals(events.team_id, 420), and(equals(events.event, %(hogql_val_9)s), notEmpty(events.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_10)s, %(hogql_val_11)s), toIntervalSecond(345600))), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_12)s, 6, %(hogql_val_13)s)))+ WHERE and(equals(events.team_id, 420), and(equals(events.event, %(hogql_val_9)s), notEmpty(events.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_10)s, %(hogql_val_11)s), toIntervalSecond(345600)), 6, %(hogql_val_12)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_13)s, 6, %(hogql_val_14)s)))GROUP BY breakdown_value), person_arrays AS (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, arraySlice(arraySort(groupArrayIf(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_33)s)), coalesce(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_34)s), ''), 'null'), '^"|"$', ''), %(hogql_val_35)s), 0.0)), and(equals(events.event, %(hogql_val_36)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_37)s), toDateTime(%(hogql_val_38)s, %(hogql_val_39)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_40)s), toDateTime64(%(hogql_val_41)s, 6, %(hogql_val_42)s))))), -500) AS conversions, countIf(and(equals(events.event, %(hogql_val_43)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_44)s), toDateTime(%(hogql_val_45)s, %(hogql_val_46)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_47)s), toDateTime64(%(hogql_val_48)s, 6, %(hogql_val_49)s)))) AS conversion_count, arraySlice(arraySort(groupUniqArrayIf(tuple(toUnixTimestamp(events__session.`$start_timestamp`), toString(ifNull(events__session.`$entry_utm_campaign`, %(hogql_val_50)s))), and(and(equals(events.event, %(hogql_val_51)s), notEmpty(events.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), minus(conv_bounds.first_conversion, 345600)), lessOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), conv_bounds.last_conversion)))), -500) AS touchpoints+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, arraySlice(arraySort(groupArrayIf(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_34)s)), coalesce(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_35)s), ''), 'null'), '^"|"$', ''), %(hogql_val_36)s), 0.0)), and(equals(events.event, %(hogql_val_37)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_38)s), toDateTime(%(hogql_val_39)s, %(hogql_val_40)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_41)s), toDateTime64(%(hogql_val_42)s, 6, %(hogql_val_43)s))))), -500) AS conversions, countIf(and(equals(events.event, %(hogql_val_44)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_45)s), toDateTime(%(hogql_val_46)s, %(hogql_val_47)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_48)s), toDateTime64(%(hogql_val_49)s, 6, %(hogql_val_50)s)))) AS conversion_count, arraySlice(arraySort(groupUniqArrayIf(tuple(toUnixTimestamp(events__session.`$start_timestamp`), toString(ifNull(events__session.`$entry_utm_campaign`, %(hogql_val_51)s))), and(and(equals(events.event, %(hogql_val_52)s), notEmpty(events.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), minus(conv_bounds.first_conversion, 345600)), lessOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), conv_bounds.last_conversion)))), -500) AS touchpointsFROM events LEFT JOIN (- SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_14)s)) AS `$start_timestamp`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_15)s), %(hogql_val_16)s) AS `$entry_utm_campaign`, raw_sessions.session_id_v7 AS session_id_v7+ SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_15)s)) AS `$start_timestamp`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_16)s), %(hogql_val_17)s) AS `$entry_utm_campaign`, raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessions- WHERE and(equals(raw_sessions.team_id, 420), or(and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toDateTime(%(hogql_val_17)s, %(hogql_val_18)s), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_19)s, 6, %(hogql_val_20)s), toIntervalDay(3)))), and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(minus(toDateTime(%(hogql_val_21)s, %(hogql_val_22)s), toIntervalSecond(345600)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_23)s, 6, %(hogql_val_24)s), toIntervalDay(3))))))- GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.`$session_id`, %(hogql_val_25)s)), events__session.session_id_v7) LEFT OUTER JOIN (+ WHERE and(equals(raw_sessions.team_id, 420), or(and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toDateTime(%(hogql_val_18)s, %(hogql_val_19)s), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_20)s, 6, %(hogql_val_21)s), toIntervalDay(3)))), and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(minus(toDateTime(%(hogql_val_22)s, %(hogql_val_23)s), toIntervalSecond(345600)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_24)s, 6, %(hogql_val_25)s), toIntervalDay(3))))))+ GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.`$session_id`, %(hogql_val_26)s)), events__session.session_id_v7) 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_idFROM person_distinct_id_overridesWHERE equals(person_distinct_id_overrides.team_id, 420)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id) INNER JOIN (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_26)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_27)s))) AS last_conversion+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_27)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_28)s))) AS last_conversionFROM 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_idFROM person_distinct_id_overrides@@ -36,12 +36,12 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_28)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_29)s, %(hogql_val_30)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_31)s, 6, %(hogql_val_32)s)))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_29)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_30)s, %(hogql_val_31)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_32)s, 6, %(hogql_val_33)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS conv_bounds ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), conv_bounds.person_id)- WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_52)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_53)s, %(hogql_val_54)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_55)s, 6, %(hogql_val_56)s))), and(equals(events.event, %(hogql_val_57)s), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_58)s, %(hogql_val_59)s), toIntervalSecond(345600))), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_60)s, 6, %(hogql_val_61)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_62)s)), minus(conv_bounds.first_conversion, 345600)))))+ WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_53)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_54)s, %(hogql_val_55)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_56)s, 6, %(hogql_val_57)s))), and(equals(events.event, %(hogql_val_58)s), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_59)s, %(hogql_val_60)s), toIntervalSecond(345600)), 6, %(hogql_val_61)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_62)s, 6, %(hogql_val_63)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_64)s)), minus(conv_bounds.first_conversion, 345600)))))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)HAVING greater(length(conversions), 0)), per_conversion AS MATERIALIZED (- SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_63)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_64)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_65)s), 2.0), 1.0)))), touch_ts)))))) AS w_position+ SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_65)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_66)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_67)s), 2.0), 1.0)))), touch_ts)))))) AS w_positionFROM person_arrays ARRAY JOIN arrayEnumerate(person_arrays.conversions) AS i), per_touchpoint AS (SELECT per_conversion.person_id AS person_id, per_conversion.i AS i, per_conversion.conversion_value AS conversion_value, per_conversion.dims[k] AS breakdown_value, per_conversion.w_first[k] AS w_first, per_conversion.w_last[k] AS w_last, per_conversion.w_linear[k] AS w_linear, per_conversion.w_decay[k] AS w_decay, per_conversion.w_position[k] AS w_positionFROM per_conversion ARRAY JOIN arrayEnumerate(per_conversion.touch_ts) AS k), per_conversion_dim AS (@@ -51,7 +51,7 @@SELECT per_conversion_dim.breakdown_value AS breakdown_value, count() AS influenced_conversions, sum(per_conversion_dim.conv_value) AS influenced_value, sum(per_conversion_dim.w_first) AS w_first_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_first)) AS w_first_value, sum(per_conversion_dim.w_last) AS w_last_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_last)) AS w_last_value, sum(per_conversion_dim.w_linear) AS w_linear_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_linear)) AS w_linear_value, sum(per_conversion_dim.w_decay) AS w_decay_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_decay)) AS w_decay_value, sum(per_conversion_dim.w_position) AS w_position_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_position)) AS w_position_valueFROM per_conversion_dimGROUP BY per_conversion_dim.breakdown_value), attribution_rows AS (- SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_66)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_key+ SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_68)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_keyFROM attribution_totals FULL OUTER JOIN influenced_reach ON equals(attribution_totals.breakdown_value, influenced_reach.breakdown_value)), attribution_footer AS (SELECT sumIf(per_conversion.conversion_count, ifNull(equals(per_conversion.i, 1), 0)) AS total_conversions, countIf(ifNull(greater(length(per_conversion.tps), 0), 0)) AS attributed_conversions, 1 AS footer_keyFROM per_conversion)@@ -77,21 +77,21 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(minus(toDateTime(%(hogql_val_3)s, %(hogql_val_4)s), toIntervalSecond(345600)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_5)s, 6, %(hogql_val_6)s), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.`$session_id`, %(hogql_val_7)s)), events__session.session_id_v7)- WHERE and(equals(events.team_id, 420), and(equals(events.event, %(hogql_val_62)s), notEmpty(events.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_63)s, %(hogql_val_64)s), toIntervalSecond(345600))), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_65)s, 6, %(hogql_val_66)s)))+ WHERE and(equals(events.team_id, 420), and(equals(events.event, %(hogql_val_62)s), notEmpty(events.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_63)s, %(hogql_val_64)s), toIntervalSecond(345600)), 6, %(hogql_val_65)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_66)s, 6, %(hogql_val_67)s)))GROUP BY breakdown_value), person_arrays AS (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, arraySlice(arraySort(groupArrayIf(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_86)s)), coalesce(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_87)s), ''), 'null'), '^"|"$', ''), %(hogql_val_88)s), 0.0)), and(equals(events.event, %(hogql_val_89)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_90)s), toDateTime(%(hogql_val_91)s, %(hogql_val_92)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_93)s), toDateTime64(%(hogql_val_94)s, 6, %(hogql_val_95)s))))), -500) AS conversions, countIf(and(equals(events.event, %(hogql_val_96)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_97)s), toDateTime(%(hogql_val_98)s, %(hogql_val_99)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_100)s), toDateTime64(%(hogql_val_101)s, 6, %(hogql_val_102)s)))) AS conversion_count, arraySlice(arraySort(groupUniqArrayIf(tuple(toUnixTimestamp(events__session.`$start_timestamp`), if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_103)s)), events__session.`$entry_utm_source`, %(hogql_val_104)s)), [%(hogql_val_105)s, %(hogql_val_106)s, %(hogql_val_107)s]), %(hogql_val_108)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_109)s)), events__session.`$entry_utm_source`, %(hogql_val_110)s)), [%(hogql_val_111)s, %(hogql_val_112)s, %(hogql_val_113)s, %(hogql_val_114)s, %(hogql_val_115)s, %(hogql_val_116)s, %(hogql_val_117)s, %(hogql_val_118)s]), %(hogql_val_119)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_120)s)), events__session.`$entry_utm_source`, %(hogql_val_121)s)), [%(hogql_val_122)s]), %(hogql_val_123)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_124)s)), events__session.`$entry_utm_source`, %(hogql_val_125)s)), [%(hogql_val_126)s, %(hogql_val_127)s, %(hogql_val_128)s, %(hogql_val_129)s, %(hogql_val_130)s, %(hogql_val_131)s, %(hogql_val_132)s, %(hogql_val_133)s, %(hogql_val_134)s]), %(hogql_val_135)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_136)s)), events__session.`$entry_utm_source`, %(hogql_val_137)s)), [%(hogql_val_138)s]), %(hogql_val_139)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_140)s)), events__session.`$entry_utm_source`, %(hogql_val_141)s)), [%(hogql_val_142)s, %(hogql_val_143)s]), %(hogql_val_144)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_145)s)), events__session.`$entry_utm_source`, %(hogql_val_146)s)), [%(hogql_val_147)s, %(hogql_val_148)s, %(hogql_val_149)s]), %(hogql_val_150)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_151)s)), events__session.`$entry_utm_source`, %(hogql_val_152)s)), [%(hogql_val_153)s]), %(hogql_val_154)s, if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_155)s)), events__session.`$entry_utm_source`, %(hogql_val_156)s)))))))))), and(and(equals(events.event, %(hogql_val_157)s), notEmpty(events.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), minus(conv_bounds.first_conversion, 345600)), lessOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), conv_bounds.last_conversion)))), -500) AS touchpoints+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, arraySlice(arraySort(groupArrayIf(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_87)s)), coalesce(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_88)s), ''), 'null'), '^"|"$', ''), %(hogql_val_89)s), 0.0)), and(equals(events.event, %(hogql_val_90)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_91)s), toDateTime(%(hogql_val_92)s, %(hogql_val_93)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_94)s), toDateTime64(%(hogql_val_95)s, 6, %(hogql_val_96)s))))), -500) AS conversions, countIf(and(equals(events.event, %(hogql_val_97)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_98)s), toDateTime(%(hogql_val_99)s, %(hogql_val_100)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_101)s), toDateTime64(%(hogql_val_102)s, 6, %(hogql_val_103)s)))) AS conversion_count, arraySlice(arraySort(groupUniqArrayIf(tuple(toUnixTimestamp(events__session.`$start_timestamp`), if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_104)s)), events__session.`$entry_utm_source`, %(hogql_val_105)s)), [%(hogql_val_106)s, %(hogql_val_107)s, %(hogql_val_108)s]), %(hogql_val_109)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_110)s)), events__session.`$entry_utm_source`, %(hogql_val_111)s)), [%(hogql_val_112)s, %(hogql_val_113)s, %(hogql_val_114)s, %(hogql_val_115)s, %(hogql_val_116)s, %(hogql_val_117)s, %(hogql_val_118)s, %(hogql_val_119)s]), %(hogql_val_120)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_121)s)), events__session.`$entry_utm_source`, %(hogql_val_122)s)), [%(hogql_val_123)s]), %(hogql_val_124)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_125)s)), events__session.`$entry_utm_source`, %(hogql_val_126)s)), [%(hogql_val_127)s, %(hogql_val_128)s, %(hogql_val_129)s, %(hogql_val_130)s, %(hogql_val_131)s, %(hogql_val_132)s, %(hogql_val_133)s, %(hogql_val_134)s, %(hogql_val_135)s]), %(hogql_val_136)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_137)s)), events__session.`$entry_utm_source`, %(hogql_val_138)s)), [%(hogql_val_139)s]), %(hogql_val_140)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_141)s)), events__session.`$entry_utm_source`, %(hogql_val_142)s)), [%(hogql_val_143)s, %(hogql_val_144)s]), %(hogql_val_145)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_146)s)), events__session.`$entry_utm_source`, %(hogql_val_147)s)), [%(hogql_val_148)s, %(hogql_val_149)s, %(hogql_val_150)s]), %(hogql_val_151)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_152)s)), events__session.`$entry_utm_source`, %(hogql_val_153)s)), [%(hogql_val_154)s]), %(hogql_val_155)s, if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_156)s)), events__session.`$entry_utm_source`, %(hogql_val_157)s)))))))))), and(and(equals(events.event, %(hogql_val_158)s), notEmpty(events.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), minus(conv_bounds.first_conversion, 345600)), lessOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), conv_bounds.last_conversion)))), -500) AS touchpointsFROM events LEFT JOIN (- SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_67)s)) AS `$start_timestamp`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_68)s), %(hogql_val_69)s) AS `$entry_utm_source`, raw_sessions.session_id_v7 AS session_id_v7+ SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_68)s)) AS `$start_timestamp`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_69)s), %(hogql_val_70)s) AS `$entry_utm_source`, raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessions- WHERE and(equals(raw_sessions.team_id, 420), or(and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toDateTime(%(hogql_val_70)s, %(hogql_val_71)s), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_72)s, 6, %(hogql_val_73)s), toIntervalDay(3)))), and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(minus(toDateTime(%(hogql_val_74)s, %(hogql_val_75)s), toIntervalSecond(345600)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_76)s, 6, %(hogql_val_77)s), toIntervalDay(3))))))- GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.`$session_id`, %(hogql_val_78)s)), events__session.session_id_v7) LEFT OUTER JOIN (+ WHERE and(equals(raw_sessions.team_id, 420), or(and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toDateTime(%(hogql_val_71)s, %(hogql_val_72)s), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_73)s, 6, %(hogql_val_74)s), toIntervalDay(3)))), and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(minus(toDateTime(%(hogql_val_75)s, %(hogql_val_76)s), toIntervalSecond(345600)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_77)s, 6, %(hogql_val_78)s), toIntervalDay(3))))))+ GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.`$session_id`, %(hogql_val_79)s)), events__session.session_id_v7) 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_idFROM person_distinct_id_overridesWHERE equals(person_distinct_id_overrides.team_id, 420)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id) INNER JOIN (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_79)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_80)s))) AS last_conversion+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_80)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_81)s))) AS last_conversionFROM 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_idFROM person_distinct_id_overrides@@ -99,12 +99,12 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_81)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_82)s, %(hogql_val_83)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_84)s, 6, %(hogql_val_85)s)))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_82)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_83)s, %(hogql_val_84)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_85)s, 6, %(hogql_val_86)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS conv_bounds ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), conv_bounds.person_id)- WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_158)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_159)s, %(hogql_val_160)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_161)s, 6, %(hogql_val_162)s))), and(equals(events.event, %(hogql_val_163)s), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_164)s, %(hogql_val_165)s), toIntervalSecond(345600))), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_166)s, 6, %(hogql_val_167)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_168)s)), minus(conv_bounds.first_conversion, 345600)))))+ WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_159)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_160)s, %(hogql_val_161)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_162)s, 6, %(hogql_val_163)s))), and(equals(events.event, %(hogql_val_164)s), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_165)s, %(hogql_val_166)s), toIntervalSecond(345600)), 6, %(hogql_val_167)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_168)s, 6, %(hogql_val_169)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_170)s)), minus(conv_bounds.first_conversion, 345600)))))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)HAVING greater(length(conversions), 0)), per_conversion AS MATERIALIZED (- SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_169)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_170)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_171)s), 2.0), 1.0)))), touch_ts)))))) AS w_position+ SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_171)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_172)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_173)s), 2.0), 1.0)))), touch_ts)))))) AS w_positionFROM person_arrays ARRAY JOIN arrayEnumerate(person_arrays.conversions) AS i), per_touchpoint AS (SELECT per_conversion.person_id AS person_id, per_conversion.i AS i, per_conversion.conversion_value AS conversion_value, per_conversion.dims[k] AS breakdown_value, per_conversion.w_first[k] AS w_first, per_conversion.w_last[k] AS w_last, per_conversion.w_linear[k] AS w_linear, per_conversion.w_decay[k] AS w_decay, per_conversion.w_position[k] AS w_positionFROM per_conversion ARRAY JOIN arrayEnumerate(per_conversion.touch_ts) AS k), per_conversion_dim AS (@@ -114,7 +114,7 @@SELECT per_conversion_dim.breakdown_value AS breakdown_value, count() AS influenced_conversions, sum(per_conversion_dim.conv_value) AS influenced_value, sum(per_conversion_dim.w_first) AS w_first_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_first)) AS w_first_value, sum(per_conversion_dim.w_last) AS w_last_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_last)) AS w_last_value, sum(per_conversion_dim.w_linear) AS w_linear_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_linear)) AS w_linear_value, sum(per_conversion_dim.w_decay) AS w_decay_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_decay)) AS w_decay_value, sum(per_conversion_dim.w_position) AS w_position_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_position)) AS w_position_valueFROM per_conversion_dimGROUP BY per_conversion_dim.breakdown_value), attribution_rows AS (- SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_172)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_key+ SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_174)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_keyFROM attribution_totals FULL OUTER JOIN influenced_reach ON equals(attribution_totals.breakdown_value, influenced_reach.breakdown_value)), attribution_footer AS (SELECT sumIf(per_conversion.conversion_count, ifNull(equals(per_conversion.i, 1), 0)) AS total_conversions, countIf(ifNull(greater(length(per_conversion.tps), 0), 0)) AS attributed_conversions, 1 AS footer_keyFROM per_conversion)@@ -140,21 +140,21 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(minus(toDateTime(%(hogql_val_120)s, %(hogql_val_121)s), toIntervalSecond(345600)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_122)s, 6, %(hogql_val_123)s), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.`$session_id`, %(hogql_val_124)s)), events__session.session_id_v7)- WHERE and(equals(events.team_id, 420), and(equals(events.event, %(hogql_val_127)s), notEmpty(events.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_128)s, %(hogql_val_129)s), toIntervalSecond(345600))), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_130)s, 6, %(hogql_val_131)s)))+ WHERE and(equals(events.team_id, 420), and(equals(events.event, %(hogql_val_127)s), notEmpty(events.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_128)s, %(hogql_val_129)s), toIntervalSecond(345600)), 6, %(hogql_val_130)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_131)s, 6, %(hogql_val_132)s)))GROUP BY breakdown_value), person_arrays AS (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, arraySlice(arraySort(groupArrayIf(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_268)s)), coalesce(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_269)s), ''), 'null'), '^"|"$', ''), %(hogql_val_270)s), 0.0)), and(equals(events.event, %(hogql_val_271)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_272)s), toDateTime(%(hogql_val_273)s, %(hogql_val_274)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_275)s), toDateTime64(%(hogql_val_276)s, 6, %(hogql_val_277)s))))), -500) AS conversions, countIf(and(equals(events.event, %(hogql_val_278)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_279)s), toDateTime(%(hogql_val_280)s, %(hogql_val_281)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_282)s), toDateTime64(%(hogql_val_283)s, 6, %(hogql_val_284)s)))) AS conversion_count, arraySlice(arraySort(groupUniqArrayIf(tuple(toUnixTimestamp(events__session.`$start_timestamp`), if(notEmpty(ifNull(events__session.`$channel_type`, %(hogql_val_285)s)), events__session.`$channel_type`, %(hogql_val_286)s)), and(and(equals(events.event, %(hogql_val_287)s), notEmpty(events.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), minus(conv_bounds.first_conversion, 345600)), lessOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), conv_bounds.last_conversion)))), -500) AS touchpoints+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, arraySlice(arraySort(groupArrayIf(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_269)s)), coalesce(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_270)s), ''), 'null'), '^"|"$', ''), %(hogql_val_271)s), 0.0)), and(equals(events.event, %(hogql_val_272)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_273)s), toDateTime(%(hogql_val_274)s, %(hogql_val_275)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_276)s), toDateTime64(%(hogql_val_277)s, 6, %(hogql_val_278)s))))), -500) AS conversions, countIf(and(equals(events.event, %(hogql_val_279)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_280)s), toDateTime(%(hogql_val_281)s, %(hogql_val_282)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_283)s), toDateTime64(%(hogql_val_284)s, 6, %(hogql_val_285)s)))) AS conversion_count, arraySlice(arraySort(groupUniqArrayIf(tuple(toUnixTimestamp(events__session.`$start_timestamp`), if(notEmpty(ifNull(events__session.`$channel_type`, %(hogql_val_286)s)), events__session.`$channel_type`, %(hogql_val_287)s)), and(and(equals(events.event, %(hogql_val_288)s), notEmpty(events.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), minus(conv_bounds.first_conversion, 345600)), lessOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), conv_bounds.last_conversion)))), -500) AS touchpointsFROM events LEFT JOIN (- SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_132)s)) AS `$start_timestamp`, multiIf(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_133)s), %(hogql_val_134)s), %(hogql_val_135)s), %(hogql_val_136)s)), %(hogql_val_137)s), %(hogql_val_138)s, or(in(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_139)s), %(hogql_val_140)s), %(hogql_val_141)s), %(hogql_val_142)s)), tuple(%(hogql_val_143)s, %(hogql_val_144)s, %(hogql_val_145)s, %(hogql_val_146)s, %(hogql_val_147)s, %(hogql_val_148)s)), startsWith(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_149)s), %(hogql_val_150)s), %(hogql_val_151)s), %(hogql_val_152)s)), %(hogql_val_153)s), isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_gclid), %(hogql_val_154)s), %(hogql_val_155)s)), isNotNull(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_gad_source), %(hogql_val_156)s), %(hogql_val_157)s), %(hogql_val_158)s), %(hogql_val_159)s))), coalesce(coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_160)s), %(hogql_val_161)s), %(hogql_val_162)s), %(hogql_val_163)s)), ''), 'source')) , dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (cutToFirstSignificantSubdomain(coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_160)s), %(hogql_val_161)s), %(hogql_val_162)s), %(hogql_val_163)s)), '')), 'source'))), if(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_164)s), %(hogql_val_165)s), %(hogql_val_166)s), %(hogql_val_167)s)), %(hogql_val_168)s), %(hogql_val_169)s, NULL), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_170)s), %(hogql_val_171)s), %(hogql_val_172)s), %(hogql_val_173)s)), ''), 'medium')), coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_174)s), %(hogql_val_175)s), ''), 'source')) , dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (cutToFirstSignificantSubdomain(coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_174)s), %(hogql_val_175)s), '')), 'source'))), multiIf(ifNull(equals(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_gad_source), %(hogql_val_176)s), %(hogql_val_177)s), %(hogql_val_178)s), %(hogql_val_179)s), %(hogql_val_180)s), 0), %(hogql_val_181)s, match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_182)s), %(hogql_val_183)s), %(hogql_val_184)s), %(hogql_val_185)s)), %(hogql_val_186)s), %(hogql_val_187)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_188)s), %(hogql_val_189)s)), %(hogql_val_190)s, %(hogql_val_191)s)), and(ifNull(equals(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_192)s), %(hogql_val_193)s), %(hogql_val_194)s), 0), isNull(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_195)s), %(hogql_val_196)s), %(hogql_val_197)s), %(hogql_val_198)s))), or(isNull(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_199)s), %(hogql_val_200)s), %(hogql_val_201)s), %(hogql_val_202)s))), in(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_203)s), %(hogql_val_204)s), %(hogql_val_205)s), %(hogql_val_206)s)), tuple(%(hogql_val_207)s, %(hogql_val_208)s, %(hogql_val_209)s))), not(isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_210)s), %(hogql_val_211)s)))), %(hogql_val_212)s, coalesce(coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_213)s), %(hogql_val_214)s), %(hogql_val_215)s), %(hogql_val_216)s)), ''), 'source')), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (cutToFirstSignificantSubdomain(coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_213)s), %(hogql_val_214)s), %(hogql_val_215)s), %(hogql_val_216)s)), '')), 'source'))), if(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_217)s), %(hogql_val_218)s), %(hogql_val_219)s), %(hogql_val_220)s)), %(hogql_val_221)s), %(hogql_val_222)s, NULL), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_223)s), %(hogql_val_224)s), %(hogql_val_225)s), %(hogql_val_226)s)), ''), 'medium')), coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_227)s), %(hogql_val_228)s), ''), 'source')), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (cutToFirstSignificantSubdomain(coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_227)s), %(hogql_val_228)s), '')), 'source'))), multiIf(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_229)s), %(hogql_val_230)s), %(hogql_val_231)s), %(hogql_val_232)s)), %(hogql_val_233)s), %(hogql_val_234)s, match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_235)s), %(hogql_val_236)s), %(hogql_val_237)s), %(hogql_val_238)s)), %(hogql_val_239)s), %(hogql_val_240)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_241)s), %(hogql_val_242)s)), %(hogql_val_243)s, ifNull(equals(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_244)s), %(hogql_val_245)s), %(hogql_val_246)s), 0), %(hogql_val_247)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_248)s), %(hogql_val_249)s)), %(hogql_val_250)s, %(hogql_val_251)s))) AS `$channel_type`, raw_sessions.session_id_v7 AS session_id_v7+ SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_133)s)) AS `$start_timestamp`, multiIf(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_134)s), %(hogql_val_135)s), %(hogql_val_136)s), %(hogql_val_137)s)), %(hogql_val_138)s), %(hogql_val_139)s, or(in(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_140)s), %(hogql_val_141)s), %(hogql_val_142)s), %(hogql_val_143)s)), tuple(%(hogql_val_144)s, %(hogql_val_145)s, %(hogql_val_146)s, %(hogql_val_147)s, %(hogql_val_148)s, %(hogql_val_149)s)), startsWith(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_150)s), %(hogql_val_151)s), %(hogql_val_152)s), %(hogql_val_153)s)), %(hogql_val_154)s), isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_gclid), %(hogql_val_155)s), %(hogql_val_156)s)), isNotNull(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_gad_source), %(hogql_val_157)s), %(hogql_val_158)s), %(hogql_val_159)s), %(hogql_val_160)s))), coalesce(coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_161)s), %(hogql_val_162)s), %(hogql_val_163)s), %(hogql_val_164)s)), ''), 'source')) , dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (cutToFirstSignificantSubdomain(coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_161)s), %(hogql_val_162)s), %(hogql_val_163)s), %(hogql_val_164)s)), '')), 'source'))), if(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_165)s), %(hogql_val_166)s), %(hogql_val_167)s), %(hogql_val_168)s)), %(hogql_val_169)s), %(hogql_val_170)s, NULL), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_171)s), %(hogql_val_172)s), %(hogql_val_173)s), %(hogql_val_174)s)), ''), 'medium')), coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_175)s), %(hogql_val_176)s), ''), 'source')) , dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (cutToFirstSignificantSubdomain(coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_175)s), %(hogql_val_176)s), '')), 'source'))), multiIf(ifNull(equals(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_gad_source), %(hogql_val_177)s), %(hogql_val_178)s), %(hogql_val_179)s), %(hogql_val_180)s), %(hogql_val_181)s), 0), %(hogql_val_182)s, match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_183)s), %(hogql_val_184)s), %(hogql_val_185)s), %(hogql_val_186)s)), %(hogql_val_187)s), %(hogql_val_188)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_189)s), %(hogql_val_190)s)), %(hogql_val_191)s, %(hogql_val_192)s)), and(ifNull(equals(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_193)s), %(hogql_val_194)s), %(hogql_val_195)s), 0), isNull(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_196)s), %(hogql_val_197)s), %(hogql_val_198)s), %(hogql_val_199)s))), or(isNull(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_200)s), %(hogql_val_201)s), %(hogql_val_202)s), %(hogql_val_203)s))), in(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_204)s), %(hogql_val_205)s), %(hogql_val_206)s), %(hogql_val_207)s)), tuple(%(hogql_val_208)s, %(hogql_val_209)s, %(hogql_val_210)s))), not(isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_211)s), %(hogql_val_212)s)))), %(hogql_val_213)s, coalesce(coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_214)s), %(hogql_val_215)s), %(hogql_val_216)s), %(hogql_val_217)s)), ''), 'source')), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (cutToFirstSignificantSubdomain(coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_214)s), %(hogql_val_215)s), %(hogql_val_216)s), %(hogql_val_217)s)), '')), 'source'))), if(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_218)s), %(hogql_val_219)s), %(hogql_val_220)s), %(hogql_val_221)s)), %(hogql_val_222)s), %(hogql_val_223)s, NULL), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_224)s), %(hogql_val_225)s), %(hogql_val_226)s), %(hogql_val_227)s)), ''), 'medium')), coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_228)s), %(hogql_val_229)s), ''), 'source')), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (cutToFirstSignificantSubdomain(coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_228)s), %(hogql_val_229)s), '')), 'source'))), multiIf(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_230)s), %(hogql_val_231)s), %(hogql_val_232)s), %(hogql_val_233)s)), %(hogql_val_234)s), %(hogql_val_235)s, match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_236)s), %(hogql_val_237)s), %(hogql_val_238)s), %(hogql_val_239)s)), %(hogql_val_240)s), %(hogql_val_241)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_242)s), %(hogql_val_243)s)), %(hogql_val_244)s, ifNull(equals(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_245)s), %(hogql_val_246)s), %(hogql_val_247)s), 0), %(hogql_val_248)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_249)s), %(hogql_val_250)s)), %(hogql_val_251)s, %(hogql_val_252)s))) AS `$channel_type`, raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessions- WHERE and(equals(raw_sessions.team_id, 420), or(and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toDateTime(%(hogql_val_252)s, %(hogql_val_253)s), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_254)s, 6, %(hogql_val_255)s), toIntervalDay(3)))), and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(minus(toDateTime(%(hogql_val_256)s, %(hogql_val_257)s), toIntervalSecond(345600)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_258)s, 6, %(hogql_val_259)s), toIntervalDay(3))))))- GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.`$session_id`, %(hogql_val_260)s)), events__session.session_id_v7) LEFT OUTER JOIN (+ WHERE and(equals(raw_sessions.team_id, 420), or(and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toDateTime(%(hogql_val_253)s, %(hogql_val_254)s), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_255)s, 6, %(hogql_val_256)s), toIntervalDay(3)))), and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(minus(toDateTime(%(hogql_val_257)s, %(hogql_val_258)s), toIntervalSecond(345600)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_259)s, 6, %(hogql_val_260)s), toIntervalDay(3))))))+ GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.`$session_id`, %(hogql_val_261)s)), events__session.session_id_v7) 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_idFROM person_distinct_id_overridesWHERE equals(person_distinct_id_overrides.team_id, 420)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id) INNER JOIN (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_261)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_262)s))) AS last_conversion+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_262)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_263)s))) AS last_conversionFROM 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_idFROM person_distinct_id_overrides@@ -162,12 +162,12 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_263)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_264)s, %(hogql_val_265)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_266)s, 6, %(hogql_val_267)s)))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_264)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_265)s, %(hogql_val_266)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_267)s, 6, %(hogql_val_268)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS conv_bounds ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), conv_bounds.person_id)- WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_288)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_289)s, %(hogql_val_290)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_291)s, 6, %(hogql_val_292)s))), and(equals(events.event, %(hogql_val_293)s), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_294)s, %(hogql_val_295)s), toIntervalSecond(345600))), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_296)s, 6, %(hogql_val_297)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_298)s)), minus(conv_bounds.first_conversion, 345600)))))+ WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_289)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_290)s, %(hogql_val_291)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_292)s, 6, %(hogql_val_293)s))), and(equals(events.event, %(hogql_val_294)s), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_295)s, %(hogql_val_296)s), toIntervalSecond(345600)), 6, %(hogql_val_297)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_298)s, 6, %(hogql_val_299)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_300)s)), minus(conv_bounds.first_conversion, 345600)))))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)HAVING greater(length(conversions), 0)), per_conversion AS MATERIALIZED (- SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_299)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_300)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_301)s), 2.0), 1.0)))), touch_ts)))))) AS w_position+ SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_301)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_302)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_303)s), 2.0), 1.0)))), touch_ts)))))) AS w_positionFROM person_arrays ARRAY JOIN arrayEnumerate(person_arrays.conversions) AS i), per_touchpoint AS (SELECT per_conversion.person_id AS person_id, per_conversion.i AS i, per_conversion.conversion_value AS conversion_value, per_conversion.dims[k] AS breakdown_value, per_conversion.w_first[k] AS w_first, per_conversion.w_last[k] AS w_last, per_conversion.w_linear[k] AS w_linear, per_conversion.w_decay[k] AS w_decay, per_conversion.w_position[k] AS w_positionFROM per_conversion ARRAY JOIN arrayEnumerate(per_conversion.touch_ts) AS k), per_conversion_dim AS (@@ -177,7 +177,7 @@SELECT per_conversion_dim.breakdown_value AS breakdown_value, count() AS influenced_conversions, sum(per_conversion_dim.conv_value) AS influenced_value, sum(per_conversion_dim.w_first) AS w_first_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_first)) AS w_first_value, sum(per_conversion_dim.w_last) AS w_last_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_last)) AS w_last_value, sum(per_conversion_dim.w_linear) AS w_linear_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_linear)) AS w_linear_value, sum(per_conversion_dim.w_decay) AS w_decay_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_decay)) AS w_decay_value, sum(per_conversion_dim.w_position) AS w_position_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_position)) AS w_position_valueFROM per_conversion_dimGROUP BY per_conversion_dim.breakdown_value), attribution_rows AS (- SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_302)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_key+ SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_304)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_keyFROM attribution_totals FULL OUTER JOIN influenced_reach ON equals(attribution_totals.breakdown_value, influenced_reach.breakdown_value)), attribution_footer AS (SELECT sumIf(per_conversion.conversion_count, ifNull(equals(per_conversion.i, 1), 0)) AS total_conversions, countIf(ifNull(greater(length(per_conversion.tps), 0), 0)) AS attributed_conversions, 1 AS footer_keyFROM per_conversion)@@ -200,18 +200,18 @@WHERE and(equals(web_sessions_dimensional_preaggregated.team_id, 420), in(web_sessions_dimensional_preaggregated.job_id, tuple(%(hogql_val_12)s))) UNION ALLSELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priorityFROM (- SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_19)s)), `$start_timestamp`, %(hogql_val_20)s, toString(ifNull(`$entry_utm_source`, %(hogql_val_21)s)), %(hogql_val_22)s, toString(ifNull(`$entry_utm_campaign`, %(hogql_val_23)s)), %(hogql_val_24)s, %(hogql_val_25)s, %(hogql_val_26)s, %(hogql_val_27)s) AS dimensions, now64(6, %(hogql_val_28)s) AS computed_at, 1 AS source_priority+ SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_21)s)), `$start_timestamp`, %(hogql_val_22)s, toString(ifNull(`$entry_utm_source`, %(hogql_val_23)s)), %(hogql_val_24)s, toString(ifNull(`$entry_utm_campaign`, %(hogql_val_25)s)), %(hogql_val_26)s, %(hogql_val_27)s, %(hogql_val_28)s, %(hogql_val_29)s) AS dimensions, now64(6, %(hogql_val_30)s) AS computed_at, 1 AS source_priorityFROM (SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_13)s)) AS `$start_timestamp`, max(toTimeZone(raw_sessions.max_timestamp, %(hogql_val_14)s)) AS `$end_timestamp`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_15)s), %(hogql_val_16)s) AS `$entry_utm_source`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_17)s), %(hogql_val_18)s) AS `$entry_utm_campaign`, raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessions- WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1))), greater(raw_sessions.max_timestamp, plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800))))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, toDateTime64(minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1)), 6, %(hogql_val_19)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 6, %(hogql_val_20)s)))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))GROUP BY raw_sessions.session_id_v7HAVING and(greaterOrEquals(`$end_timestamp`, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(`$start_timestamp`, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')), or(less(`$start_timestamp`, toDateTime64('2022-12-27 00:00:00.000000', 6, 'UTC')), greater(`$end_timestamp`, plus(`$start_timestamp`, toIntervalSecond(259200)))))))) AS dGROUP BY d.session_id_v7)), identities AS (- SELECT events.`$session_id_uuid` AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_29)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_30)s)) AS max_event_timestamp, count() AS pageview_count+ SELECT events.`$session_id_uuid` AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_31)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_32)s)) AS max_event_timestamp, count() AS pageview_countFROM 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_idFROM person_distinct_id_overrides@@ -219,11 +219,11 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_31)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_33)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))GROUP BY session_id_v7, person_id)SELECT i.session_id_v7 AS session_id_v7, i.person_id AS person_id, toTimeZone(i.min_event_timestamp, %(hogql_val_0)s) AS min_event_timestamp, toTimeZone(i.max_event_timestamp, %(hogql_val_1)s) AS max_event_timestamp, i.pageview_count AS pageview_count, (d.latest).1 AS period_bucket, (d.latest).2 AS start_timestamp, (d.latest).3 AS channel_type, (d.latest).4 AS utm_source, (d.latest).5 AS utm_medium, (d.latest).6 AS utm_campaign, (d.latest).7 AS utm_term, (d.latest).8 AS utm_content, (d.latest).9 AS referring_domain, (d.latest).10 AS entry_pathname, toTimeZone(d.computed_at, %(hogql_val_2)s) AS computed_atFROM identities AS i INNER JOIN dimensions AS d ON equals(i.session_id_v7, d.session_id_v7)), cached_session_conversions AS MATERIALIZED (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_32)s)), coalesce(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_33)s), ''), 'null'), '^"|"$', ''), %(hogql_val_34)s), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_35)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_36)s))) AS last_conversion+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_34)s)), coalesce(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_35)s), ''), 'null'), '^"|"$', ''), %(hogql_val_36)s), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_37)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_38)s))) AS last_conversionFROM 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_idFROM person_distinct_id_overrides@@ -231,11 +231,11 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_37)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_38)s, %(hogql_val_39)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_40)s, 6, %(hogql_val_41)s)))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_39)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_40)s, %(hogql_val_41)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_42)s, 6, %(hogql_val_43)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)), influenced_reach AS (SELECT s.breakdown_value AS breakdown_value, uniq(s.person_id) AS visitorsFROM (- SELECT cached_sessions.person_id AS person_id, toString(ifNull(cached_sessions.utm_campaign, %(hogql_val_42)s)) AS breakdown_value+ SELECT cached_sessions.person_id AS person_id, toString(ifNull(cached_sessions.utm_campaign, %(hogql_val_44)s)) AS breakdown_valueFROM resolved_cached_sessions AS cached_sessionsWHERE and(greaterOrEquals(cached_sessions.max_event_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(cached_sessions.min_event_timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))) AS sGROUP BY s.breakdown_value), person_arrays AS (@@ -245,7 +245,7 @@FROM cached_session_conversions) AS c LEFT JOIN (SELECT d.person_id AS person_id, arraySlice(arraySort(groupUniqArray(tuple(d.session_ts, d.session_dim))), -500) AS touchpointsFROM (- SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, toString(ifNull(cached_sessions.utm_campaign, %(hogql_val_43)s)) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_bound+ SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, toString(ifNull(cached_sessions.utm_campaign, %(hogql_val_45)s)) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_boundFROM resolved_cached_sessions AS cached_sessions INNER JOIN (SELECT cached_session_conversions.conv_person_id AS conv_person_id, cached_session_conversions.first_conversion AS first_conversion, cached_session_conversions.last_conversion AS last_conversionFROM cached_session_conversions) AS conv ON equals(cached_sessions.person_id, conv.conv_person_id)@@ -253,7 +253,7 @@WHERE and(ifNull(greaterOrEquals(d.session_ts, minus(d.first_conversion, 345600)), 0), ifNull(lessOrEquals(d.session_ts, d.upper_bound), 0))GROUP BY d.person_id) AS t ON equals(c.conv_person_id, t.person_id)WHERE ifNull(greater(length(c.conversions), 0), 0)), per_conversion AS MATERIALIZED (- SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_44)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_45)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_46)s), 2.0), 1.0)))), touch_ts)))))) AS w_position+ SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_46)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_47)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_48)s), 2.0), 1.0)))), touch_ts)))))) AS w_positionFROM person_arrays ARRAY JOIN arrayEnumerate(person_arrays.conversions) AS i), per_touchpoint AS (SELECT per_conversion.person_id AS person_id, per_conversion.i AS i, per_conversion.conversion_value AS conversion_value, per_conversion.dims[k] AS breakdown_value, per_conversion.w_first[k] AS w_first, per_conversion.w_last[k] AS w_last, per_conversion.w_linear[k] AS w_linear, per_conversion.w_decay[k] AS w_decay, per_conversion.w_position[k] AS w_positionFROM per_conversion ARRAY JOIN arrayEnumerate(per_conversion.touch_ts) AS k), per_conversion_dim AS (@@ -263,7 +263,7 @@SELECT per_conversion_dim.breakdown_value AS breakdown_value, count() AS influenced_conversions, sum(per_conversion_dim.conv_value) AS influenced_value, sum(per_conversion_dim.w_first) AS w_first_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_first)) AS w_first_value, sum(per_conversion_dim.w_last) AS w_last_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_last)) AS w_last_value, sum(per_conversion_dim.w_linear) AS w_linear_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_linear)) AS w_linear_value, sum(per_conversion_dim.w_decay) AS w_decay_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_decay)) AS w_decay_value, sum(per_conversion_dim.w_position) AS w_position_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_position)) AS w_position_valueFROM per_conversion_dimGROUP BY per_conversion_dim.breakdown_value), attribution_rows AS (- SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_47)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_key+ SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_49)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_keyFROM attribution_totals FULL OUTER JOIN influenced_reach ON equals(attribution_totals.breakdown_value, influenced_reach.breakdown_value)), attribution_footer AS (SELECT sumIf(per_conversion.conversion_count, ifNull(equals(per_conversion.i, 1), 0)) AS total_conversions, countIf(ifNull(greater(length(per_conversion.tps), 0), 0)) AS attributed_conversions, 1 AS footer_keyFROM per_conversion)@@ -287,18 +287,18 @@WHERE and(equals(web_sessions_dimensional_preaggregated.team_id, 420), in(web_sessions_dimensional_preaggregated.job_id, tuple(%(hogql_val_13)s))) UNION ALLSELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priorityFROM (- SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_18)s)), `$start_timestamp`, %(hogql_val_19)s, toString(ifNull(`$entry_utm_source`, %(hogql_val_20)s)), %(hogql_val_21)s, %(hogql_val_22)s, %(hogql_val_23)s, %(hogql_val_24)s, %(hogql_val_25)s, %(hogql_val_26)s) AS dimensions, now64(6, %(hogql_val_27)s) AS computed_at, 1 AS source_priority+ SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_20)s)), `$start_timestamp`, %(hogql_val_21)s, toString(ifNull(`$entry_utm_source`, %(hogql_val_22)s)), %(hogql_val_23)s, %(hogql_val_24)s, %(hogql_val_25)s, %(hogql_val_26)s, %(hogql_val_27)s, %(hogql_val_28)s) AS dimensions, now64(6, %(hogql_val_29)s) AS computed_at, 1 AS source_priorityFROM (SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_14)s)) AS `$start_timestamp`, max(toTimeZone(raw_sessions.max_timestamp, %(hogql_val_15)s)) AS `$end_timestamp`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_16)s), %(hogql_val_17)s) AS `$entry_utm_source`, raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessions- WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1))), greater(raw_sessions.max_timestamp, plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800))))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, toDateTime64(minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1)), 6, %(hogql_val_18)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 6, %(hogql_val_19)s)))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))GROUP BY raw_sessions.session_id_v7HAVING and(greaterOrEquals(`$end_timestamp`, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(`$start_timestamp`, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')), or(less(`$start_timestamp`, toDateTime64('2022-12-27 00:00:00.000000', 6, 'UTC')), greater(`$end_timestamp`, plus(`$start_timestamp`, toIntervalSecond(259200)))))))) AS dGROUP BY d.session_id_v7)), identities AS (- SELECT events.`$session_id_uuid` AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_28)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_29)s)) AS max_event_timestamp, count() AS pageview_count+ SELECT events.`$session_id_uuid` AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_30)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_31)s)) AS max_event_timestamp, count() AS pageview_countFROM 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_idFROM person_distinct_id_overrides@@ -306,11 +306,11 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_30)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_32)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))GROUP BY session_id_v7, person_id)SELECT i.session_id_v7 AS session_id_v7, i.person_id AS person_id, toTimeZone(i.min_event_timestamp, %(hogql_val_0)s) AS min_event_timestamp, toTimeZone(i.max_event_timestamp, %(hogql_val_1)s) AS max_event_timestamp, i.pageview_count AS pageview_count, (d.latest).1 AS period_bucket, (d.latest).2 AS start_timestamp, (d.latest).3 AS channel_type, (d.latest).4 AS utm_source, (d.latest).5 AS utm_medium, (d.latest).6 AS utm_campaign, (d.latest).7 AS utm_term, (d.latest).8 AS utm_content, (d.latest).9 AS referring_domain, (d.latest).10 AS entry_pathname, toTimeZone(d.computed_at, %(hogql_val_2)s) AS computed_atFROM identities AS i INNER JOIN dimensions AS d ON equals(i.session_id_v7, d.session_id_v7)), cached_session_conversions AS MATERIALIZED (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_31)s)), coalesce(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_32)s), ''), 'null'), '^"|"$', ''), %(hogql_val_33)s), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_34)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_35)s))) AS last_conversion+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_33)s)), coalesce(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_34)s), ''), 'null'), '^"|"$', ''), %(hogql_val_35)s), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_36)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_37)s))) AS last_conversionFROM 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_idFROM person_distinct_id_overrides@@ -318,11 +318,11 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_36)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_37)s, %(hogql_val_38)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_39)s, 6, %(hogql_val_40)s)))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_38)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_39)s, %(hogql_val_40)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_41)s, 6, %(hogql_val_42)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)), influenced_reach AS (SELECT s.breakdown_value AS breakdown_value, uniq(s.person_id) AS visitorsFROM (- SELECT cached_sessions.person_id AS person_id, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_41)s)), cached_sessions.utm_source, %(hogql_val_42)s)), [%(hogql_val_43)s, %(hogql_val_44)s, %(hogql_val_45)s]), %(hogql_val_46)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_47)s)), cached_sessions.utm_source, %(hogql_val_48)s)), [%(hogql_val_49)s, %(hogql_val_50)s, %(hogql_val_51)s, %(hogql_val_52)s, %(hogql_val_53)s, %(hogql_val_54)s, %(hogql_val_55)s, %(hogql_val_56)s]), %(hogql_val_57)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_58)s)), cached_sessions.utm_source, %(hogql_val_59)s)), [%(hogql_val_60)s]), %(hogql_val_61)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_62)s)), cached_sessions.utm_source, %(hogql_val_63)s)), [%(hogql_val_64)s, %(hogql_val_65)s, %(hogql_val_66)s, %(hogql_val_67)s, %(hogql_val_68)s, %(hogql_val_69)s, %(hogql_val_70)s, %(hogql_val_71)s, %(hogql_val_72)s]), %(hogql_val_73)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_74)s)), cached_sessions.utm_source, %(hogql_val_75)s)), [%(hogql_val_76)s]), %(hogql_val_77)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_78)s)), cached_sessions.utm_source, %(hogql_val_79)s)), [%(hogql_val_80)s, %(hogql_val_81)s]), %(hogql_val_82)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_83)s)), cached_sessions.utm_source, %(hogql_val_84)s)), [%(hogql_val_85)s, %(hogql_val_86)s, %(hogql_val_87)s]), %(hogql_val_88)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_89)s)), cached_sessions.utm_source, %(hogql_val_90)s)), [%(hogql_val_91)s]), %(hogql_val_92)s, if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_93)s)), cached_sessions.utm_source, %(hogql_val_94)s))))))))) AS breakdown_value+ SELECT cached_sessions.person_id AS person_id, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_43)s)), cached_sessions.utm_source, %(hogql_val_44)s)), [%(hogql_val_45)s, %(hogql_val_46)s, %(hogql_val_47)s]), %(hogql_val_48)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_49)s)), cached_sessions.utm_source, %(hogql_val_50)s)), [%(hogql_val_51)s, %(hogql_val_52)s, %(hogql_val_53)s, %(hogql_val_54)s, %(hogql_val_55)s, %(hogql_val_56)s, %(hogql_val_57)s, %(hogql_val_58)s]), %(hogql_val_59)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_60)s)), cached_sessions.utm_source, %(hogql_val_61)s)), [%(hogql_val_62)s]), %(hogql_val_63)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_64)s)), cached_sessions.utm_source, %(hogql_val_65)s)), [%(hogql_val_66)s, %(hogql_val_67)s, %(hogql_val_68)s, %(hogql_val_69)s, %(hogql_val_70)s, %(hogql_val_71)s, %(hogql_val_72)s, %(hogql_val_73)s, %(hogql_val_74)s]), %(hogql_val_75)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_76)s)), cached_sessions.utm_source, %(hogql_val_77)s)), [%(hogql_val_78)s]), %(hogql_val_79)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_80)s)), cached_sessions.utm_source, %(hogql_val_81)s)), [%(hogql_val_82)s, %(hogql_val_83)s]), %(hogql_val_84)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_85)s)), cached_sessions.utm_source, %(hogql_val_86)s)), [%(hogql_val_87)s, %(hogql_val_88)s, %(hogql_val_89)s]), %(hogql_val_90)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_91)s)), cached_sessions.utm_source, %(hogql_val_92)s)), [%(hogql_val_93)s]), %(hogql_val_94)s, if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_95)s)), cached_sessions.utm_source, %(hogql_val_96)s))))))))) AS breakdown_valueFROM resolved_cached_sessions AS cached_sessionsWHERE and(greaterOrEquals(cached_sessions.max_event_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(cached_sessions.min_event_timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))) AS sGROUP BY s.breakdown_value), person_arrays AS (@@ -332,7 +332,7 @@FROM cached_session_conversions) AS c LEFT JOIN (SELECT d.person_id AS person_id, arraySlice(arraySort(groupUniqArray(tuple(d.session_ts, d.session_dim))), -500) AS touchpointsFROM (- SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_95)s)), cached_sessions.utm_source, %(hogql_val_96)s)), [%(hogql_val_97)s, %(hogql_val_98)s, %(hogql_val_99)s]), %(hogql_val_100)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_101)s)), cached_sessions.utm_source, %(hogql_val_102)s)), [%(hogql_val_103)s, %(hogql_val_104)s, %(hogql_val_105)s, %(hogql_val_106)s, %(hogql_val_107)s, %(hogql_val_108)s, %(hogql_val_109)s, %(hogql_val_110)s]), %(hogql_val_111)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_112)s)), cached_sessions.utm_source, %(hogql_val_113)s)), [%(hogql_val_114)s]), %(hogql_val_115)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_116)s)), cached_sessions.utm_source, %(hogql_val_117)s)), [%(hogql_val_118)s, %(hogql_val_119)s, %(hogql_val_120)s, %(hogql_val_121)s, %(hogql_val_122)s, %(hogql_val_123)s, %(hogql_val_124)s, %(hogql_val_125)s, %(hogql_val_126)s]), %(hogql_val_127)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_128)s)), cached_sessions.utm_source, %(hogql_val_129)s)), [%(hogql_val_130)s]), %(hogql_val_131)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_132)s)), cached_sessions.utm_source, %(hogql_val_133)s)), [%(hogql_val_134)s, %(hogql_val_135)s]), %(hogql_val_136)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_137)s)), cached_sessions.utm_source, %(hogql_val_138)s)), [%(hogql_val_139)s, %(hogql_val_140)s, %(hogql_val_141)s]), %(hogql_val_142)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_143)s)), cached_sessions.utm_source, %(hogql_val_144)s)), [%(hogql_val_145)s]), %(hogql_val_146)s, if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_147)s)), cached_sessions.utm_source, %(hogql_val_148)s))))))))) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_bound+ SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_97)s)), cached_sessions.utm_source, %(hogql_val_98)s)), [%(hogql_val_99)s, %(hogql_val_100)s, %(hogql_val_101)s]), %(hogql_val_102)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_103)s)), cached_sessions.utm_source, %(hogql_val_104)s)), [%(hogql_val_105)s, %(hogql_val_106)s, %(hogql_val_107)s, %(hogql_val_108)s, %(hogql_val_109)s, %(hogql_val_110)s, %(hogql_val_111)s, %(hogql_val_112)s]), %(hogql_val_113)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_114)s)), cached_sessions.utm_source, %(hogql_val_115)s)), [%(hogql_val_116)s]), %(hogql_val_117)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_118)s)), cached_sessions.utm_source, %(hogql_val_119)s)), [%(hogql_val_120)s, %(hogql_val_121)s, %(hogql_val_122)s, %(hogql_val_123)s, %(hogql_val_124)s, %(hogql_val_125)s, %(hogql_val_126)s, %(hogql_val_127)s, %(hogql_val_128)s]), %(hogql_val_129)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_130)s)), cached_sessions.utm_source, %(hogql_val_131)s)), [%(hogql_val_132)s]), %(hogql_val_133)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_134)s)), cached_sessions.utm_source, %(hogql_val_135)s)), [%(hogql_val_136)s, %(hogql_val_137)s]), %(hogql_val_138)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_139)s)), cached_sessions.utm_source, %(hogql_val_140)s)), [%(hogql_val_141)s, %(hogql_val_142)s, %(hogql_val_143)s]), %(hogql_val_144)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_145)s)), cached_sessions.utm_source, %(hogql_val_146)s)), [%(hogql_val_147)s]), %(hogql_val_148)s, if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_149)s)), cached_sessions.utm_source, %(hogql_val_150)s))))))))) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_boundFROM resolved_cached_sessions AS cached_sessions INNER JOIN (SELECT cached_session_conversions.conv_person_id AS conv_person_id, cached_session_conversions.first_conversion AS first_conversion, cached_session_conversions.last_conversion AS last_conversionFROM cached_session_conversions) AS conv ON equals(cached_sessions.person_id, conv.conv_person_id)@@ -340,7 +340,7 @@WHERE and(ifNull(greaterOrEquals(d.session_ts, minus(d.first_conversion, 345600)), 0), ifNull(lessOrEquals(d.session_ts, d.upper_bound), 0))GROUP BY d.person_id) AS t ON equals(c.conv_person_id, t.person_id)WHERE ifNull(greater(length(c.conversions), 0), 0)), per_conversion AS MATERIALIZED (- SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_149)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_150)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_151)s), 2.0), 1.0)))), touch_ts)))))) AS w_position+ SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_151)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_152)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_153)s), 2.0), 1.0)))), touch_ts)))))) AS w_positionFROM person_arrays ARRAY JOIN arrayEnumerate(person_arrays.conversions) AS i), per_touchpoint AS (SELECT per_conversion.person_id AS person_id, per_conversion.i AS i, per_conversion.conversion_value AS conversion_value, per_conversion.dims[k] AS breakdown_value, per_conversion.w_first[k] AS w_first, per_conversion.w_last[k] AS w_last, per_conversion.w_linear[k] AS w_linear, per_conversion.w_decay[k] AS w_decay, per_conversion.w_position[k] AS w_positionFROM per_conversion ARRAY JOIN arrayEnumerate(per_conversion.touch_ts) AS k), per_conversion_dim AS (@@ -350,7 +350,7 @@SELECT per_conversion_dim.breakdown_value AS breakdown_value, count() AS influenced_conversions, sum(per_conversion_dim.conv_value) AS influenced_value, sum(per_conversion_dim.w_first) AS w_first_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_first)) AS w_first_value, sum(per_conversion_dim.w_last) AS w_last_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_last)) AS w_last_value, sum(per_conversion_dim.w_linear) AS w_linear_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_linear)) AS w_linear_value, sum(per_conversion_dim.w_decay) AS w_decay_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_decay)) AS w_decay_value, sum(per_conversion_dim.w_position) AS w_position_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_position)) AS w_position_valueFROM per_conversion_dimGROUP BY per_conversion_dim.breakdown_value), attribution_rows AS (- SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_152)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_key+ SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_154)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_keyFROM attribution_totals FULL OUTER JOIN influenced_reach ON equals(attribution_totals.breakdown_value, influenced_reach.breakdown_value)), attribution_footer AS (SELECT sumIf(per_conversion.conversion_count, ifNull(equals(per_conversion.i, 1), 0)) AS total_conversions, countIf(ifNull(greater(length(per_conversion.tps), 0), 0)) AS attributed_conversions, 1 AS footer_keyFROM per_conversion)@@ -374,18 +374,18 @@WHERE and(equals(web_sessions_dimensional_preaggregated.team_id, 420), in(web_sessions_dimensional_preaggregated.job_id, tuple(%(hogql_val_13)s))) UNION ALLSELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priorityFROM (- SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_135)s)), `$start_timestamp`, if(notEmpty(ifNull(`$channel_type`, %(hogql_val_136)s)), `$channel_type`, %(hogql_val_137)s), %(hogql_val_138)s, %(hogql_val_139)s, %(hogql_val_140)s, %(hogql_val_141)s, %(hogql_val_142)s, %(hogql_val_143)s, %(hogql_val_144)s) AS dimensions, now64(6, %(hogql_val_145)s) AS computed_at, 1 AS source_priority+ SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_137)s)), `$start_timestamp`, if(notEmpty(ifNull(`$channel_type`, %(hogql_val_138)s)), `$channel_type`, %(hogql_val_139)s), %(hogql_val_140)s, %(hogql_val_141)s, %(hogql_val_142)s, %(hogql_val_143)s, %(hogql_val_144)s, %(hogql_val_145)s, %(hogql_val_146)s) AS dimensions, now64(6, %(hogql_val_147)s) AS computed_at, 1 AS source_priorityFROM (SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_14)s)) AS `$start_timestamp`, max(toTimeZone(raw_sessions.max_timestamp, %(hogql_val_15)s)) AS `$end_timestamp`, multiIf(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_16)s), %(hogql_val_17)s), %(hogql_val_18)s), %(hogql_val_19)s)), %(hogql_val_20)s), %(hogql_val_21)s, or(in(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_22)s), %(hogql_val_23)s), %(hogql_val_24)s), %(hogql_val_25)s)), tuple(%(hogql_val_26)s, %(hogql_val_27)s, %(hogql_val_28)s, %(hogql_val_29)s, %(hogql_val_30)s, %(hogql_val_31)s)), startsWith(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_32)s), %(hogql_val_33)s), %(hogql_val_34)s), %(hogql_val_35)s)), %(hogql_val_36)s), isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_gclid), %(hogql_val_37)s), %(hogql_val_38)s)), isNotNull(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_gad_source), %(hogql_val_39)s), %(hogql_val_40)s), %(hogql_val_41)s), %(hogql_val_42)s))), coalesce(coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_43)s), %(hogql_val_44)s), %(hogql_val_45)s), %(hogql_val_46)s)), ''), 'source')) , dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (cutToFirstSignificantSubdomain(coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_43)s), %(hogql_val_44)s), %(hogql_val_45)s), %(hogql_val_46)s)), '')), 'source'))), if(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_47)s), %(hogql_val_48)s), %(hogql_val_49)s), %(hogql_val_50)s)), %(hogql_val_51)s), %(hogql_val_52)s, NULL), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_53)s), %(hogql_val_54)s), %(hogql_val_55)s), %(hogql_val_56)s)), ''), 'medium')), coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_57)s), %(hogql_val_58)s), ''), 'source')) , dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (cutToFirstSignificantSubdomain(coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_57)s), %(hogql_val_58)s), '')), 'source'))), multiIf(ifNull(equals(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_gad_source), %(hogql_val_59)s), %(hogql_val_60)s), %(hogql_val_61)s), %(hogql_val_62)s), %(hogql_val_63)s), 0), %(hogql_val_64)s, match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_65)s), %(hogql_val_66)s), %(hogql_val_67)s), %(hogql_val_68)s)), %(hogql_val_69)s), %(hogql_val_70)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_71)s), %(hogql_val_72)s)), %(hogql_val_73)s, %(hogql_val_74)s)), and(ifNull(equals(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_75)s), %(hogql_val_76)s), %(hogql_val_77)s), 0), isNull(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_78)s), %(hogql_val_79)s), %(hogql_val_80)s), %(hogql_val_81)s))), or(isNull(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_82)s), %(hogql_val_83)s), %(hogql_val_84)s), %(hogql_val_85)s))), in(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_86)s), %(hogql_val_87)s), %(hogql_val_88)s), %(hogql_val_89)s)), tuple(%(hogql_val_90)s, %(hogql_val_91)s, %(hogql_val_92)s))), not(isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_93)s), %(hogql_val_94)s)))), %(hogql_val_95)s, coalesce(coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_96)s), %(hogql_val_97)s), %(hogql_val_98)s), %(hogql_val_99)s)), ''), 'source')), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (cutToFirstSignificantSubdomain(coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_96)s), %(hogql_val_97)s), %(hogql_val_98)s), %(hogql_val_99)s)), '')), 'source'))), if(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_100)s), %(hogql_val_101)s), %(hogql_val_102)s), %(hogql_val_103)s)), %(hogql_val_104)s), %(hogql_val_105)s, NULL), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_106)s), %(hogql_val_107)s), %(hogql_val_108)s), %(hogql_val_109)s)), ''), 'medium')), coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_110)s), %(hogql_val_111)s), ''), 'source')), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (cutToFirstSignificantSubdomain(coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_110)s), %(hogql_val_111)s), '')), 'source'))), multiIf(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_112)s), %(hogql_val_113)s), %(hogql_val_114)s), %(hogql_val_115)s)), %(hogql_val_116)s), %(hogql_val_117)s, match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_118)s), %(hogql_val_119)s), %(hogql_val_120)s), %(hogql_val_121)s)), %(hogql_val_122)s), %(hogql_val_123)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_124)s), %(hogql_val_125)s)), %(hogql_val_126)s, ifNull(equals(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_127)s), %(hogql_val_128)s), %(hogql_val_129)s), 0), %(hogql_val_130)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_131)s), %(hogql_val_132)s)), %(hogql_val_133)s, %(hogql_val_134)s))) AS `$channel_type`, raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessions- WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1))), greater(raw_sessions.max_timestamp, plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800))))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, toDateTime64(minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1)), 6, %(hogql_val_135)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 6, %(hogql_val_136)s)))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))GROUP BY raw_sessions.session_id_v7HAVING and(greaterOrEquals(`$end_timestamp`, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(`$start_timestamp`, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')), or(less(`$start_timestamp`, toDateTime64('2022-12-27 00:00:00.000000', 6, 'UTC')), greater(`$end_timestamp`, plus(`$start_timestamp`, toIntervalSecond(259200)))))))) AS dGROUP BY d.session_id_v7)), identities AS (- SELECT events.`$session_id_uuid` AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_146)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_147)s)) AS max_event_timestamp, count() AS pageview_count+ SELECT events.`$session_id_uuid` AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_148)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_149)s)) AS max_event_timestamp, count() AS pageview_countFROM 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_idFROM person_distinct_id_overrides@@ -393,11 +393,11 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_148)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_150)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))GROUP BY session_id_v7, person_id)SELECT i.session_id_v7 AS session_id_v7, i.person_id AS person_id, toTimeZone(i.min_event_timestamp, %(hogql_val_0)s) AS min_event_timestamp, toTimeZone(i.max_event_timestamp, %(hogql_val_1)s) AS max_event_timestamp, i.pageview_count AS pageview_count, (d.latest).1 AS period_bucket, (d.latest).2 AS start_timestamp, (d.latest).3 AS channel_type, (d.latest).4 AS utm_source, (d.latest).5 AS utm_medium, (d.latest).6 AS utm_campaign, (d.latest).7 AS utm_term, (d.latest).8 AS utm_content, (d.latest).9 AS referring_domain, (d.latest).10 AS entry_pathname, toTimeZone(d.computed_at, %(hogql_val_2)s) AS computed_atFROM identities AS i INNER JOIN dimensions AS d ON equals(i.session_id_v7, d.session_id_v7)), cached_session_conversions AS MATERIALIZED (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_149)s)), coalesce(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_150)s), ''), 'null'), '^"|"$', ''), %(hogql_val_151)s), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_152)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_153)s))) AS last_conversion+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_151)s)), coalesce(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_152)s), ''), 'null'), '^"|"$', ''), %(hogql_val_153)s), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_154)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_155)s))) AS last_conversionFROM 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_idFROM person_distinct_id_overrides@@ -405,11 +405,11 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_154)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_155)s, %(hogql_val_156)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_157)s, 6, %(hogql_val_158)s)))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_156)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_157)s, %(hogql_val_158)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_159)s, 6, %(hogql_val_160)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)), influenced_reach AS (SELECT s.breakdown_value AS breakdown_value, uniq(s.person_id) AS visitorsFROM (- SELECT cached_sessions.person_id AS person_id, if(notEmpty(ifNull(cached_sessions.channel_type, %(hogql_val_159)s)), cached_sessions.channel_type, %(hogql_val_160)s) AS breakdown_value+ SELECT cached_sessions.person_id AS person_id, if(notEmpty(ifNull(cached_sessions.channel_type, %(hogql_val_161)s)), cached_sessions.channel_type, %(hogql_val_162)s) AS breakdown_valueFROM resolved_cached_sessions AS cached_sessionsWHERE and(greaterOrEquals(cached_sessions.max_event_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(cached_sessions.min_event_timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))) AS sGROUP BY s.breakdown_value), person_arrays AS (@@ -419,7 +419,7 @@FROM cached_session_conversions) AS c LEFT JOIN (SELECT d.person_id AS person_id, arraySlice(arraySort(groupUniqArray(tuple(d.session_ts, d.session_dim))), -500) AS touchpointsFROM (- SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, if(notEmpty(ifNull(cached_sessions.channel_type, %(hogql_val_161)s)), cached_sessions.channel_type, %(hogql_val_162)s) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_bound+ SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, if(notEmpty(ifNull(cached_sessions.channel_type, %(hogql_val_163)s)), cached_sessions.channel_type, %(hogql_val_164)s) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_boundFROM resolved_cached_sessions AS cached_sessions INNER JOIN (SELECT cached_session_conversions.conv_person_id AS conv_person_id, cached_session_conversions.first_conversion AS first_conversion, cached_session_conversions.last_conversion AS last_conversionFROM cached_session_conversions) AS conv ON equals(cached_sessions.person_id, conv.conv_person_id)@@ -427,7 +427,7 @@WHERE and(ifNull(greaterOrEquals(d.session_ts, minus(d.first_conversion, 345600)), 0), ifNull(lessOrEquals(d.session_ts, d.upper_bound), 0))GROUP BY d.person_id) AS t ON equals(c.conv_person_id, t.person_id)WHERE ifNull(greater(length(c.conversions), 0), 0)), per_conversion AS MATERIALIZED (- SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_163)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_164)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_165)s), 2.0), 1.0)))), touch_ts)))))) AS w_position+ SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_165)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_166)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_167)s), 2.0), 1.0)))), touch_ts)))))) AS w_positionFROM person_arrays ARRAY JOIN arrayEnumerate(person_arrays.conversions) AS i), per_touchpoint AS (SELECT per_conversion.person_id AS person_id, per_conversion.i AS i, per_conversion.conversion_value AS conversion_value, per_conversion.dims[k] AS breakdown_value, per_conversion.w_first[k] AS w_first, per_conversion.w_last[k] AS w_last, per_conversion.w_linear[k] AS w_linear, per_conversion.w_decay[k] AS w_decay, per_conversion.w_position[k] AS w_positionFROM per_conversion ARRAY JOIN arrayEnumerate(per_conversion.touch_ts) AS k), per_conversion_dim AS (@@ -437,7 +437,7 @@SELECT per_conversion_dim.breakdown_value AS breakdown_value, count() AS influenced_conversions, sum(per_conversion_dim.conv_value) AS influenced_value, sum(per_conversion_dim.w_first) AS w_first_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_first)) AS w_first_value, sum(per_conversion_dim.w_last) AS w_last_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_last)) AS w_last_value, sum(per_conversion_dim.w_linear) AS w_linear_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_linear)) AS w_linear_value, sum(per_conversion_dim.w_decay) AS w_decay_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_decay)) AS w_decay_value, sum(per_conversion_dim.w_position) AS w_position_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_position)) AS w_position_valueFROM per_conversion_dimGROUP BY per_conversion_dim.breakdown_value), attribution_rows AS (- SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_166)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_key+ SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_168)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_keyFROM attribution_totals FULL OUTER JOIN influenced_reach ON equals(attribution_totals.breakdown_value, influenced_reach.breakdown_value)), attribution_footer AS (SELECT sumIf(per_conversion.conversion_count, ifNull(equals(per_conversion.i, 1), 0)) AS total_conversions, countIf(ifNull(greater(length(per_conversion.tps), 0), 0)) AS attributed_conversions, 1 AS footer_keyFROM per_conversion)diff --git a/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_attribution_table_query_runner.new_events_schema.ambr b/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_attribution_table_query_runner.new_events_schema.ambrindex 610a2df85408..c7ca33a330ed 100644--- a/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_attribution_table_query_runner.new_events_schema.ambr+++ b/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_attribution_table_query_runner.new_events_schema.ambr@@ -14,21 +14,21 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(minus(toDateTime(%(hogql_val_3)s, %(hogql_val_4)s), toIntervalSecond(345600)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_5)s, 6, %(hogql_val_6)s), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.properties.`$session_id`, %(hogql_val_7)s)), events__session.session_id_v7)- WHERE and(equals(events.team_id, 420), and(equals(events.event, %(hogql_val_9)s), notEmpty(events.properties.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_10)s, %(hogql_val_11)s), toIntervalSecond(345600))), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_12)s, 6, %(hogql_val_13)s)))+ WHERE and(equals(events.team_id, 420), and(equals(events.event, %(hogql_val_9)s), notEmpty(events.properties.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_10)s, %(hogql_val_11)s), toIntervalSecond(345600)), 6, %(hogql_val_12)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_13)s, 6, %(hogql_val_14)s)))GROUP BY breakdown_value), person_arrays AS (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, arraySlice(arraySort(groupArrayIf(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_33)s)), coalesce(accurateCastOrNull(events.properties.revenue, 'Float64'), 0.0)), and(equals(events.event, %(hogql_val_34)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_35)s), toDateTime(%(hogql_val_36)s, %(hogql_val_37)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_38)s), toDateTime64(%(hogql_val_39)s, 6, %(hogql_val_40)s))))), -500) AS conversions, countIf(and(equals(events.event, %(hogql_val_41)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_42)s), toDateTime(%(hogql_val_43)s, %(hogql_val_44)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_45)s), toDateTime64(%(hogql_val_46)s, 6, %(hogql_val_47)s)))) AS conversion_count, arraySlice(arraySort(groupUniqArrayIf(tuple(toUnixTimestamp(events__session.`$start_timestamp`), toString(ifNull(events__session.`$entry_utm_campaign`, %(hogql_val_48)s))), and(and(equals(events.event, %(hogql_val_49)s), notEmpty(events.properties.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), minus(conv_bounds.first_conversion, 345600)), lessOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), conv_bounds.last_conversion)))), -500) AS touchpoints+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, arraySlice(arraySort(groupArrayIf(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_34)s)), coalesce(accurateCastOrNull(events.properties.revenue, 'Float64'), 0.0)), and(equals(events.event, %(hogql_val_35)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_36)s), toDateTime(%(hogql_val_37)s, %(hogql_val_38)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_39)s), toDateTime64(%(hogql_val_40)s, 6, %(hogql_val_41)s))))), -500) AS conversions, countIf(and(equals(events.event, %(hogql_val_42)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_43)s), toDateTime(%(hogql_val_44)s, %(hogql_val_45)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_46)s), toDateTime64(%(hogql_val_47)s, 6, %(hogql_val_48)s)))) AS conversion_count, arraySlice(arraySort(groupUniqArrayIf(tuple(toUnixTimestamp(events__session.`$start_timestamp`), toString(ifNull(events__session.`$entry_utm_campaign`, %(hogql_val_49)s))), and(and(equals(events.event, %(hogql_val_50)s), notEmpty(events.properties.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), minus(conv_bounds.first_conversion, 345600)), lessOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), conv_bounds.last_conversion)))), -500) AS touchpointsFROM events_json AS events LEFT JOIN (- SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_14)s)) AS `$start_timestamp`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_15)s), %(hogql_val_16)s) AS `$entry_utm_campaign`, raw_sessions.session_id_v7 AS session_id_v7+ SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_15)s)) AS `$start_timestamp`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_16)s), %(hogql_val_17)s) AS `$entry_utm_campaign`, raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessions- WHERE and(equals(raw_sessions.team_id, 420), or(and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toDateTime(%(hogql_val_17)s, %(hogql_val_18)s), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_19)s, 6, %(hogql_val_20)s), toIntervalDay(3)))), and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(minus(toDateTime(%(hogql_val_21)s, %(hogql_val_22)s), toIntervalSecond(345600)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_23)s, 6, %(hogql_val_24)s), toIntervalDay(3))))))- GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.properties.`$session_id`, %(hogql_val_25)s)), events__session.session_id_v7) LEFT OUTER JOIN (+ WHERE and(equals(raw_sessions.team_id, 420), or(and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toDateTime(%(hogql_val_18)s, %(hogql_val_19)s), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_20)s, 6, %(hogql_val_21)s), toIntervalDay(3)))), and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(minus(toDateTime(%(hogql_val_22)s, %(hogql_val_23)s), toIntervalSecond(345600)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_24)s, 6, %(hogql_val_25)s), toIntervalDay(3))))))+ GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.properties.`$session_id`, %(hogql_val_26)s)), events__session.session_id_v7) 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_idFROM person_distinct_id_overridesWHERE equals(person_distinct_id_overrides.team_id, 420)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id) INNER JOIN (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_26)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_27)s))) AS last_conversion+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_27)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_28)s))) AS last_conversionFROM 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_idFROM person_distinct_id_overrides@@ -36,12 +36,12 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_28)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_29)s, %(hogql_val_30)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_31)s, 6, %(hogql_val_32)s)))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_29)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_30)s, %(hogql_val_31)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_32)s, 6, %(hogql_val_33)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS conv_bounds ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), conv_bounds.person_id)- WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_50)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_51)s, %(hogql_val_52)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_53)s, 6, %(hogql_val_54)s))), and(equals(events.event, %(hogql_val_55)s), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_56)s, %(hogql_val_57)s), toIntervalSecond(345600))), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_58)s, 6, %(hogql_val_59)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_60)s)), minus(conv_bounds.first_conversion, 345600)))))+ WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_51)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_52)s, %(hogql_val_53)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_54)s, 6, %(hogql_val_55)s))), and(equals(events.event, %(hogql_val_56)s), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_57)s, %(hogql_val_58)s), toIntervalSecond(345600)), 6, %(hogql_val_59)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_60)s, 6, %(hogql_val_61)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_62)s)), minus(conv_bounds.first_conversion, 345600)))))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)HAVING greater(length(conversions), 0)), per_conversion AS MATERIALIZED (- SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_61)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_62)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_63)s), 2.0), 1.0)))), touch_ts)))))) AS w_position+ SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_63)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_64)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_65)s), 2.0), 1.0)))), touch_ts)))))) AS w_positionFROM person_arrays ARRAY JOIN arrayEnumerate(person_arrays.conversions) AS i), per_touchpoint AS (SELECT per_conversion.person_id AS person_id, per_conversion.i AS i, per_conversion.conversion_value AS conversion_value, per_conversion.dims[k] AS breakdown_value, per_conversion.w_first[k] AS w_first, per_conversion.w_last[k] AS w_last, per_conversion.w_linear[k] AS w_linear, per_conversion.w_decay[k] AS w_decay, per_conversion.w_position[k] AS w_positionFROM per_conversion ARRAY JOIN arrayEnumerate(per_conversion.touch_ts) AS k), per_conversion_dim AS (@@ -51,7 +51,7 @@SELECT per_conversion_dim.breakdown_value AS breakdown_value, count() AS influenced_conversions, sum(per_conversion_dim.conv_value) AS influenced_value, sum(per_conversion_dim.w_first) AS w_first_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_first)) AS w_first_value, sum(per_conversion_dim.w_last) AS w_last_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_last)) AS w_last_value, sum(per_conversion_dim.w_linear) AS w_linear_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_linear)) AS w_linear_value, sum(per_conversion_dim.w_decay) AS w_decay_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_decay)) AS w_decay_value, sum(per_conversion_dim.w_position) AS w_position_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_position)) AS w_position_valueFROM per_conversion_dimGROUP BY per_conversion_dim.breakdown_value), attribution_rows AS (- SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_64)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_key+ SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_66)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_keyFROM attribution_totals FULL OUTER JOIN influenced_reach ON equals(attribution_totals.breakdown_value, influenced_reach.breakdown_value)), attribution_footer AS (SELECT sumIf(per_conversion.conversion_count, ifNull(equals(per_conversion.i, 1), 0)) AS total_conversions, countIf(ifNull(greater(length(per_conversion.tps), 0), 0)) AS attributed_conversions, 1 AS footer_keyFROM per_conversion)@@ -77,21 +77,21 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(minus(toDateTime(%(hogql_val_3)s, %(hogql_val_4)s), toIntervalSecond(345600)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_5)s, 6, %(hogql_val_6)s), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.properties.`$session_id`, %(hogql_val_7)s)), events__session.session_id_v7)- WHERE and(equals(events.team_id, 420), and(equals(events.event, %(hogql_val_62)s), notEmpty(events.properties.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_63)s, %(hogql_val_64)s), toIntervalSecond(345600))), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_65)s, 6, %(hogql_val_66)s)))+ WHERE and(equals(events.team_id, 420), and(equals(events.event, %(hogql_val_62)s), notEmpty(events.properties.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_63)s, %(hogql_val_64)s), toIntervalSecond(345600)), 6, %(hogql_val_65)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_66)s, 6, %(hogql_val_67)s)))GROUP BY breakdown_value), person_arrays AS (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, arraySlice(arraySort(groupArrayIf(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_86)s)), coalesce(accurateCastOrNull(events.properties.revenue, 'Float64'), 0.0)), and(equals(events.event, %(hogql_val_87)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_88)s), toDateTime(%(hogql_val_89)s, %(hogql_val_90)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_91)s), toDateTime64(%(hogql_val_92)s, 6, %(hogql_val_93)s))))), -500) AS conversions, countIf(and(equals(events.event, %(hogql_val_94)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_95)s), toDateTime(%(hogql_val_96)s, %(hogql_val_97)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_98)s), toDateTime64(%(hogql_val_99)s, 6, %(hogql_val_100)s)))) AS conversion_count, arraySlice(arraySort(groupUniqArrayIf(tuple(toUnixTimestamp(events__session.`$start_timestamp`), if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_101)s)), events__session.`$entry_utm_source`, %(hogql_val_102)s)), [%(hogql_val_103)s, %(hogql_val_104)s, %(hogql_val_105)s]), %(hogql_val_106)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_107)s)), events__session.`$entry_utm_source`, %(hogql_val_108)s)), [%(hogql_val_109)s, %(hogql_val_110)s, %(hogql_val_111)s, %(hogql_val_112)s, %(hogql_val_113)s, %(hogql_val_114)s, %(hogql_val_115)s, %(hogql_val_116)s]), %(hogql_val_117)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_118)s)), events__session.`$entry_utm_source`, %(hogql_val_119)s)), [%(hogql_val_120)s]), %(hogql_val_121)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_122)s)), events__session.`$entry_utm_source`, %(hogql_val_123)s)), [%(hogql_val_124)s, %(hogql_val_125)s, %(hogql_val_126)s, %(hogql_val_127)s, %(hogql_val_128)s, %(hogql_val_129)s, %(hogql_val_130)s, %(hogql_val_131)s, %(hogql_val_132)s]), %(hogql_val_133)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_134)s)), events__session.`$entry_utm_source`, %(hogql_val_135)s)), [%(hogql_val_136)s]), %(hogql_val_137)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_138)s)), events__session.`$entry_utm_source`, %(hogql_val_139)s)), [%(hogql_val_140)s, %(hogql_val_141)s]), %(hogql_val_142)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_143)s)), events__session.`$entry_utm_source`, %(hogql_val_144)s)), [%(hogql_val_145)s, %(hogql_val_146)s, %(hogql_val_147)s]), %(hogql_val_148)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_149)s)), events__session.`$entry_utm_source`, %(hogql_val_150)s)), [%(hogql_val_151)s]), %(hogql_val_152)s, if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_153)s)), events__session.`$entry_utm_source`, %(hogql_val_154)s)))))))))), and(and(equals(events.event, %(hogql_val_155)s), notEmpty(events.properties.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), minus(conv_bounds.first_conversion, 345600)), lessOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), conv_bounds.last_conversion)))), -500) AS touchpoints+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, arraySlice(arraySort(groupArrayIf(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_87)s)), coalesce(accurateCastOrNull(events.properties.revenue, 'Float64'), 0.0)), and(equals(events.event, %(hogql_val_88)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_89)s), toDateTime(%(hogql_val_90)s, %(hogql_val_91)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_92)s), toDateTime64(%(hogql_val_93)s, 6, %(hogql_val_94)s))))), -500) AS conversions, countIf(and(equals(events.event, %(hogql_val_95)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_96)s), toDateTime(%(hogql_val_97)s, %(hogql_val_98)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_99)s), toDateTime64(%(hogql_val_100)s, 6, %(hogql_val_101)s)))) AS conversion_count, arraySlice(arraySort(groupUniqArrayIf(tuple(toUnixTimestamp(events__session.`$start_timestamp`), if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_102)s)), events__session.`$entry_utm_source`, %(hogql_val_103)s)), [%(hogql_val_104)s, %(hogql_val_105)s, %(hogql_val_106)s]), %(hogql_val_107)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_108)s)), events__session.`$entry_utm_source`, %(hogql_val_109)s)), [%(hogql_val_110)s, %(hogql_val_111)s, %(hogql_val_112)s, %(hogql_val_113)s, %(hogql_val_114)s, %(hogql_val_115)s, %(hogql_val_116)s, %(hogql_val_117)s]), %(hogql_val_118)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_119)s)), events__session.`$entry_utm_source`, %(hogql_val_120)s)), [%(hogql_val_121)s]), %(hogql_val_122)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_123)s)), events__session.`$entry_utm_source`, %(hogql_val_124)s)), [%(hogql_val_125)s, %(hogql_val_126)s, %(hogql_val_127)s, %(hogql_val_128)s, %(hogql_val_129)s, %(hogql_val_130)s, %(hogql_val_131)s, %(hogql_val_132)s, %(hogql_val_133)s]), %(hogql_val_134)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_135)s)), events__session.`$entry_utm_source`, %(hogql_val_136)s)), [%(hogql_val_137)s]), %(hogql_val_138)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_139)s)), events__session.`$entry_utm_source`, %(hogql_val_140)s)), [%(hogql_val_141)s, %(hogql_val_142)s]), %(hogql_val_143)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_144)s)), events__session.`$entry_utm_source`, %(hogql_val_145)s)), [%(hogql_val_146)s, %(hogql_val_147)s, %(hogql_val_148)s]), %(hogql_val_149)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_150)s)), events__session.`$entry_utm_source`, %(hogql_val_151)s)), [%(hogql_val_152)s]), %(hogql_val_153)s, if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_154)s)), events__session.`$entry_utm_source`, %(hogql_val_155)s)))))))))), and(and(equals(events.event, %(hogql_val_156)s), notEmpty(events.properties.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), minus(conv_bounds.first_conversion, 345600)), lessOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), conv_bounds.last_conversion)))), -500) AS touchpointsFROM events_json AS events LEFT JOIN (- SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_67)s)) AS `$start_timestamp`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_68)s), %(hogql_val_69)s) AS `$entry_utm_source`, raw_sessions.session_id_v7 AS session_id_v7+ SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_68)s)) AS `$start_timestamp`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_69)s), %(hogql_val_70)s) AS `$entry_utm_source`, raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessions- WHERE and(equals(raw_sessions.team_id, 420), or(and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toDateTime(%(hogql_val_70)s, %(hogql_val_71)s), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_72)s, 6, %(hogql_val_73)s), toIntervalDay(3)))), and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(minus(toDateTime(%(hogql_val_74)s, %(hogql_val_75)s), toIntervalSecond(345600)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_76)s, 6, %(hogql_val_77)s), toIntervalDay(3))))))- GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.properties.`$session_id`, %(hogql_val_78)s)), events__session.session_id_v7) LEFT OUTER JOIN (+ WHERE and(equals(raw_sessions.team_id, 420), or(and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toDateTime(%(hogql_val_71)s, %(hogql_val_72)s), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_73)s, 6, %(hogql_val_74)s), toIntervalDay(3)))), and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(minus(toDateTime(%(hogql_val_75)s, %(hogql_val_76)s), toIntervalSecond(345600)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_77)s, 6, %(hogql_val_78)s), toIntervalDay(3))))))+ GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.properties.`$session_id`, %(hogql_val_79)s)), events__session.session_id_v7) 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_idFROM person_distinct_id_overridesWHERE equals(person_distinct_id_overrides.team_id, 420)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id) INNER JOIN (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_79)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_80)s))) AS last_conversion+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_80)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_81)s))) AS last_conversionFROM 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_idFROM person_distinct_id_overrides@@ -99,12 +99,12 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_81)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_82)s, %(hogql_val_83)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_84)s, 6, %(hogql_val_85)s)))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_82)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_83)s, %(hogql_val_84)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_85)s, 6, %(hogql_val_86)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS conv_bounds ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), conv_bounds.person_id)- WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_156)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_157)s, %(hogql_val_158)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_159)s, 6, %(hogql_val_160)s))), and(equals(events.event, %(hogql_val_161)s), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_162)s, %(hogql_val_163)s), toIntervalSecond(345600))), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_164)s, 6, %(hogql_val_165)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_166)s)), minus(conv_bounds.first_conversion, 345600)))))+ WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_157)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_158)s, %(hogql_val_159)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_160)s, 6, %(hogql_val_161)s))), and(equals(events.event, %(hogql_val_162)s), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_163)s, %(hogql_val_164)s), toIntervalSecond(345600)), 6, %(hogql_val_165)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_166)s, 6, %(hogql_val_167)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_168)s)), minus(conv_bounds.first_conversion, 345600)))))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)HAVING greater(length(conversions), 0)), per_conversion AS MATERIALIZED (- SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_167)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_168)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_169)s), 2.0), 1.0)))), touch_ts)))))) AS w_position+ SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_169)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_170)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_171)s), 2.0), 1.0)))), touch_ts)))))) AS w_positionFROM person_arrays ARRAY JOIN arrayEnumerate(person_arrays.conversions) AS i), per_touchpoint AS (SELECT per_conversion.person_id AS person_id, per_conversion.i AS i, per_conversion.conversion_value AS conversion_value, per_conversion.dims[k] AS breakdown_value, per_conversion.w_first[k] AS w_first, per_conversion.w_last[k] AS w_last, per_conversion.w_linear[k] AS w_linear, per_conversion.w_decay[k] AS w_decay, per_conversion.w_position[k] AS w_positionFROM per_conversion ARRAY JOIN arrayEnumerate(per_conversion.touch_ts) AS k), per_conversion_dim AS (@@ -114,7 +114,7 @@SELECT per_conversion_dim.breakdown_value AS breakdown_value, count() AS influenced_conversions, sum(per_conversion_dim.conv_value) AS influenced_value, sum(per_conversion_dim.w_first) AS w_first_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_first)) AS w_first_value, sum(per_conversion_dim.w_last) AS w_last_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_last)) AS w_last_value, sum(per_conversion_dim.w_linear) AS w_linear_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_linear)) AS w_linear_value, sum(per_conversion_dim.w_decay) AS w_decay_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_decay)) AS w_decay_value, sum(per_conversion_dim.w_position) AS w_position_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_position)) AS w_position_valueFROM per_conversion_dimGROUP BY per_conversion_dim.breakdown_value), attribution_rows AS (- SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_170)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_key+ SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_172)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_keyFROM attribution_totals FULL OUTER JOIN influenced_reach ON equals(attribution_totals.breakdown_value, influenced_reach.breakdown_value)), attribution_footer AS (SELECT sumIf(per_conversion.conversion_count, ifNull(equals(per_conversion.i, 1), 0)) AS total_conversions, countIf(ifNull(greater(length(per_conversion.tps), 0), 0)) AS attributed_conversions, 1 AS footer_keyFROM per_conversion)@@ -140,21 +140,21 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(minus(toDateTime(%(hogql_val_120)s, %(hogql_val_121)s), toIntervalSecond(345600)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_122)s, 6, %(hogql_val_123)s), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.properties.`$session_id`, %(hogql_val_124)s)), events__session.session_id_v7)- WHERE and(equals(events.team_id, 420), and(equals(events.event, %(hogql_val_127)s), notEmpty(events.properties.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_128)s, %(hogql_val_129)s), toIntervalSecond(345600))), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_130)s, 6, %(hogql_val_131)s)))+ WHERE and(equals(events.team_id, 420), and(equals(events.event, %(hogql_val_127)s), notEmpty(events.properties.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_128)s, %(hogql_val_129)s), toIntervalSecond(345600)), 6, %(hogql_val_130)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_131)s, 6, %(hogql_val_132)s)))GROUP BY breakdown_value), person_arrays AS (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, arraySlice(arraySort(groupArrayIf(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_268)s)), coalesce(accurateCastOrNull(events.properties.revenue, 'Float64'), 0.0)), and(equals(events.event, %(hogql_val_269)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_270)s), toDateTime(%(hogql_val_271)s, %(hogql_val_272)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_273)s), toDateTime64(%(hogql_val_274)s, 6, %(hogql_val_275)s))))), -500) AS conversions, countIf(and(equals(events.event, %(hogql_val_276)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_277)s), toDateTime(%(hogql_val_278)s, %(hogql_val_279)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_280)s), toDateTime64(%(hogql_val_281)s, 6, %(hogql_val_282)s)))) AS conversion_count, arraySlice(arraySort(groupUniqArrayIf(tuple(toUnixTimestamp(events__session.`$start_timestamp`), if(notEmpty(ifNull(events__session.`$channel_type`, %(hogql_val_283)s)), events__session.`$channel_type`, %(hogql_val_284)s)), and(and(equals(events.event, %(hogql_val_285)s), notEmpty(events.properties.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), minus(conv_bounds.first_conversion, 345600)), lessOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), conv_bounds.last_conversion)))), -500) AS touchpoints+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, arraySlice(arraySort(groupArrayIf(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_269)s)), coalesce(accurateCastOrNull(events.properties.revenue, 'Float64'), 0.0)), and(equals(events.event, %(hogql_val_270)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_271)s), toDateTime(%(hogql_val_272)s, %(hogql_val_273)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_274)s), toDateTime64(%(hogql_val_275)s, 6, %(hogql_val_276)s))))), -500) AS conversions, countIf(and(equals(events.event, %(hogql_val_277)s), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_278)s), toDateTime(%(hogql_val_279)s, %(hogql_val_280)s)), lessOrEquals(toTimeZone(events.timestamp, %(hogql_val_281)s), toDateTime64(%(hogql_val_282)s, 6, %(hogql_val_283)s)))) AS conversion_count, arraySlice(arraySort(groupUniqArrayIf(tuple(toUnixTimestamp(events__session.`$start_timestamp`), if(notEmpty(ifNull(events__session.`$channel_type`, %(hogql_val_284)s)), events__session.`$channel_type`, %(hogql_val_285)s)), and(and(equals(events.event, %(hogql_val_286)s), notEmpty(events.properties.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), minus(conv_bounds.first_conversion, 345600)), lessOrEquals(toUnixTimestamp(events__session.`$start_timestamp`), conv_bounds.last_conversion)))), -500) AS touchpointsFROM events_json AS events LEFT JOIN (- SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_132)s)) AS `$start_timestamp`, multiIf(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_133)s), %(hogql_val_134)s), %(hogql_val_135)s), %(hogql_val_136)s)), %(hogql_val_137)s), %(hogql_val_138)s, or(in(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_139)s), %(hogql_val_140)s), %(hogql_val_141)s), %(hogql_val_142)s)), tuple(%(hogql_val_143)s, %(hogql_val_144)s, %(hogql_val_145)s, %(hogql_val_146)s, %(hogql_val_147)s, %(hogql_val_148)s)), startsWith(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_149)s), %(hogql_val_150)s), %(hogql_val_151)s), %(hogql_val_152)s)), %(hogql_val_153)s), isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_gclid), %(hogql_val_154)s), %(hogql_val_155)s)), isNotNull(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_gad_source), %(hogql_val_156)s), %(hogql_val_157)s), %(hogql_val_158)s), %(hogql_val_159)s))), coalesce(coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_160)s), %(hogql_val_161)s), %(hogql_val_162)s), %(hogql_val_163)s)), ''), 'source')) , dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (cutToFirstSignificantSubdomain(coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_160)s), %(hogql_val_161)s), %(hogql_val_162)s), %(hogql_val_163)s)), '')), 'source'))), if(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_164)s), %(hogql_val_165)s), %(hogql_val_166)s), %(hogql_val_167)s)), %(hogql_val_168)s), %(hogql_val_169)s, NULL), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_170)s), %(hogql_val_171)s), %(hogql_val_172)s), %(hogql_val_173)s)), ''), 'medium')), coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_174)s), %(hogql_val_175)s), ''), 'source')) , dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (cutToFirstSignificantSubdomain(coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_174)s), %(hogql_val_175)s), '')), 'source'))), multiIf(ifNull(equals(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_gad_source), %(hogql_val_176)s), %(hogql_val_177)s), %(hogql_val_178)s), %(hogql_val_179)s), %(hogql_val_180)s), 0), %(hogql_val_181)s, match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_182)s), %(hogql_val_183)s), %(hogql_val_184)s), %(hogql_val_185)s)), %(hogql_val_186)s), %(hogql_val_187)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_188)s), %(hogql_val_189)s)), %(hogql_val_190)s, %(hogql_val_191)s)), and(ifNull(equals(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_192)s), %(hogql_val_193)s), %(hogql_val_194)s), 0), isNull(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_195)s), %(hogql_val_196)s), %(hogql_val_197)s), %(hogql_val_198)s))), or(isNull(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_199)s), %(hogql_val_200)s), %(hogql_val_201)s), %(hogql_val_202)s))), in(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_203)s), %(hogql_val_204)s), %(hogql_val_205)s), %(hogql_val_206)s)), tuple(%(hogql_val_207)s, %(hogql_val_208)s, %(hogql_val_209)s))), not(isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_210)s), %(hogql_val_211)s)))), %(hogql_val_212)s, coalesce(coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_213)s), %(hogql_val_214)s), %(hogql_val_215)s), %(hogql_val_216)s)), ''), 'source')), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (cutToFirstSignificantSubdomain(coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_213)s), %(hogql_val_214)s), %(hogql_val_215)s), %(hogql_val_216)s)), '')), 'source'))), if(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_217)s), %(hogql_val_218)s), %(hogql_val_219)s), %(hogql_val_220)s)), %(hogql_val_221)s), %(hogql_val_222)s, NULL), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_223)s), %(hogql_val_224)s), %(hogql_val_225)s), %(hogql_val_226)s)), ''), 'medium')), coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_227)s), %(hogql_val_228)s), ''), 'source')), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (cutToFirstSignificantSubdomain(coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_227)s), %(hogql_val_228)s), '')), 'source'))), multiIf(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_229)s), %(hogql_val_230)s), %(hogql_val_231)s), %(hogql_val_232)s)), %(hogql_val_233)s), %(hogql_val_234)s, match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_235)s), %(hogql_val_236)s), %(hogql_val_237)s), %(hogql_val_238)s)), %(hogql_val_239)s), %(hogql_val_240)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_241)s), %(hogql_val_242)s)), %(hogql_val_243)s, ifNull(equals(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_244)s), %(hogql_val_245)s), %(hogql_val_246)s), 0), %(hogql_val_247)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_248)s), %(hogql_val_249)s)), %(hogql_val_250)s, %(hogql_val_251)s))) AS `$channel_type`, raw_sessions.session_id_v7 AS session_id_v7+ SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_133)s)) AS `$start_timestamp`, multiIf(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_134)s), %(hogql_val_135)s), %(hogql_val_136)s), %(hogql_val_137)s)), %(hogql_val_138)s), %(hogql_val_139)s, or(in(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_140)s), %(hogql_val_141)s), %(hogql_val_142)s), %(hogql_val_143)s)), tuple(%(hogql_val_144)s, %(hogql_val_145)s, %(hogql_val_146)s, %(hogql_val_147)s, %(hogql_val_148)s, %(hogql_val_149)s)), startsWith(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_150)s), %(hogql_val_151)s), %(hogql_val_152)s), %(hogql_val_153)s)), %(hogql_val_154)s), isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_gclid), %(hogql_val_155)s), %(hogql_val_156)s)), isNotNull(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_gad_source), %(hogql_val_157)s), %(hogql_val_158)s), %(hogql_val_159)s), %(hogql_val_160)s))), coalesce(coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_161)s), %(hogql_val_162)s), %(hogql_val_163)s), %(hogql_val_164)s)), ''), 'source')) , dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (cutToFirstSignificantSubdomain(coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_161)s), %(hogql_val_162)s), %(hogql_val_163)s), %(hogql_val_164)s)), '')), 'source'))), if(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_165)s), %(hogql_val_166)s), %(hogql_val_167)s), %(hogql_val_168)s)), %(hogql_val_169)s), %(hogql_val_170)s, NULL), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_171)s), %(hogql_val_172)s), %(hogql_val_173)s), %(hogql_val_174)s)), ''), 'medium')), coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_175)s), %(hogql_val_176)s), ''), 'source')) , dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (cutToFirstSignificantSubdomain(coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_175)s), %(hogql_val_176)s), '')), 'source'))), multiIf(ifNull(equals(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_gad_source), %(hogql_val_177)s), %(hogql_val_178)s), %(hogql_val_179)s), %(hogql_val_180)s), %(hogql_val_181)s), 0), %(hogql_val_182)s, match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_183)s), %(hogql_val_184)s), %(hogql_val_185)s), %(hogql_val_186)s)), %(hogql_val_187)s), %(hogql_val_188)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_189)s), %(hogql_val_190)s)), %(hogql_val_191)s, %(hogql_val_192)s)), and(ifNull(equals(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_193)s), %(hogql_val_194)s), %(hogql_val_195)s), 0), isNull(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_196)s), %(hogql_val_197)s), %(hogql_val_198)s), %(hogql_val_199)s))), or(isNull(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_200)s), %(hogql_val_201)s), %(hogql_val_202)s), %(hogql_val_203)s))), in(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_204)s), %(hogql_val_205)s), %(hogql_val_206)s), %(hogql_val_207)s)), tuple(%(hogql_val_208)s, %(hogql_val_209)s, %(hogql_val_210)s))), not(isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_211)s), %(hogql_val_212)s)))), %(hogql_val_213)s, coalesce(coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_214)s), %(hogql_val_215)s), %(hogql_val_216)s), %(hogql_val_217)s)), ''), 'source')), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (cutToFirstSignificantSubdomain(coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_214)s), %(hogql_val_215)s), %(hogql_val_216)s), %(hogql_val_217)s)), '')), 'source'))), if(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_218)s), %(hogql_val_219)s), %(hogql_val_220)s), %(hogql_val_221)s)), %(hogql_val_222)s), %(hogql_val_223)s, NULL), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_224)s), %(hogql_val_225)s), %(hogql_val_226)s), %(hogql_val_227)s)), ''), 'medium')), coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_228)s), %(hogql_val_229)s), ''), 'source')), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (cutToFirstSignificantSubdomain(coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_228)s), %(hogql_val_229)s), '')), 'source'))), multiIf(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_230)s), %(hogql_val_231)s), %(hogql_val_232)s), %(hogql_val_233)s)), %(hogql_val_234)s), %(hogql_val_235)s, match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_236)s), %(hogql_val_237)s), %(hogql_val_238)s), %(hogql_val_239)s)), %(hogql_val_240)s), %(hogql_val_241)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_242)s), %(hogql_val_243)s)), %(hogql_val_244)s, ifNull(equals(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_245)s), %(hogql_val_246)s), %(hogql_val_247)s), 0), %(hogql_val_248)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_249)s), %(hogql_val_250)s)), %(hogql_val_251)s, %(hogql_val_252)s))) AS `$channel_type`, raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessions- WHERE and(equals(raw_sessions.team_id, 420), or(and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toDateTime(%(hogql_val_252)s, %(hogql_val_253)s), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_254)s, 6, %(hogql_val_255)s), toIntervalDay(3)))), and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(minus(toDateTime(%(hogql_val_256)s, %(hogql_val_257)s), toIntervalSecond(345600)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_258)s, 6, %(hogql_val_259)s), toIntervalDay(3))))))- GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.properties.`$session_id`, %(hogql_val_260)s)), events__session.session_id_v7) LEFT OUTER JOIN (+ WHERE and(equals(raw_sessions.team_id, 420), or(and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toDateTime(%(hogql_val_253)s, %(hogql_val_254)s), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_255)s, 6, %(hogql_val_256)s), toIntervalDay(3)))), and(greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(minus(toDateTime(%(hogql_val_257)s, %(hogql_val_258)s), toIntervalSecond(345600)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime64(%(hogql_val_259)s, 6, %(hogql_val_260)s), toIntervalDay(3))))))+ GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.properties.`$session_id`, %(hogql_val_261)s)), events__session.session_id_v7) 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_idFROM person_distinct_id_overridesWHERE equals(person_distinct_id_overrides.team_id, 420)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id) INNER JOIN (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_261)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_262)s))) AS last_conversion+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_262)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_263)s))) AS last_conversionFROM 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_idFROM person_distinct_id_overrides@@ -162,12 +162,12 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_263)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_264)s, %(hogql_val_265)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_266)s, 6, %(hogql_val_267)s)))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_264)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_265)s, %(hogql_val_266)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_267)s, 6, %(hogql_val_268)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)) AS conv_bounds ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), conv_bounds.person_id)- WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_286)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_287)s, %(hogql_val_288)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_289)s, 6, %(hogql_val_290)s))), and(equals(events.event, %(hogql_val_291)s), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_292)s, %(hogql_val_293)s), toIntervalSecond(345600))), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_294)s, 6, %(hogql_val_295)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_296)s)), minus(conv_bounds.first_conversion, 345600)))))+ WHERE and(equals(events.team_id, 420), or(and(equals(events.event, %(hogql_val_287)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_288)s, %(hogql_val_289)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_290)s, 6, %(hogql_val_291)s))), and(equals(events.event, %(hogql_val_292)s), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_293)s, %(hogql_val_294)s), toIntervalSecond(345600)), 6, %(hogql_val_295)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_296)s, 6, %(hogql_val_297)s)), greaterOrEquals(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_298)s)), minus(conv_bounds.first_conversion, 345600)))))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)HAVING greater(length(conversions), 0)), per_conversion AS MATERIALIZED (- SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_297)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_298)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_299)s), 2.0), 1.0)))), touch_ts)))))) AS w_position+ SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_299)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_300)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_301)s), 2.0), 1.0)))), touch_ts)))))) AS w_positionFROM person_arrays ARRAY JOIN arrayEnumerate(person_arrays.conversions) AS i), per_touchpoint AS (SELECT per_conversion.person_id AS person_id, per_conversion.i AS i, per_conversion.conversion_value AS conversion_value, per_conversion.dims[k] AS breakdown_value, per_conversion.w_first[k] AS w_first, per_conversion.w_last[k] AS w_last, per_conversion.w_linear[k] AS w_linear, per_conversion.w_decay[k] AS w_decay, per_conversion.w_position[k] AS w_positionFROM per_conversion ARRAY JOIN arrayEnumerate(per_conversion.touch_ts) AS k), per_conversion_dim AS (@@ -177,7 +177,7 @@SELECT per_conversion_dim.breakdown_value AS breakdown_value, count() AS influenced_conversions, sum(per_conversion_dim.conv_value) AS influenced_value, sum(per_conversion_dim.w_first) AS w_first_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_first)) AS w_first_value, sum(per_conversion_dim.w_last) AS w_last_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_last)) AS w_last_value, sum(per_conversion_dim.w_linear) AS w_linear_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_linear)) AS w_linear_value, sum(per_conversion_dim.w_decay) AS w_decay_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_decay)) AS w_decay_value, sum(per_conversion_dim.w_position) AS w_position_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_position)) AS w_position_valueFROM per_conversion_dimGROUP BY per_conversion_dim.breakdown_value), attribution_rows AS (- SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_300)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_key+ SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_302)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_keyFROM attribution_totals FULL OUTER JOIN influenced_reach ON equals(attribution_totals.breakdown_value, influenced_reach.breakdown_value)), attribution_footer AS (SELECT sumIf(per_conversion.conversion_count, ifNull(equals(per_conversion.i, 1), 0)) AS total_conversions, countIf(ifNull(greater(length(per_conversion.tps), 0), 0)) AS attributed_conversions, 1 AS footer_keyFROM per_conversion)@@ -200,18 +200,18 @@WHERE and(equals(web_sessions_dimensional_preaggregated.team_id, 420), in(web_sessions_dimensional_preaggregated.job_id, tuple(%(hogql_val_12)s))) UNION ALLSELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priorityFROM (- SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_19)s)), `$start_timestamp`, %(hogql_val_20)s, toString(ifNull(`$entry_utm_source`, %(hogql_val_21)s)), %(hogql_val_22)s, toString(ifNull(`$entry_utm_campaign`, %(hogql_val_23)s)), %(hogql_val_24)s, %(hogql_val_25)s, %(hogql_val_26)s, %(hogql_val_27)s) AS dimensions, now64(6, %(hogql_val_28)s) AS computed_at, 1 AS source_priority+ SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_21)s)), `$start_timestamp`, %(hogql_val_22)s, toString(ifNull(`$entry_utm_source`, %(hogql_val_23)s)), %(hogql_val_24)s, toString(ifNull(`$entry_utm_campaign`, %(hogql_val_25)s)), %(hogql_val_26)s, %(hogql_val_27)s, %(hogql_val_28)s, %(hogql_val_29)s) AS dimensions, now64(6, %(hogql_val_30)s) AS computed_at, 1 AS source_priorityFROM (SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_13)s)) AS `$start_timestamp`, max(toTimeZone(raw_sessions.max_timestamp, %(hogql_val_14)s)) AS `$end_timestamp`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_15)s), %(hogql_val_16)s) AS `$entry_utm_source`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_17)s), %(hogql_val_18)s) AS `$entry_utm_campaign`, raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessions- WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1))), greater(raw_sessions.max_timestamp, plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800))))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, toDateTime64(minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1)), 6, %(hogql_val_19)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 6, %(hogql_val_20)s)))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))GROUP BY raw_sessions.session_id_v7HAVING and(greaterOrEquals(`$end_timestamp`, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(`$start_timestamp`, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')), or(less(`$start_timestamp`, toDateTime64('2022-12-27 00:00:00.000000', 6, 'UTC')), greater(`$end_timestamp`, plus(`$start_timestamp`, toIntervalSecond(259200)))))))) AS dGROUP BY d.session_id_v7)), identities AS (- SELECT toUInt128(toUUIDOrNull(events.properties.`$session_id`)) AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_29)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_30)s)) AS max_event_timestamp, count() AS pageview_count+ SELECT toUInt128(toUUIDOrNull(events.properties.`$session_id`)) AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_31)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_32)s)) AS max_event_timestamp, count() AS pageview_countFROM 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_idFROM person_distinct_id_overrides@@ -219,11 +219,11 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_31)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_33)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))GROUP BY session_id_v7, person_id)SELECT i.session_id_v7 AS session_id_v7, i.person_id AS person_id, toTimeZone(i.min_event_timestamp, %(hogql_val_0)s) AS min_event_timestamp, toTimeZone(i.max_event_timestamp, %(hogql_val_1)s) AS max_event_timestamp, i.pageview_count AS pageview_count, (d.latest).1 AS period_bucket, (d.latest).2 AS start_timestamp, (d.latest).3 AS channel_type, (d.latest).4 AS utm_source, (d.latest).5 AS utm_medium, (d.latest).6 AS utm_campaign, (d.latest).7 AS utm_term, (d.latest).8 AS utm_content, (d.latest).9 AS referring_domain, (d.latest).10 AS entry_pathname, toTimeZone(d.computed_at, %(hogql_val_2)s) AS computed_atFROM identities AS i INNER JOIN dimensions AS d ON equals(i.session_id_v7, d.session_id_v7)), cached_session_conversions AS MATERIALIZED (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_32)s)), coalesce(accurateCastOrNull(events.properties.revenue, 'Float64'), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_33)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_34)s))) AS last_conversion+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_34)s)), coalesce(accurateCastOrNull(events.properties.revenue, 'Float64'), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_35)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_36)s))) AS last_conversionFROM 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_idFROM person_distinct_id_overrides@@ -231,11 +231,11 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_35)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_36)s, %(hogql_val_37)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_38)s, 6, %(hogql_val_39)s)))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_37)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_38)s, %(hogql_val_39)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_40)s, 6, %(hogql_val_41)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)), influenced_reach AS (SELECT s.breakdown_value AS breakdown_value, uniq(s.person_id) AS visitorsFROM (- SELECT cached_sessions.person_id AS person_id, toString(ifNull(cached_sessions.utm_campaign, %(hogql_val_40)s)) AS breakdown_value+ SELECT cached_sessions.person_id AS person_id, toString(ifNull(cached_sessions.utm_campaign, %(hogql_val_42)s)) AS breakdown_valueFROM resolved_cached_sessions AS cached_sessionsWHERE and(greaterOrEquals(cached_sessions.max_event_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(cached_sessions.min_event_timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))) AS sGROUP BY s.breakdown_value), person_arrays AS (@@ -245,7 +245,7 @@FROM cached_session_conversions) AS c LEFT JOIN (SELECT d.person_id AS person_id, arraySlice(arraySort(groupUniqArray(tuple(d.session_ts, d.session_dim))), -500) AS touchpointsFROM (- SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, toString(ifNull(cached_sessions.utm_campaign, %(hogql_val_41)s)) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_bound+ SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, toString(ifNull(cached_sessions.utm_campaign, %(hogql_val_43)s)) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_boundFROM resolved_cached_sessions AS cached_sessions INNER JOIN (SELECT cached_session_conversions.conv_person_id AS conv_person_id, cached_session_conversions.first_conversion AS first_conversion, cached_session_conversions.last_conversion AS last_conversionFROM cached_session_conversions) AS conv ON equals(cached_sessions.person_id, conv.conv_person_id)@@ -253,7 +253,7 @@WHERE and(ifNull(greaterOrEquals(d.session_ts, minus(d.first_conversion, 345600)), 0), ifNull(lessOrEquals(d.session_ts, d.upper_bound), 0))GROUP BY d.person_id) AS t ON equals(c.conv_person_id, t.person_id)WHERE ifNull(greater(length(c.conversions), 0), 0)), per_conversion AS MATERIALIZED (- SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_42)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_43)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_44)s), 2.0), 1.0)))), touch_ts)))))) AS w_position+ SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_44)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_45)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_46)s), 2.0), 1.0)))), touch_ts)))))) AS w_positionFROM person_arrays ARRAY JOIN arrayEnumerate(person_arrays.conversions) AS i), per_touchpoint AS (SELECT per_conversion.person_id AS person_id, per_conversion.i AS i, per_conversion.conversion_value AS conversion_value, per_conversion.dims[k] AS breakdown_value, per_conversion.w_first[k] AS w_first, per_conversion.w_last[k] AS w_last, per_conversion.w_linear[k] AS w_linear, per_conversion.w_decay[k] AS w_decay, per_conversion.w_position[k] AS w_positionFROM per_conversion ARRAY JOIN arrayEnumerate(per_conversion.touch_ts) AS k), per_conversion_dim AS (@@ -263,7 +263,7 @@SELECT per_conversion_dim.breakdown_value AS breakdown_value, count() AS influenced_conversions, sum(per_conversion_dim.conv_value) AS influenced_value, sum(per_conversion_dim.w_first) AS w_first_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_first)) AS w_first_value, sum(per_conversion_dim.w_last) AS w_last_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_last)) AS w_last_value, sum(per_conversion_dim.w_linear) AS w_linear_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_linear)) AS w_linear_value, sum(per_conversion_dim.w_decay) AS w_decay_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_decay)) AS w_decay_value, sum(per_conversion_dim.w_position) AS w_position_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_position)) AS w_position_valueFROM per_conversion_dimGROUP BY per_conversion_dim.breakdown_value), attribution_rows AS (- SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_45)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_key+ SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_47)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_keyFROM attribution_totals FULL OUTER JOIN influenced_reach ON equals(attribution_totals.breakdown_value, influenced_reach.breakdown_value)), attribution_footer AS (SELECT sumIf(per_conversion.conversion_count, ifNull(equals(per_conversion.i, 1), 0)) AS total_conversions, countIf(ifNull(greater(length(per_conversion.tps), 0), 0)) AS attributed_conversions, 1 AS footer_keyFROM per_conversion)@@ -287,18 +287,18 @@WHERE and(equals(web_sessions_dimensional_preaggregated.team_id, 420), in(web_sessions_dimensional_preaggregated.job_id, tuple(%(hogql_val_13)s))) UNION ALLSELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priorityFROM (- SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_18)s)), `$start_timestamp`, %(hogql_val_19)s, toString(ifNull(`$entry_utm_source`, %(hogql_val_20)s)), %(hogql_val_21)s, %(hogql_val_22)s, %(hogql_val_23)s, %(hogql_val_24)s, %(hogql_val_25)s, %(hogql_val_26)s) AS dimensions, now64(6, %(hogql_val_27)s) AS computed_at, 1 AS source_priority+ SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_20)s)), `$start_timestamp`, %(hogql_val_21)s, toString(ifNull(`$entry_utm_source`, %(hogql_val_22)s)), %(hogql_val_23)s, %(hogql_val_24)s, %(hogql_val_25)s, %(hogql_val_26)s, %(hogql_val_27)s, %(hogql_val_28)s) AS dimensions, now64(6, %(hogql_val_29)s) AS computed_at, 1 AS source_priorityFROM (SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_14)s)) AS `$start_timestamp`, max(toTimeZone(raw_sessions.max_timestamp, %(hogql_val_15)s)) AS `$end_timestamp`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_16)s), %(hogql_val_17)s) AS `$entry_utm_source`, raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessions- WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1))), greater(raw_sessions.max_timestamp, plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800))))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, toDateTime64(minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1)), 6, %(hogql_val_18)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 6, %(hogql_val_19)s)))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))GROUP BY raw_sessions.session_id_v7HAVING and(greaterOrEquals(`$end_timestamp`, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(`$start_timestamp`, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')), or(less(`$start_timestamp`, toDateTime64('2022-12-27 00:00:00.000000', 6, 'UTC')), greater(`$end_timestamp`, plus(`$start_timestamp`, toIntervalSecond(259200)))))))) AS dGROUP BY d.session_id_v7)), identities AS (- SELECT toUInt128(toUUIDOrNull(events.properties.`$session_id`)) AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_28)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_29)s)) AS max_event_timestamp, count() AS pageview_count+ SELECT toUInt128(toUUIDOrNull(events.properties.`$session_id`)) AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_30)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_31)s)) AS max_event_timestamp, count() AS pageview_countFROM 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_idFROM person_distinct_id_overrides@@ -306,11 +306,11 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_30)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_32)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))GROUP BY session_id_v7, person_id)SELECT i.session_id_v7 AS session_id_v7, i.person_id AS person_id, toTimeZone(i.min_event_timestamp, %(hogql_val_0)s) AS min_event_timestamp, toTimeZone(i.max_event_timestamp, %(hogql_val_1)s) AS max_event_timestamp, i.pageview_count AS pageview_count, (d.latest).1 AS period_bucket, (d.latest).2 AS start_timestamp, (d.latest).3 AS channel_type, (d.latest).4 AS utm_source, (d.latest).5 AS utm_medium, (d.latest).6 AS utm_campaign, (d.latest).7 AS utm_term, (d.latest).8 AS utm_content, (d.latest).9 AS referring_domain, (d.latest).10 AS entry_pathname, toTimeZone(d.computed_at, %(hogql_val_2)s) AS computed_atFROM identities AS i INNER JOIN dimensions AS d ON equals(i.session_id_v7, d.session_id_v7)), cached_session_conversions AS MATERIALIZED (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_31)s)), coalesce(accurateCastOrNull(events.properties.revenue, 'Float64'), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_32)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_33)s))) AS last_conversion+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_33)s)), coalesce(accurateCastOrNull(events.properties.revenue, 'Float64'), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_34)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_35)s))) AS last_conversionFROM 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_idFROM person_distinct_id_overrides@@ -318,11 +318,11 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_34)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_35)s, %(hogql_val_36)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_37)s, 6, %(hogql_val_38)s)))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_36)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_37)s, %(hogql_val_38)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_39)s, 6, %(hogql_val_40)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)), influenced_reach AS (SELECT s.breakdown_value AS breakdown_value, uniq(s.person_id) AS visitorsFROM (- SELECT cached_sessions.person_id AS person_id, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_39)s)), cached_sessions.utm_source, %(hogql_val_40)s)), [%(hogql_val_41)s, %(hogql_val_42)s, %(hogql_val_43)s]), %(hogql_val_44)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_45)s)), cached_sessions.utm_source, %(hogql_val_46)s)), [%(hogql_val_47)s, %(hogql_val_48)s, %(hogql_val_49)s, %(hogql_val_50)s, %(hogql_val_51)s, %(hogql_val_52)s, %(hogql_val_53)s, %(hogql_val_54)s]), %(hogql_val_55)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_56)s)), cached_sessions.utm_source, %(hogql_val_57)s)), [%(hogql_val_58)s]), %(hogql_val_59)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_60)s)), cached_sessions.utm_source, %(hogql_val_61)s)), [%(hogql_val_62)s, %(hogql_val_63)s, %(hogql_val_64)s, %(hogql_val_65)s, %(hogql_val_66)s, %(hogql_val_67)s, %(hogql_val_68)s, %(hogql_val_69)s, %(hogql_val_70)s]), %(hogql_val_71)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_72)s)), cached_sessions.utm_source, %(hogql_val_73)s)), [%(hogql_val_74)s]), %(hogql_val_75)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_76)s)), cached_sessions.utm_source, %(hogql_val_77)s)), [%(hogql_val_78)s, %(hogql_val_79)s]), %(hogql_val_80)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_81)s)), cached_sessions.utm_source, %(hogql_val_82)s)), [%(hogql_val_83)s, %(hogql_val_84)s, %(hogql_val_85)s]), %(hogql_val_86)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_87)s)), cached_sessions.utm_source, %(hogql_val_88)s)), [%(hogql_val_89)s]), %(hogql_val_90)s, if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_91)s)), cached_sessions.utm_source, %(hogql_val_92)s))))))))) AS breakdown_value+ SELECT cached_sessions.person_id AS person_id, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_41)s)), cached_sessions.utm_source, %(hogql_val_42)s)), [%(hogql_val_43)s, %(hogql_val_44)s, %(hogql_val_45)s]), %(hogql_val_46)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_47)s)), cached_sessions.utm_source, %(hogql_val_48)s)), [%(hogql_val_49)s, %(hogql_val_50)s, %(hogql_val_51)s, %(hogql_val_52)s, %(hogql_val_53)s, %(hogql_val_54)s, %(hogql_val_55)s, %(hogql_val_56)s]), %(hogql_val_57)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_58)s)), cached_sessions.utm_source, %(hogql_val_59)s)), [%(hogql_val_60)s]), %(hogql_val_61)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_62)s)), cached_sessions.utm_source, %(hogql_val_63)s)), [%(hogql_val_64)s, %(hogql_val_65)s, %(hogql_val_66)s, %(hogql_val_67)s, %(hogql_val_68)s, %(hogql_val_69)s, %(hogql_val_70)s, %(hogql_val_71)s, %(hogql_val_72)s]), %(hogql_val_73)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_74)s)), cached_sessions.utm_source, %(hogql_val_75)s)), [%(hogql_val_76)s]), %(hogql_val_77)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_78)s)), cached_sessions.utm_source, %(hogql_val_79)s)), [%(hogql_val_80)s, %(hogql_val_81)s]), %(hogql_val_82)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_83)s)), cached_sessions.utm_source, %(hogql_val_84)s)), [%(hogql_val_85)s, %(hogql_val_86)s, %(hogql_val_87)s]), %(hogql_val_88)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_89)s)), cached_sessions.utm_source, %(hogql_val_90)s)), [%(hogql_val_91)s]), %(hogql_val_92)s, if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_93)s)), cached_sessions.utm_source, %(hogql_val_94)s))))))))) AS breakdown_valueFROM resolved_cached_sessions AS cached_sessionsWHERE and(greaterOrEquals(cached_sessions.max_event_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(cached_sessions.min_event_timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))) AS sGROUP BY s.breakdown_value), person_arrays AS (@@ -332,7 +332,7 @@FROM cached_session_conversions) AS c LEFT JOIN (SELECT d.person_id AS person_id, arraySlice(arraySort(groupUniqArray(tuple(d.session_ts, d.session_dim))), -500) AS touchpointsFROM (- SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_93)s)), cached_sessions.utm_source, %(hogql_val_94)s)), [%(hogql_val_95)s, %(hogql_val_96)s, %(hogql_val_97)s]), %(hogql_val_98)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_99)s)), cached_sessions.utm_source, %(hogql_val_100)s)), [%(hogql_val_101)s, %(hogql_val_102)s, %(hogql_val_103)s, %(hogql_val_104)s, %(hogql_val_105)s, %(hogql_val_106)s, %(hogql_val_107)s, %(hogql_val_108)s]), %(hogql_val_109)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_110)s)), cached_sessions.utm_source, %(hogql_val_111)s)), [%(hogql_val_112)s]), %(hogql_val_113)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_114)s)), cached_sessions.utm_source, %(hogql_val_115)s)), [%(hogql_val_116)s, %(hogql_val_117)s, %(hogql_val_118)s, %(hogql_val_119)s, %(hogql_val_120)s, %(hogql_val_121)s, %(hogql_val_122)s, %(hogql_val_123)s, %(hogql_val_124)s]), %(hogql_val_125)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_126)s)), cached_sessions.utm_source, %(hogql_val_127)s)), [%(hogql_val_128)s]), %(hogql_val_129)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_130)s)), cached_sessions.utm_source, %(hogql_val_131)s)), [%(hogql_val_132)s, %(hogql_val_133)s]), %(hogql_val_134)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_135)s)), cached_sessions.utm_source, %(hogql_val_136)s)), [%(hogql_val_137)s, %(hogql_val_138)s, %(hogql_val_139)s]), %(hogql_val_140)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_141)s)), cached_sessions.utm_source, %(hogql_val_142)s)), [%(hogql_val_143)s]), %(hogql_val_144)s, if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_145)s)), cached_sessions.utm_source, %(hogql_val_146)s))))))))) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_bound+ SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_95)s)), cached_sessions.utm_source, %(hogql_val_96)s)), [%(hogql_val_97)s, %(hogql_val_98)s, %(hogql_val_99)s]), %(hogql_val_100)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_101)s)), cached_sessions.utm_source, %(hogql_val_102)s)), [%(hogql_val_103)s, %(hogql_val_104)s, %(hogql_val_105)s, %(hogql_val_106)s, %(hogql_val_107)s, %(hogql_val_108)s, %(hogql_val_109)s, %(hogql_val_110)s]), %(hogql_val_111)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_112)s)), cached_sessions.utm_source, %(hogql_val_113)s)), [%(hogql_val_114)s]), %(hogql_val_115)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_116)s)), cached_sessions.utm_source, %(hogql_val_117)s)), [%(hogql_val_118)s, %(hogql_val_119)s, %(hogql_val_120)s, %(hogql_val_121)s, %(hogql_val_122)s, %(hogql_val_123)s, %(hogql_val_124)s, %(hogql_val_125)s, %(hogql_val_126)s]), %(hogql_val_127)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_128)s)), cached_sessions.utm_source, %(hogql_val_129)s)), [%(hogql_val_130)s]), %(hogql_val_131)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_132)s)), cached_sessions.utm_source, %(hogql_val_133)s)), [%(hogql_val_134)s, %(hogql_val_135)s]), %(hogql_val_136)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_137)s)), cached_sessions.utm_source, %(hogql_val_138)s)), [%(hogql_val_139)s, %(hogql_val_140)s, %(hogql_val_141)s]), %(hogql_val_142)s, if(in(lower(if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_143)s)), cached_sessions.utm_source, %(hogql_val_144)s)), [%(hogql_val_145)s]), %(hogql_val_146)s, if(notEmpty(ifNull(cached_sessions.utm_source, %(hogql_val_147)s)), cached_sessions.utm_source, %(hogql_val_148)s))))))))) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_boundFROM resolved_cached_sessions AS cached_sessions INNER JOIN (SELECT cached_session_conversions.conv_person_id AS conv_person_id, cached_session_conversions.first_conversion AS first_conversion, cached_session_conversions.last_conversion AS last_conversionFROM cached_session_conversions) AS conv ON equals(cached_sessions.person_id, conv.conv_person_id)@@ -340,7 +340,7 @@WHERE and(ifNull(greaterOrEquals(d.session_ts, minus(d.first_conversion, 345600)), 0), ifNull(lessOrEquals(d.session_ts, d.upper_bound), 0))GROUP BY d.person_id) AS t ON equals(c.conv_person_id, t.person_id)WHERE ifNull(greater(length(c.conversions), 0), 0)), per_conversion AS MATERIALIZED (- SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_147)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_148)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_149)s), 2.0), 1.0)))), touch_ts)))))) AS w_position+ SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_149)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_150)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_151)s), 2.0), 1.0)))), touch_ts)))))) AS w_positionFROM person_arrays ARRAY JOIN arrayEnumerate(person_arrays.conversions) AS i), per_touchpoint AS (SELECT per_conversion.person_id AS person_id, per_conversion.i AS i, per_conversion.conversion_value AS conversion_value, per_conversion.dims[k] AS breakdown_value, per_conversion.w_first[k] AS w_first, per_conversion.w_last[k] AS w_last, per_conversion.w_linear[k] AS w_linear, per_conversion.w_decay[k] AS w_decay, per_conversion.w_position[k] AS w_positionFROM per_conversion ARRAY JOIN arrayEnumerate(per_conversion.touch_ts) AS k), per_conversion_dim AS (@@ -350,7 +350,7 @@SELECT per_conversion_dim.breakdown_value AS breakdown_value, count() AS influenced_conversions, sum(per_conversion_dim.conv_value) AS influenced_value, sum(per_conversion_dim.w_first) AS w_first_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_first)) AS w_first_value, sum(per_conversion_dim.w_last) AS w_last_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_last)) AS w_last_value, sum(per_conversion_dim.w_linear) AS w_linear_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_linear)) AS w_linear_value, sum(per_conversion_dim.w_decay) AS w_decay_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_decay)) AS w_decay_value, sum(per_conversion_dim.w_position) AS w_position_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_position)) AS w_position_valueFROM per_conversion_dimGROUP BY per_conversion_dim.breakdown_value), attribution_rows AS (- SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_150)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_key+ SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_152)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_keyFROM attribution_totals FULL OUTER JOIN influenced_reach ON equals(attribution_totals.breakdown_value, influenced_reach.breakdown_value)), attribution_footer AS (SELECT sumIf(per_conversion.conversion_count, ifNull(equals(per_conversion.i, 1), 0)) AS total_conversions, countIf(ifNull(greater(length(per_conversion.tps), 0), 0)) AS attributed_conversions, 1 AS footer_keyFROM per_conversion)@@ -374,18 +374,18 @@WHERE and(equals(web_sessions_dimensional_preaggregated.team_id, 420), in(web_sessions_dimensional_preaggregated.job_id, tuple(%(hogql_val_13)s))) UNION ALLSELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priorityFROM (- SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_135)s)), `$start_timestamp`, if(notEmpty(ifNull(`$channel_type`, %(hogql_val_136)s)), `$channel_type`, %(hogql_val_137)s), %(hogql_val_138)s, %(hogql_val_139)s, %(hogql_val_140)s, %(hogql_val_141)s, %(hogql_val_142)s, %(hogql_val_143)s, %(hogql_val_144)s) AS dimensions, now64(6, %(hogql_val_145)s) AS computed_at, 1 AS source_priority+ SELECT session_id_v7 AS session_id_v7, tuple(toStartOfHour(toTimeZone(`$start_timestamp`, %(hogql_val_137)s)), `$start_timestamp`, if(notEmpty(ifNull(`$channel_type`, %(hogql_val_138)s)), `$channel_type`, %(hogql_val_139)s), %(hogql_val_140)s, %(hogql_val_141)s, %(hogql_val_142)s, %(hogql_val_143)s, %(hogql_val_144)s, %(hogql_val_145)s, %(hogql_val_146)s) AS dimensions, now64(6, %(hogql_val_147)s) AS computed_at, 1 AS source_priorityFROM (SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_14)s)) AS `$start_timestamp`, max(toTimeZone(raw_sessions.max_timestamp, %(hogql_val_15)s)) AS `$end_timestamp`, multiIf(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_16)s), %(hogql_val_17)s), %(hogql_val_18)s), %(hogql_val_19)s)), %(hogql_val_20)s), %(hogql_val_21)s, or(in(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_22)s), %(hogql_val_23)s), %(hogql_val_24)s), %(hogql_val_25)s)), tuple(%(hogql_val_26)s, %(hogql_val_27)s, %(hogql_val_28)s, %(hogql_val_29)s, %(hogql_val_30)s, %(hogql_val_31)s)), startsWith(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_32)s), %(hogql_val_33)s), %(hogql_val_34)s), %(hogql_val_35)s)), %(hogql_val_36)s), isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_gclid), %(hogql_val_37)s), %(hogql_val_38)s)), isNotNull(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_gad_source), %(hogql_val_39)s), %(hogql_val_40)s), %(hogql_val_41)s), %(hogql_val_42)s))), coalesce(coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_43)s), %(hogql_val_44)s), %(hogql_val_45)s), %(hogql_val_46)s)), ''), 'source')) , dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (cutToFirstSignificantSubdomain(coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_43)s), %(hogql_val_44)s), %(hogql_val_45)s), %(hogql_val_46)s)), '')), 'source'))), if(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_47)s), %(hogql_val_48)s), %(hogql_val_49)s), %(hogql_val_50)s)), %(hogql_val_51)s), %(hogql_val_52)s, NULL), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_53)s), %(hogql_val_54)s), %(hogql_val_55)s), %(hogql_val_56)s)), ''), 'medium')), coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_57)s), %(hogql_val_58)s), ''), 'source')) , dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_paid', (cutToFirstSignificantSubdomain(coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_57)s), %(hogql_val_58)s), '')), 'source'))), multiIf(ifNull(equals(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_gad_source), %(hogql_val_59)s), %(hogql_val_60)s), %(hogql_val_61)s), %(hogql_val_62)s), %(hogql_val_63)s), 0), %(hogql_val_64)s, match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_65)s), %(hogql_val_66)s), %(hogql_val_67)s), %(hogql_val_68)s)), %(hogql_val_69)s), %(hogql_val_70)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_71)s), %(hogql_val_72)s)), %(hogql_val_73)s, %(hogql_val_74)s)), and(ifNull(equals(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_75)s), %(hogql_val_76)s), %(hogql_val_77)s), 0), isNull(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_78)s), %(hogql_val_79)s), %(hogql_val_80)s), %(hogql_val_81)s))), or(isNull(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_82)s), %(hogql_val_83)s), %(hogql_val_84)s), %(hogql_val_85)s))), in(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_86)s), %(hogql_val_87)s), %(hogql_val_88)s), %(hogql_val_89)s)), tuple(%(hogql_val_90)s, %(hogql_val_91)s, %(hogql_val_92)s))), not(isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_93)s), %(hogql_val_94)s)))), %(hogql_val_95)s, coalesce(coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_96)s), %(hogql_val_97)s), %(hogql_val_98)s), %(hogql_val_99)s)), ''), 'source')), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (cutToFirstSignificantSubdomain(coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_96)s), %(hogql_val_97)s), %(hogql_val_98)s), %(hogql_val_99)s)), '')), 'source'))), if(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_100)s), %(hogql_val_101)s), %(hogql_val_102)s), %(hogql_val_103)s)), %(hogql_val_104)s), %(hogql_val_105)s, NULL), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_106)s), %(hogql_val_107)s), %(hogql_val_108)s), %(hogql_val_109)s)), ''), 'medium')), coalesce(dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_110)s), %(hogql_val_111)s), ''), 'source')), dictGetOrNull('posthog_test.channel_definition_dict', 'type_if_organic', (cutToFirstSignificantSubdomain(coalesce(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_110)s), %(hogql_val_111)s), '')), 'source'))), multiIf(match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_campaign), %(hogql_val_112)s), %(hogql_val_113)s), %(hogql_val_114)s), %(hogql_val_115)s)), %(hogql_val_116)s), %(hogql_val_117)s, match(lower(nullIf(nullIf(nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_medium), %(hogql_val_118)s), %(hogql_val_119)s), %(hogql_val_120)s), %(hogql_val_121)s)), %(hogql_val_122)s), %(hogql_val_123)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_fbclid), %(hogql_val_124)s), %(hogql_val_125)s)), %(hogql_val_126)s, ifNull(equals(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_127)s), %(hogql_val_128)s), %(hogql_val_129)s), 0), %(hogql_val_130)s, isNotNull(nullIf(nullIf(argMinMerge(raw_sessions.initial_referring_domain), %(hogql_val_131)s), %(hogql_val_132)s)), %(hogql_val_133)s, %(hogql_val_134)s))) AS `$channel_type`, raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessions- WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1))), greater(raw_sessions.max_timestamp, plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800))))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')), or(and(greaterOrEquals(raw_sessions.max_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), less(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC'))), less(raw_sessions.min_timestamp, toDateTime64(minus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalDay(1)), 6, %(hogql_val_135)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 6, %(hogql_val_136)s)))))), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2022-12-25 00:00:00.000000', 6, 'UTC')), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toDateTime64('2023-02-03 23:59:59.999999', 6, 'UTC')))GROUP BY raw_sessions.session_id_v7HAVING and(greaterOrEquals(`$end_timestamp`, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(`$start_timestamp`, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')), or(less(`$start_timestamp`, toDateTime64('2022-12-27 00:00:00.000000', 6, 'UTC')), greater(`$end_timestamp`, plus(`$start_timestamp`, toIntervalSecond(259200)))))))) AS dGROUP BY d.session_id_v7)), identities AS (- SELECT toUInt128(toUUIDOrNull(events.properties.`$session_id`)) AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_146)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_147)s)) AS max_event_timestamp, count() AS pageview_count+ SELECT toUInt128(toUUIDOrNull(events.properties.`$session_id`)) AS session_id_v7, if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id, min(toTimeZone(events.timestamp, %(hogql_val_148)s)) AS min_event_timestamp, max(toTimeZone(events.timestamp, %(hogql_val_149)s)) AS max_event_timestamp, count() AS pageview_countFROM 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_idFROM person_distinct_id_overrides@@ -393,11 +393,11 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_148)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_150)s), greaterOrEquals(events.timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(events.timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))GROUP BY session_id_v7, person_id)SELECT i.session_id_v7 AS session_id_v7, i.person_id AS person_id, toTimeZone(i.min_event_timestamp, %(hogql_val_0)s) AS min_event_timestamp, toTimeZone(i.max_event_timestamp, %(hogql_val_1)s) AS max_event_timestamp, i.pageview_count AS pageview_count, (d.latest).1 AS period_bucket, (d.latest).2 AS start_timestamp, (d.latest).3 AS channel_type, (d.latest).4 AS utm_source, (d.latest).5 AS utm_medium, (d.latest).6 AS utm_campaign, (d.latest).7 AS utm_term, (d.latest).8 AS utm_content, (d.latest).9 AS referring_domain, (d.latest).10 AS entry_pathname, toTimeZone(d.computed_at, %(hogql_val_2)s) AS computed_atFROM identities AS i INNER JOIN dimensions AS d ON equals(i.session_id_v7, d.session_id_v7)), cached_session_conversions AS MATERIALIZED (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_149)s)), coalesce(accurateCastOrNull(events.properties.revenue, 'Float64'), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_150)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_151)s))) AS last_conversion+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS conv_person_id, arraySlice(arraySort(groupArray(tuple(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_151)s)), coalesce(accurateCastOrNull(events.properties.revenue, 'Float64'), 0.0)))), -500) AS conversions, count() AS conversion_count, min(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_152)s))) AS first_conversion, max(toUnixTimestamp(toTimeZone(events.timestamp, %(hogql_val_153)s))) AS last_conversionFROM 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_idFROM person_distinct_id_overrides@@ -405,11 +405,11 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_152)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_153)s, %(hogql_val_154)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_155)s, 6, %(hogql_val_156)s)))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_154)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_155)s, %(hogql_val_156)s)), lessOrEquals(events.timestamp, toDateTime64(%(hogql_val_157)s, 6, %(hogql_val_158)s)))GROUP BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id)), influenced_reach AS (SELECT s.breakdown_value AS breakdown_value, uniq(s.person_id) AS visitorsFROM (- SELECT cached_sessions.person_id AS person_id, if(notEmpty(ifNull(cached_sessions.channel_type, %(hogql_val_157)s)), cached_sessions.channel_type, %(hogql_val_158)s) AS breakdown_value+ SELECT cached_sessions.person_id AS person_id, if(notEmpty(ifNull(cached_sessions.channel_type, %(hogql_val_159)s)), cached_sessions.channel_type, %(hogql_val_160)s) AS breakdown_valueFROM resolved_cached_sessions AS cached_sessionsWHERE and(greaterOrEquals(cached_sessions.max_event_timestamp, toDateTime64('2022-12-28 00:00:00.000000', 6, 'UTC')), lessOrEquals(cached_sessions.min_event_timestamp, toDateTime64('2023-01-31 23:59:59.999999', 6, 'UTC')))) AS sGROUP BY s.breakdown_value), person_arrays AS (@@ -419,7 +419,7 @@FROM cached_session_conversions) AS c LEFT JOIN (SELECT d.person_id AS person_id, arraySlice(arraySort(groupUniqArray(tuple(d.session_ts, d.session_dim))), -500) AS touchpointsFROM (- SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, if(notEmpty(ifNull(cached_sessions.channel_type, %(hogql_val_159)s)), cached_sessions.channel_type, %(hogql_val_160)s) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_bound+ SELECT conv.conv_person_id AS person_id, toUnixTimestamp(cached_sessions.start_timestamp) AS session_ts, if(notEmpty(ifNull(cached_sessions.channel_type, %(hogql_val_161)s)), cached_sessions.channel_type, %(hogql_val_162)s) AS session_dim, conv.first_conversion AS first_conversion, conv.last_conversion AS upper_boundFROM resolved_cached_sessions AS cached_sessions INNER JOIN (SELECT cached_session_conversions.conv_person_id AS conv_person_id, cached_session_conversions.first_conversion AS first_conversion, cached_session_conversions.last_conversion AS last_conversionFROM cached_session_conversions) AS conv ON equals(cached_sessions.person_id, conv.conv_person_id)@@ -427,7 +427,7 @@WHERE and(ifNull(greaterOrEquals(d.session_ts, minus(d.first_conversion, 345600)), 0), ifNull(lessOrEquals(d.session_ts, d.upper_bound), 0))GROUP BY d.person_id) AS t ON equals(c.conv_person_id, t.person_id)WHERE ifNull(greater(length(c.conversions), 0), 0)), per_conversion AS MATERIALIZED (- SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_161)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_162)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_163)s), 2.0), 1.0)))), touch_ts)))))) AS w_position+ SELECT person_arrays.person_id AS person_id, i, person_arrays.conversion_count AS conversion_count, (person_arrays.conversions[i]).1 AS conversion_time, (person_arrays.conversions[i]).2 AS conversion_value, arrayFilter(t -> and(ifNull(lessOrEquals(t.1, conversion_time), 0), ifNull(greaterOrEquals(t.1, minus(conversion_time, 345600)), 0)), person_arrays.touchpoints) AS tps, arrayMap(t -> t.1, tps) AS touch_ts, arrayMap(t -> t.2, tps) AS dims, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMin(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMin(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_first, arrayMap(_j -> if(ifNull(equals(_j, indexOf(touch_ts, arrayMax(touch_ts))), isNull(_j) and isNull(indexOf(touch_ts, arrayMax(touch_ts)))), 1.0, 0.0), arrayEnumerate(touch_ts)) AS w_last, arrayMap(_x -> divide(1.0, greatest(accurateCastOrNull(length(touch_ts), %(hogql_val_163)s), 1.0)), touch_ts) AS w_linear, arrayMap(w -> divide(w, greatest(arraySum(arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)), 1e-06)), arrayMap(ts -> exp(multiply(-0.6931471805599453, divide(minus(conversion_time, ts), 86400))), touch_ts)) AS w_decay, if(ifNull(equals(length(touch_ts), 0), 0), [], if(ifNull(equals(length(touch_ts), 1), 0), [1.0], if(ifNull(equals(length(touch_ts), 2), 0), [0.5, 0.5], arrayMap(w -> divide(w, greatest(arraySum(arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_164)s), 2.0), 1.0)))), touch_ts))), 1e-06)), arrayMap(_pw -> ifNull(_pw, 0.0), arrayMap(ts -> if(ifNull(equals(ts, arrayMin(touch_ts)), isNull(ts) and isNull(arrayMin(touch_ts))), 0.4, if(ifNull(equals(ts, arrayMax(touch_ts)), isNull(ts) and isNull(arrayMax(touch_ts))), 0.4, divide(0.2, greatest(minus(accurateCastOrNull(length(touch_ts), %(hogql_val_165)s), 2.0), 1.0)))), touch_ts)))))) AS w_positionFROM person_arrays ARRAY JOIN arrayEnumerate(person_arrays.conversions) AS i), per_touchpoint AS (SELECT per_conversion.person_id AS person_id, per_conversion.i AS i, per_conversion.conversion_value AS conversion_value, per_conversion.dims[k] AS breakdown_value, per_conversion.w_first[k] AS w_first, per_conversion.w_last[k] AS w_last, per_conversion.w_linear[k] AS w_linear, per_conversion.w_decay[k] AS w_decay, per_conversion.w_position[k] AS w_positionFROM per_conversion ARRAY JOIN arrayEnumerate(per_conversion.touch_ts) AS k), per_conversion_dim AS (@@ -437,7 +437,7 @@SELECT per_conversion_dim.breakdown_value AS breakdown_value, count() AS influenced_conversions, sum(per_conversion_dim.conv_value) AS influenced_value, sum(per_conversion_dim.w_first) AS w_first_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_first)) AS w_first_value, sum(per_conversion_dim.w_last) AS w_last_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_last)) AS w_last_value, sum(per_conversion_dim.w_linear) AS w_linear_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_linear)) AS w_linear_value, sum(per_conversion_dim.w_decay) AS w_decay_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_decay)) AS w_decay_value, sum(per_conversion_dim.w_position) AS w_position_conversions, sum(multiply(per_conversion_dim.conv_value, per_conversion_dim.w_position)) AS w_position_valueFROM per_conversion_dimGROUP BY per_conversion_dim.breakdown_value), attribution_rows AS (- SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_164)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_key+ SELECT coalesce(nullIf(attribution_totals.breakdown_value, %(hogql_val_166)s), influenced_reach.breakdown_value) AS breakdown_value, ifNull(influenced_reach.visitors, 0) AS visitors, ifNull(attribution_totals.influenced_conversions, 0) AS influenced_conversions, ifNull(attribution_totals.influenced_value, 0.0) AS influenced_value, ifNull(attribution_totals.w_first_conversions, 0.0) AS w_first_conversions, ifNull(attribution_totals.w_first_value, 0.0) AS w_first_value, ifNull(attribution_totals.w_last_conversions, 0.0) AS w_last_conversions, ifNull(attribution_totals.w_last_value, 0.0) AS w_last_value, ifNull(attribution_totals.w_linear_conversions, 0.0) AS w_linear_conversions, ifNull(attribution_totals.w_linear_value, 0.0) AS w_linear_value, ifNull(attribution_totals.w_decay_conversions, 0.0) AS w_decay_conversions, ifNull(attribution_totals.w_decay_value, 0.0) AS w_decay_value, ifNull(attribution_totals.w_position_conversions, 0.0) AS w_position_conversions, ifNull(attribution_totals.w_position_value, 0.0) AS w_position_value, 1 AS footer_keyFROM attribution_totals FULL OUTER JOIN influenced_reach ON equals(attribution_totals.breakdown_value, influenced_reach.breakdown_value)), attribution_footer AS (SELECT sumIf(per_conversion.conversion_count, ifNull(equals(per_conversion.i, 1), 0)) AS total_conversions, countIf(ifNull(greater(length(per_conversion.tps), 0), 0)) AS attributed_conversions, 1 AS footer_keyFROM per_conversion)diff --git a/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_marketing_retention_query_runner.ambr b/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_marketing_retention_query_runner.ambrindex ad8f8dc3dada..e3ed51a83f22 100644--- a/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_marketing_retention_query_runner.ambr+++ b/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_marketing_retention_query_runner.ambr@@ -148,9 +148,9 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_18)s), notEmpty(events.`$session_id`), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_19)s, %(hogql_val_20)s), toIntervalDay(90))), less(events.timestamp, toDateTime(%(hogql_val_21)s, %(hogql_val_22)s))))))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_18)s), notEmpty(events.`$session_id`), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_19)s, %(hogql_val_20)s), toIntervalDay(90)), 6, %(hogql_val_21)s)), less(events.timestamp, toDateTime(%(hogql_val_22)s, %(hogql_val_23)s))))))GROUP BY actor_id), activity AS (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS actor_id, dateDiff(%(hogql_val_23)s, toStartOfWeek(toDateTime(%(hogql_val_24)s, %(hogql_val_25)s), 0), toStartOfWeek(toTimeZone(events.timestamp, %(hogql_val_26)s), 0)) AS activity_index+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS actor_id, dateDiff(%(hogql_val_24)s, toStartOfWeek(toDateTime(%(hogql_val_25)s, %(hogql_val_26)s), 0), toStartOfWeek(toTimeZone(events.timestamp, %(hogql_val_27)s), 0)) AS activity_indexFROM 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_idFROM person_distinct_id_overrides@@ -158,14 +158,14 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_27)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_28)s, %(hogql_val_29)s)), lessOrEquals(events.timestamp, toDateTime(%(hogql_val_30)s, %(hogql_val_31)s)), globalIn(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), (+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_28)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_29)s, %(hogql_val_30)s)), lessOrEquals(events.timestamp, toDateTime(%(hogql_val_31)s, %(hogql_val_32)s)), globalIn(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), (SELECT acquisition.actor_id AS actor_idFROM acquisition)))GROUP BY actor_id, activity_index), cohort_sizes AS MATERIALIZED (- SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_32)s, toStartOfWeek(toDateTime(%(hogql_val_33)s, %(hogql_val_34)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_35)s), 0)) AS cohort_index, count(acquisition.actor_id) AS cohort_size+ SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_33)s, toStartOfWeek(toDateTime(%(hogql_val_34)s, %(hogql_val_35)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_36)s), 0)) AS cohort_index, count(acquisition.actor_id) AS cohort_sizeFROM acquisitionGROUP BY acquisition.breakdown_value, cohort_index), matrix AS (- SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_36)s, toStartOfWeek(toDateTime(%(hogql_val_37)s, %(hogql_val_38)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_39)s), 0)) AS cohort_index, minus(activity.activity_index, dateDiff(%(hogql_val_40)s, toStartOfWeek(toDateTime(%(hogql_val_41)s, %(hogql_val_42)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_43)s), 0))) AS intervals_from_base, count(DISTINCT acquisition.actor_id) AS count+ SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_37)s, toStartOfWeek(toDateTime(%(hogql_val_38)s, %(hogql_val_39)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_40)s), 0)) AS cohort_index, minus(activity.activity_index, dateDiff(%(hogql_val_41)s, toStartOfWeek(toDateTime(%(hogql_val_42)s, %(hogql_val_43)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_44)s), 0))) AS intervals_from_base, count(DISTINCT acquisition.actor_id) AS countFROM acquisition INNER JOIN activity ON equals(activity.actor_id, acquisition.actor_id)GROUP BY acquisition.breakdown_value, cohort_index, intervals_from_baseHAVING and(ifNull(greaterOrEquals(intervals_from_base, 0), 0), ifNull(less(intervals_from_base, 4), 0))), folded_sizes AS (@@ -174,7 +174,7 @@FROM cohort_sizesGROUP BY cohort_sizes.breakdown_valueORDER BY sum(cohort_sizes.cohort_size) DESC, cohort_sizes.breakdown_value ASC- LIMIT 20)), cohort_sizes.breakdown_value, %(hogql_val_44)s) AS breakdown_value, cohort_sizes.cohort_index AS cohort_index, sum(cohort_sizes.cohort_size) AS cohort_size+ LIMIT 20)), cohort_sizes.breakdown_value, %(hogql_val_45)s) AS breakdown_value, cohort_sizes.cohort_index AS cohort_index, sum(cohort_sizes.cohort_size) AS cohort_sizeFROM cohort_sizesGROUP BY breakdown_value, cohort_sizes.cohort_index), folded_matrix AS (SELECT if(globalIn(matrix.breakdown_value, (@@ -182,7 +182,7 @@FROM cohort_sizesGROUP BY cohort_sizes.breakdown_valueORDER BY sum(cohort_sizes.cohort_size) DESC, cohort_sizes.breakdown_value ASC- LIMIT 20)), matrix.breakdown_value, %(hogql_val_45)s) AS breakdown_value, matrix.cohort_index AS cohort_index, matrix.intervals_from_base AS intervals_from_base, sum(matrix.count) AS count+ LIMIT 20)), matrix.breakdown_value, %(hogql_val_46)s) AS breakdown_value, matrix.cohort_index AS cohort_index, matrix.intervals_from_base AS intervals_from_base, sum(matrix.count) AS countFROM matrixGROUP BY breakdown_value, matrix.cohort_index, matrix.intervals_from_base), summary AS (SELECT uniqExact(cohort_sizes.breakdown_value) AS distinct_breakdowns@@ -217,9 +217,9 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_71)s), notEmpty(events.`$session_id`), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_72)s, %(hogql_val_73)s), toIntervalDay(90))), less(events.timestamp, toDateTime(%(hogql_val_74)s, %(hogql_val_75)s))))))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_71)s), notEmpty(events.`$session_id`), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_72)s, %(hogql_val_73)s), toIntervalDay(90)), 6, %(hogql_val_74)s)), less(events.timestamp, toDateTime(%(hogql_val_75)s, %(hogql_val_76)s))))))GROUP BY actor_id), activity AS (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS actor_id, dateDiff(%(hogql_val_76)s, toStartOfWeek(toDateTime(%(hogql_val_77)s, %(hogql_val_78)s), 0), toStartOfWeek(toTimeZone(events.timestamp, %(hogql_val_79)s), 0)) AS activity_index+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS actor_id, dateDiff(%(hogql_val_77)s, toStartOfWeek(toDateTime(%(hogql_val_78)s, %(hogql_val_79)s), 0), toStartOfWeek(toTimeZone(events.timestamp, %(hogql_val_80)s), 0)) AS activity_indexFROM 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_idFROM person_distinct_id_overrides@@ -227,14 +227,14 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_80)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_81)s, %(hogql_val_82)s)), lessOrEquals(events.timestamp, toDateTime(%(hogql_val_83)s, %(hogql_val_84)s)), globalIn(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), (+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_81)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_82)s, %(hogql_val_83)s)), lessOrEquals(events.timestamp, toDateTime(%(hogql_val_84)s, %(hogql_val_85)s)), globalIn(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), (SELECT acquisition.actor_id AS actor_idFROM acquisition)))GROUP BY actor_id, activity_index), cohort_sizes AS MATERIALIZED (- SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_85)s, toStartOfWeek(toDateTime(%(hogql_val_86)s, %(hogql_val_87)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_88)s), 0)) AS cohort_index, count(acquisition.actor_id) AS cohort_size+ SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_86)s, toStartOfWeek(toDateTime(%(hogql_val_87)s, %(hogql_val_88)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_89)s), 0)) AS cohort_index, count(acquisition.actor_id) AS cohort_sizeFROM acquisitionGROUP BY acquisition.breakdown_value, cohort_index), matrix AS (- SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_89)s, toStartOfWeek(toDateTime(%(hogql_val_90)s, %(hogql_val_91)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_92)s), 0)) AS cohort_index, minus(activity.activity_index, dateDiff(%(hogql_val_93)s, toStartOfWeek(toDateTime(%(hogql_val_94)s, %(hogql_val_95)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_96)s), 0))) AS intervals_from_base, count(DISTINCT acquisition.actor_id) AS count+ SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_90)s, toStartOfWeek(toDateTime(%(hogql_val_91)s, %(hogql_val_92)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_93)s), 0)) AS cohort_index, minus(activity.activity_index, dateDiff(%(hogql_val_94)s, toStartOfWeek(toDateTime(%(hogql_val_95)s, %(hogql_val_96)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_97)s), 0))) AS intervals_from_base, count(DISTINCT acquisition.actor_id) AS countFROM acquisition INNER JOIN activity ON equals(activity.actor_id, acquisition.actor_id)GROUP BY acquisition.breakdown_value, cohort_index, intervals_from_baseHAVING and(ifNull(greaterOrEquals(intervals_from_base, 0), 0), ifNull(less(intervals_from_base, 4), 0))), folded_sizes AS (@@ -243,7 +243,7 @@FROM cohort_sizesGROUP BY cohort_sizes.breakdown_valueORDER BY sum(cohort_sizes.cohort_size) DESC, cohort_sizes.breakdown_value ASC- LIMIT 20)), cohort_sizes.breakdown_value, %(hogql_val_97)s) AS breakdown_value, cohort_sizes.cohort_index AS cohort_index, sum(cohort_sizes.cohort_size) AS cohort_size+ LIMIT 20)), cohort_sizes.breakdown_value, %(hogql_val_98)s) AS breakdown_value, cohort_sizes.cohort_index AS cohort_index, sum(cohort_sizes.cohort_size) AS cohort_sizeFROM cohort_sizesGROUP BY breakdown_value, cohort_sizes.cohort_index), folded_matrix AS (SELECT if(globalIn(matrix.breakdown_value, (@@ -251,7 +251,7 @@FROM cohort_sizesGROUP BY cohort_sizes.breakdown_valueORDER BY sum(cohort_sizes.cohort_size) DESC, cohort_sizes.breakdown_value ASC- LIMIT 20)), matrix.breakdown_value, %(hogql_val_98)s) AS breakdown_value, matrix.cohort_index AS cohort_index, matrix.intervals_from_base AS intervals_from_base, sum(matrix.count) AS count+ LIMIT 20)), matrix.breakdown_value, %(hogql_val_99)s) AS breakdown_value, matrix.cohort_index AS cohort_index, matrix.intervals_from_base AS intervals_from_base, sum(matrix.count) AS countFROM matrixGROUP BY breakdown_value, matrix.cohort_index, matrix.intervals_from_base), summary AS (SELECT uniqExact(cohort_sizes.breakdown_value) AS distinct_breakdowns@@ -286,9 +286,9 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_136)s), notEmpty(events.`$session_id`), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_137)s, %(hogql_val_138)s), toIntervalDay(90))), less(events.timestamp, toDateTime(%(hogql_val_139)s, %(hogql_val_140)s))))))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_136)s), notEmpty(events.`$session_id`), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_137)s, %(hogql_val_138)s), toIntervalDay(90)), 6, %(hogql_val_139)s)), less(events.timestamp, toDateTime(%(hogql_val_140)s, %(hogql_val_141)s))))))GROUP BY actor_id), activity AS (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS actor_id, dateDiff(%(hogql_val_141)s, toStartOfWeek(toDateTime(%(hogql_val_142)s, %(hogql_val_143)s), 0), toStartOfWeek(toTimeZone(events.timestamp, %(hogql_val_144)s), 0)) AS activity_index+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS actor_id, dateDiff(%(hogql_val_142)s, toStartOfWeek(toDateTime(%(hogql_val_143)s, %(hogql_val_144)s), 0), toStartOfWeek(toTimeZone(events.timestamp, %(hogql_val_145)s), 0)) AS activity_indexFROM 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_idFROM person_distinct_id_overrides@@ -296,14 +296,14 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_145)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_146)s, %(hogql_val_147)s)), lessOrEquals(events.timestamp, toDateTime(%(hogql_val_148)s, %(hogql_val_149)s)), globalIn(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), (+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_146)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_147)s, %(hogql_val_148)s)), lessOrEquals(events.timestamp, toDateTime(%(hogql_val_149)s, %(hogql_val_150)s)), globalIn(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), (SELECT acquisition.actor_id AS actor_idFROM acquisition)))GROUP BY actor_id, activity_index), cohort_sizes AS MATERIALIZED (- SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_150)s, toStartOfWeek(toDateTime(%(hogql_val_151)s, %(hogql_val_152)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_153)s), 0)) AS cohort_index, count(acquisition.actor_id) AS cohort_size+ SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_151)s, toStartOfWeek(toDateTime(%(hogql_val_152)s, %(hogql_val_153)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_154)s), 0)) AS cohort_index, count(acquisition.actor_id) AS cohort_sizeFROM acquisitionGROUP BY acquisition.breakdown_value, cohort_index), matrix AS (- SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_154)s, toStartOfWeek(toDateTime(%(hogql_val_155)s, %(hogql_val_156)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_157)s), 0)) AS cohort_index, minus(activity.activity_index, dateDiff(%(hogql_val_158)s, toStartOfWeek(toDateTime(%(hogql_val_159)s, %(hogql_val_160)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_161)s), 0))) AS intervals_from_base, count(DISTINCT acquisition.actor_id) AS count+ SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_155)s, toStartOfWeek(toDateTime(%(hogql_val_156)s, %(hogql_val_157)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_158)s), 0)) AS cohort_index, minus(activity.activity_index, dateDiff(%(hogql_val_159)s, toStartOfWeek(toDateTime(%(hogql_val_160)s, %(hogql_val_161)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_162)s), 0))) AS intervals_from_base, count(DISTINCT acquisition.actor_id) AS countFROM acquisition INNER JOIN activity ON equals(activity.actor_id, acquisition.actor_id)GROUP BY acquisition.breakdown_value, cohort_index, intervals_from_baseHAVING and(ifNull(greaterOrEquals(intervals_from_base, 0), 0), ifNull(less(intervals_from_base, 4), 0))), folded_sizes AS (@@ -312,7 +312,7 @@FROM cohort_sizesGROUP BY cohort_sizes.breakdown_valueORDER BY sum(cohort_sizes.cohort_size) DESC, cohort_sizes.breakdown_value ASC- LIMIT 20)), cohort_sizes.breakdown_value, %(hogql_val_162)s) AS breakdown_value, cohort_sizes.cohort_index AS cohort_index, sum(cohort_sizes.cohort_size) AS cohort_size+ LIMIT 20)), cohort_sizes.breakdown_value, %(hogql_val_163)s) AS breakdown_value, cohort_sizes.cohort_index AS cohort_index, sum(cohort_sizes.cohort_size) AS cohort_sizeFROM cohort_sizesGROUP BY breakdown_value, cohort_sizes.cohort_index), folded_matrix AS (SELECT if(globalIn(matrix.breakdown_value, (@@ -320,7 +320,7 @@FROM cohort_sizesGROUP BY cohort_sizes.breakdown_valueORDER BY sum(cohort_sizes.cohort_size) DESC, cohort_sizes.breakdown_value ASC- LIMIT 20)), matrix.breakdown_value, %(hogql_val_163)s) AS breakdown_value, matrix.cohort_index AS cohort_index, matrix.intervals_from_base AS intervals_from_base, sum(matrix.count) AS count+ LIMIT 20)), matrix.breakdown_value, %(hogql_val_164)s) AS breakdown_value, matrix.cohort_index AS cohort_index, matrix.intervals_from_base AS intervals_from_base, sum(matrix.count) AS countFROM matrixGROUP BY breakdown_value, matrix.cohort_index, matrix.intervals_from_base), summary AS (SELECT uniqExact(cohort_sizes.breakdown_value) AS distinct_breakdowns@@ -415,21 +415,21 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_94)s), notEmpty(events.`$session_id`), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_95)s, %(hogql_val_96)s), toIntervalDay(90))), less(events.timestamp, toDateTime(%(hogql_val_97)s, %(hogql_val_98)s))))))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_94)s), notEmpty(events.`$session_id`), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_95)s, %(hogql_val_96)s), toIntervalDay(90)), 6, %(hogql_val_97)s)), less(events.timestamp, toDateTime(%(hogql_val_98)s, %(hogql_val_99)s))))))GROUP BY actor_id UNION ALL- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS actor_id, min(events__session.`$start_timestamp`) AS first_session_at, argMin(if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_107)s)), events__session.`$entry_utm_source`, %(hogql_val_108)s)), [%(hogql_val_109)s, %(hogql_val_110)s, %(hogql_val_111)s]), %(hogql_val_112)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_113)s)), events__session.`$entry_utm_source`, %(hogql_val_114)s)), [%(hogql_val_115)s, %(hogql_val_116)s, %(hogql_val_117)s, %(hogql_val_118)s, %(hogql_val_119)s, %(hogql_val_120)s, %(hogql_val_121)s, %(hogql_val_122)s]), %(hogql_val_123)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_124)s)), events__session.`$entry_utm_source`, %(hogql_val_125)s)), [%(hogql_val_126)s]), %(hogql_val_127)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_128)s)), events__session.`$entry_utm_source`, %(hogql_val_129)s)), [%(hogql_val_130)s, %(hogql_val_131)s, %(hogql_val_132)s, %(hogql_val_133)s, %(hogql_val_134)s, %(hogql_val_135)s, %(hogql_val_136)s, %(hogql_val_137)s, %(hogql_val_138)s]), %(hogql_val_139)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_140)s)), events__session.`$entry_utm_source`, %(hogql_val_141)s)), [%(hogql_val_142)s]), %(hogql_val_143)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_144)s)), events__session.`$entry_utm_source`, %(hogql_val_145)s)), [%(hogql_val_146)s, %(hogql_val_147)s]), %(hogql_val_148)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_149)s)), events__session.`$entry_utm_source`, %(hogql_val_150)s)), [%(hogql_val_151)s, %(hogql_val_152)s, %(hogql_val_153)s]), %(hogql_val_154)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_155)s)), events__session.`$entry_utm_source`, %(hogql_val_156)s)), [%(hogql_val_157)s]), %(hogql_val_158)s, if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_159)s)), events__session.`$entry_utm_source`, %(hogql_val_160)s))))))))), events__session.`$start_timestamp`) AS breakdown_value, 1 AS previous, %(hogql_val_161)s AS observation_end, argMin(events.`$session_id`, events__session.`$start_timestamp`) AS first_session_id+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS actor_id, min(events__session.`$start_timestamp`) AS first_session_at, argMin(if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_108)s)), events__session.`$entry_utm_source`, %(hogql_val_109)s)), [%(hogql_val_110)s, %(hogql_val_111)s, %(hogql_val_112)s]), %(hogql_val_113)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_114)s)), events__session.`$entry_utm_source`, %(hogql_val_115)s)), [%(hogql_val_116)s, %(hogql_val_117)s, %(hogql_val_118)s, %(hogql_val_119)s, %(hogql_val_120)s, %(hogql_val_121)s, %(hogql_val_122)s, %(hogql_val_123)s]), %(hogql_val_124)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_125)s)), events__session.`$entry_utm_source`, %(hogql_val_126)s)), [%(hogql_val_127)s]), %(hogql_val_128)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_129)s)), events__session.`$entry_utm_source`, %(hogql_val_130)s)), [%(hogql_val_131)s, %(hogql_val_132)s, %(hogql_val_133)s, %(hogql_val_134)s, %(hogql_val_135)s, %(hogql_val_136)s, %(hogql_val_137)s, %(hogql_val_138)s, %(hogql_val_139)s]), %(hogql_val_140)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_141)s)), events__session.`$entry_utm_source`, %(hogql_val_142)s)), [%(hogql_val_143)s]), %(hogql_val_144)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_145)s)), events__session.`$entry_utm_source`, %(hogql_val_146)s)), [%(hogql_val_147)s, %(hogql_val_148)s]), %(hogql_val_149)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_150)s)), events__session.`$entry_utm_source`, %(hogql_val_151)s)), [%(hogql_val_152)s, %(hogql_val_153)s, %(hogql_val_154)s]), %(hogql_val_155)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_156)s)), events__session.`$entry_utm_source`, %(hogql_val_157)s)), [%(hogql_val_158)s]), %(hogql_val_159)s, if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_160)s)), events__session.`$entry_utm_source`, %(hogql_val_161)s))))))))), events__session.`$start_timestamp`) AS breakdown_value, 1 AS previous, %(hogql_val_162)s AS observation_end, argMin(events.`$session_id`, events__session.`$start_timestamp`) AS first_session_idFROM events LEFT JOIN (- SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_99)s)) AS `$start_timestamp`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_100)s), %(hogql_val_101)s) AS `$entry_utm_source`, raw_sessions.session_id_v7 AS session_id_v7+ SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_100)s)) AS `$start_timestamp`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_101)s), %(hogql_val_102)s) AS `$entry_utm_source`, raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessions- WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toDateTime(%(hogql_val_102)s, %(hogql_val_103)s), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime(%(hogql_val_104)s, %(hogql_val_105)s), toIntervalDay(3))))- GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.`$session_id`, %(hogql_val_106)s)), events__session.session_id_v7) LEFT OUTER JOIN (+ WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toDateTime(%(hogql_val_103)s, %(hogql_val_104)s), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime(%(hogql_val_105)s, %(hogql_val_106)s), toIntervalDay(3))))+ GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.`$session_id`, %(hogql_val_107)s)), events__session.session_id_v7) 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_idFROM person_distinct_id_overridesWHERE equals(person_distinct_id_overrides.team_id, 420)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), and(equals(events.event, %(hogql_val_162)s), notEmpty(events.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_163)s, %(hogql_val_164)s)), lessOrEquals(events.timestamp, toDateTime(%(hogql_val_165)s, %(hogql_val_166)s)), ifNull(greaterOrEquals(events__session.`$start_timestamp`, toDateTime(%(hogql_val_167)s, %(hogql_val_168)s)), 0), ifNull(lessOrEquals(events__session.`$start_timestamp`, toDateTime(%(hogql_val_169)s, %(hogql_val_170)s)), 0), globalNotIn(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), (+ WHERE and(equals(events.team_id, 420), and(equals(events.event, %(hogql_val_163)s), notEmpty(events.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_164)s, %(hogql_val_165)s)), lessOrEquals(events.timestamp, toDateTime(%(hogql_val_166)s, %(hogql_val_167)s)), ifNull(greaterOrEquals(events__session.`$start_timestamp`, toDateTime(%(hogql_val_168)s, %(hogql_val_169)s)), 0), ifNull(lessOrEquals(events__session.`$start_timestamp`, toDateTime(%(hogql_val_170)s, %(hogql_val_171)s)), 0), globalNotIn(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), (SELECT DISTINCT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_idFROM 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@@ -438,23 +438,23 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_171)s), notEmpty(events.`$session_id`), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_172)s, %(hogql_val_173)s), toIntervalDay(90))), less(events.timestamp, toDateTime(%(hogql_val_174)s, %(hogql_val_175)s))))))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_172)s), notEmpty(events.`$session_id`), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_173)s, %(hogql_val_174)s), toIntervalDay(90)), 6, %(hogql_val_175)s)), less(events.timestamp, toDateTime(%(hogql_val_176)s, %(hogql_val_177)s))))))GROUP BY actor_id), activity AS (SELECT acquisition.actor_id AS actor_id, acquisition.previous AS previous, min(events__session.`$start_timestamp`) AS returned_atFROM events LEFT JOIN (- SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_176)s)) AS `$start_timestamp`, raw_sessions.session_id_v7 AS session_id_v7+ SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_178)s)) AS `$start_timestamp`, raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessions- WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toDateTime(%(hogql_val_177)s, %(hogql_val_178)s), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime(%(hogql_val_179)s, %(hogql_val_180)s), toIntervalDay(3))))- GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.`$session_id`, %(hogql_val_181)s)), events__session.session_id_v7) LEFT OUTER JOIN (+ WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toDateTime(%(hogql_val_179)s, %(hogql_val_180)s), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime(%(hogql_val_181)s, %(hogql_val_182)s), toIntervalDay(3))))+ GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.`$session_id`, %(hogql_val_183)s)), events__session.session_id_v7) 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_idFROM person_distinct_id_overridesWHERE equals(person_distinct_id_overrides.team_id, 420)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id) GLOBAL INNER JOIN acquisition ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), acquisition.actor_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_182)s), notEmpty(events.`$session_id`), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_183)s, %(hogql_val_184)s)), lessOrEquals(events.timestamp, toDateTime(%(hogql_val_185)s, %(hogql_val_186)s)), notEquals(events.`$session_id`, acquisition.first_session_id), greater(toDate(events__session.`$start_timestamp`), toDate(toTimeZone(acquisition.first_session_at, %(hogql_val_187)s))), lessOrEquals(events__session.`$start_timestamp`, plus(toTimeZone(acquisition.first_session_at, %(hogql_val_188)s), toIntervalDay(30))), ifNull(lessOrEquals(events__session.`$start_timestamp`, parseDateTime64BestEffortOrNull(acquisition.observation_end, 6, %(hogql_val_189)s)), 0))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_184)s), notEmpty(events.`$session_id`), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_185)s, %(hogql_val_186)s)), lessOrEquals(events.timestamp, toDateTime(%(hogql_val_187)s, %(hogql_val_188)s)), notEquals(events.`$session_id`, acquisition.first_session_id), greater(toDate(events__session.`$start_timestamp`), toDate(toTimeZone(acquisition.first_session_at, %(hogql_val_189)s))), lessOrEquals(events__session.`$start_timestamp`, plus(toTimeZone(acquisition.first_session_at, %(hogql_val_190)s), toIntervalDay(30))), ifNull(lessOrEquals(events__session.`$start_timestamp`, parseDateTime64BestEffortOrNull(acquisition.observation_end, 6, %(hogql_val_191)s)), 0))GROUP BY actor_id, previous), people AS MATERIALIZED (- SELECT acquisition.actor_id AS actor_id, acquisition.breakdown_value AS breakdown_value, acquisition.previous AS previous, toTimeZone(acquisition.first_session_at, %(hogql_val_190)s) AS first_session_at, parseDateTime64BestEffortOrNull(acquisition.observation_end, 6, %(hogql_val_191)s) AS observation_end, toTimeZone(activity.returned_at, %(hogql_val_192)s) AS returned_at+ SELECT acquisition.actor_id AS actor_id, acquisition.breakdown_value AS breakdown_value, acquisition.previous AS previous, toTimeZone(acquisition.first_session_at, %(hogql_val_192)s) AS first_session_at, parseDateTime64BestEffortOrNull(acquisition.observation_end, 6, %(hogql_val_193)s) AS observation_end, toTimeZone(activity.returned_at, %(hogql_val_194)s) AS returned_atFROM acquisition LEFT JOIN activity ON and(equals(acquisition.actor_id, activity.actor_id), equals(acquisition.previous, activity.previous)))SELECT if(globalIn(people.breakdown_value, (SELECT people.breakdown_value AS breakdown_valuediff --git a/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_marketing_retention_query_runner.new_events_schema.ambr b/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_marketing_retention_query_runner.new_events_schema.ambrindex 155bcbb9af7e..0e28bd78d717 100644--- a/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_marketing_retention_query_runner.new_events_schema.ambr+++ b/products/marketing_analytics/backend/hogql_queries/__snapshots__/test_marketing_retention_query_runner.new_events_schema.ambr@@ -23,9 +23,9 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_18)s), notEmpty(events.properties.`$session_id`), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_19)s, %(hogql_val_20)s), toIntervalDay(90))), less(events.timestamp, toDateTime(%(hogql_val_21)s, %(hogql_val_22)s))))))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_18)s), notEmpty(events.properties.`$session_id`), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_19)s, %(hogql_val_20)s), toIntervalDay(90)), 6, %(hogql_val_21)s)), less(events.timestamp, toDateTime(%(hogql_val_22)s, %(hogql_val_23)s))))))GROUP BY actor_id), activity AS (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS actor_id, dateDiff(%(hogql_val_23)s, toStartOfWeek(toDateTime(%(hogql_val_24)s, %(hogql_val_25)s), 0), toStartOfWeek(toTimeZone(events.timestamp, %(hogql_val_26)s), 0)) AS activity_index+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS actor_id, dateDiff(%(hogql_val_24)s, toStartOfWeek(toDateTime(%(hogql_val_25)s, %(hogql_val_26)s), 0), toStartOfWeek(toTimeZone(events.timestamp, %(hogql_val_27)s), 0)) AS activity_indexFROM 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_idFROM person_distinct_id_overrides@@ -33,14 +33,14 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_27)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_28)s, %(hogql_val_29)s)), lessOrEquals(events.timestamp, toDateTime(%(hogql_val_30)s, %(hogql_val_31)s)), globalIn(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), (+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_28)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_29)s, %(hogql_val_30)s)), lessOrEquals(events.timestamp, toDateTime(%(hogql_val_31)s, %(hogql_val_32)s)), globalIn(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), (SELECT acquisition.actor_id AS actor_idFROM acquisition)))GROUP BY actor_id, activity_index), cohort_sizes AS MATERIALIZED (- SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_32)s, toStartOfWeek(toDateTime(%(hogql_val_33)s, %(hogql_val_34)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_35)s), 0)) AS cohort_index, count(acquisition.actor_id) AS cohort_size+ SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_33)s, toStartOfWeek(toDateTime(%(hogql_val_34)s, %(hogql_val_35)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_36)s), 0)) AS cohort_index, count(acquisition.actor_id) AS cohort_sizeFROM acquisitionGROUP BY acquisition.breakdown_value, cohort_index), matrix AS (- SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_36)s, toStartOfWeek(toDateTime(%(hogql_val_37)s, %(hogql_val_38)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_39)s), 0)) AS cohort_index, minus(activity.activity_index, dateDiff(%(hogql_val_40)s, toStartOfWeek(toDateTime(%(hogql_val_41)s, %(hogql_val_42)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_43)s), 0))) AS intervals_from_base, count(DISTINCT acquisition.actor_id) AS count+ SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_37)s, toStartOfWeek(toDateTime(%(hogql_val_38)s, %(hogql_val_39)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_40)s), 0)) AS cohort_index, minus(activity.activity_index, dateDiff(%(hogql_val_41)s, toStartOfWeek(toDateTime(%(hogql_val_42)s, %(hogql_val_43)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_44)s), 0))) AS intervals_from_base, count(DISTINCT acquisition.actor_id) AS countFROM acquisition INNER JOIN activity ON equals(activity.actor_id, acquisition.actor_id)GROUP BY acquisition.breakdown_value, cohort_index, intervals_from_baseHAVING and(ifNull(greaterOrEquals(intervals_from_base, 0), 0), ifNull(less(intervals_from_base, 4), 0))), folded_sizes AS (@@ -49,7 +49,7 @@FROM cohort_sizesGROUP BY cohort_sizes.breakdown_valueORDER BY sum(cohort_sizes.cohort_size) DESC, cohort_sizes.breakdown_value ASC- LIMIT 20)), cohort_sizes.breakdown_value, %(hogql_val_44)s) AS breakdown_value, cohort_sizes.cohort_index AS cohort_index, sum(cohort_sizes.cohort_size) AS cohort_size+ LIMIT 20)), cohort_sizes.breakdown_value, %(hogql_val_45)s) AS breakdown_value, cohort_sizes.cohort_index AS cohort_index, sum(cohort_sizes.cohort_size) AS cohort_sizeFROM cohort_sizesGROUP BY breakdown_value, cohort_sizes.cohort_index), folded_matrix AS (SELECT if(globalIn(matrix.breakdown_value, (@@ -57,7 +57,7 @@FROM cohort_sizesGROUP BY cohort_sizes.breakdown_valueORDER BY sum(cohort_sizes.cohort_size) DESC, cohort_sizes.breakdown_value ASC- LIMIT 20)), matrix.breakdown_value, %(hogql_val_45)s) AS breakdown_value, matrix.cohort_index AS cohort_index, matrix.intervals_from_base AS intervals_from_base, sum(matrix.count) AS count+ LIMIT 20)), matrix.breakdown_value, %(hogql_val_46)s) AS breakdown_value, matrix.cohort_index AS cohort_index, matrix.intervals_from_base AS intervals_from_base, sum(matrix.count) AS countFROM matrixGROUP BY breakdown_value, matrix.cohort_index, matrix.intervals_from_base), summary AS (SELECT uniqExact(cohort_sizes.breakdown_value) AS distinct_breakdowns@@ -92,9 +92,9 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_71)s), notEmpty(events.properties.`$session_id`), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_72)s, %(hogql_val_73)s), toIntervalDay(90))), less(events.timestamp, toDateTime(%(hogql_val_74)s, %(hogql_val_75)s))))))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_71)s), notEmpty(events.properties.`$session_id`), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_72)s, %(hogql_val_73)s), toIntervalDay(90)), 6, %(hogql_val_74)s)), less(events.timestamp, toDateTime(%(hogql_val_75)s, %(hogql_val_76)s))))))GROUP BY actor_id), activity AS (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS actor_id, dateDiff(%(hogql_val_76)s, toStartOfWeek(toDateTime(%(hogql_val_77)s, %(hogql_val_78)s), 0), toStartOfWeek(toTimeZone(events.timestamp, %(hogql_val_79)s), 0)) AS activity_index+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS actor_id, dateDiff(%(hogql_val_77)s, toStartOfWeek(toDateTime(%(hogql_val_78)s, %(hogql_val_79)s), 0), toStartOfWeek(toTimeZone(events.timestamp, %(hogql_val_80)s), 0)) AS activity_indexFROM 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_idFROM person_distinct_id_overrides@@ -102,14 +102,14 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_80)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_81)s, %(hogql_val_82)s)), lessOrEquals(events.timestamp, toDateTime(%(hogql_val_83)s, %(hogql_val_84)s)), globalIn(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), (+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_81)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_82)s, %(hogql_val_83)s)), lessOrEquals(events.timestamp, toDateTime(%(hogql_val_84)s, %(hogql_val_85)s)), globalIn(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), (SELECT acquisition.actor_id AS actor_idFROM acquisition)))GROUP BY actor_id, activity_index), cohort_sizes AS MATERIALIZED (- SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_85)s, toStartOfWeek(toDateTime(%(hogql_val_86)s, %(hogql_val_87)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_88)s), 0)) AS cohort_index, count(acquisition.actor_id) AS cohort_size+ SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_86)s, toStartOfWeek(toDateTime(%(hogql_val_87)s, %(hogql_val_88)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_89)s), 0)) AS cohort_index, count(acquisition.actor_id) AS cohort_sizeFROM acquisitionGROUP BY acquisition.breakdown_value, cohort_index), matrix AS (- SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_89)s, toStartOfWeek(toDateTime(%(hogql_val_90)s, %(hogql_val_91)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_92)s), 0)) AS cohort_index, minus(activity.activity_index, dateDiff(%(hogql_val_93)s, toStartOfWeek(toDateTime(%(hogql_val_94)s, %(hogql_val_95)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_96)s), 0))) AS intervals_from_base, count(DISTINCT acquisition.actor_id) AS count+ SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_90)s, toStartOfWeek(toDateTime(%(hogql_val_91)s, %(hogql_val_92)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_93)s), 0)) AS cohort_index, minus(activity.activity_index, dateDiff(%(hogql_val_94)s, toStartOfWeek(toDateTime(%(hogql_val_95)s, %(hogql_val_96)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_97)s), 0))) AS intervals_from_base, count(DISTINCT acquisition.actor_id) AS countFROM acquisition INNER JOIN activity ON equals(activity.actor_id, acquisition.actor_id)GROUP BY acquisition.breakdown_value, cohort_index, intervals_from_baseHAVING and(ifNull(greaterOrEquals(intervals_from_base, 0), 0), ifNull(less(intervals_from_base, 4), 0))), folded_sizes AS (@@ -118,7 +118,7 @@FROM cohort_sizesGROUP BY cohort_sizes.breakdown_valueORDER BY sum(cohort_sizes.cohort_size) DESC, cohort_sizes.breakdown_value ASC- LIMIT 20)), cohort_sizes.breakdown_value, %(hogql_val_97)s) AS breakdown_value, cohort_sizes.cohort_index AS cohort_index, sum(cohort_sizes.cohort_size) AS cohort_size+ LIMIT 20)), cohort_sizes.breakdown_value, %(hogql_val_98)s) AS breakdown_value, cohort_sizes.cohort_index AS cohort_index, sum(cohort_sizes.cohort_size) AS cohort_sizeFROM cohort_sizesGROUP BY breakdown_value, cohort_sizes.cohort_index), folded_matrix AS (SELECT if(globalIn(matrix.breakdown_value, (@@ -126,7 +126,7 @@FROM cohort_sizesGROUP BY cohort_sizes.breakdown_valueORDER BY sum(cohort_sizes.cohort_size) DESC, cohort_sizes.breakdown_value ASC- LIMIT 20)), matrix.breakdown_value, %(hogql_val_98)s) AS breakdown_value, matrix.cohort_index AS cohort_index, matrix.intervals_from_base AS intervals_from_base, sum(matrix.count) AS count+ LIMIT 20)), matrix.breakdown_value, %(hogql_val_99)s) AS breakdown_value, matrix.cohort_index AS cohort_index, matrix.intervals_from_base AS intervals_from_base, sum(matrix.count) AS countFROM matrixGROUP BY breakdown_value, matrix.cohort_index, matrix.intervals_from_base), summary AS (SELECT uniqExact(cohort_sizes.breakdown_value) AS distinct_breakdowns@@ -161,9 +161,9 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_136)s), notEmpty(events.properties.`$session_id`), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_137)s, %(hogql_val_138)s), toIntervalDay(90))), less(events.timestamp, toDateTime(%(hogql_val_139)s, %(hogql_val_140)s))))))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_136)s), notEmpty(events.properties.`$session_id`), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_137)s, %(hogql_val_138)s), toIntervalDay(90)), 6, %(hogql_val_139)s)), less(events.timestamp, toDateTime(%(hogql_val_140)s, %(hogql_val_141)s))))))GROUP BY actor_id), activity AS (- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS actor_id, dateDiff(%(hogql_val_141)s, toStartOfWeek(toDateTime(%(hogql_val_142)s, %(hogql_val_143)s), 0), toStartOfWeek(toTimeZone(events.timestamp, %(hogql_val_144)s), 0)) AS activity_index+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS actor_id, dateDiff(%(hogql_val_142)s, toStartOfWeek(toDateTime(%(hogql_val_143)s, %(hogql_val_144)s), 0), toStartOfWeek(toTimeZone(events.timestamp, %(hogql_val_145)s), 0)) AS activity_indexFROM 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_idFROM person_distinct_id_overrides@@ -171,14 +171,14 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_145)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_146)s, %(hogql_val_147)s)), lessOrEquals(events.timestamp, toDateTime(%(hogql_val_148)s, %(hogql_val_149)s)), globalIn(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), (+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_146)s), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_147)s, %(hogql_val_148)s)), lessOrEquals(events.timestamp, toDateTime(%(hogql_val_149)s, %(hogql_val_150)s)), globalIn(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), (SELECT acquisition.actor_id AS actor_idFROM acquisition)))GROUP BY actor_id, activity_index), cohort_sizes AS MATERIALIZED (- SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_150)s, toStartOfWeek(toDateTime(%(hogql_val_151)s, %(hogql_val_152)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_153)s), 0)) AS cohort_index, count(acquisition.actor_id) AS cohort_size+ SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_151)s, toStartOfWeek(toDateTime(%(hogql_val_152)s, %(hogql_val_153)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_154)s), 0)) AS cohort_index, count(acquisition.actor_id) AS cohort_sizeFROM acquisitionGROUP BY acquisition.breakdown_value, cohort_index), matrix AS (- SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_154)s, toStartOfWeek(toDateTime(%(hogql_val_155)s, %(hogql_val_156)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_157)s), 0)) AS cohort_index, minus(activity.activity_index, dateDiff(%(hogql_val_158)s, toStartOfWeek(toDateTime(%(hogql_val_159)s, %(hogql_val_160)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_161)s), 0))) AS intervals_from_base, count(DISTINCT acquisition.actor_id) AS count+ SELECT acquisition.breakdown_value AS breakdown_value, dateDiff(%(hogql_val_155)s, toStartOfWeek(toDateTime(%(hogql_val_156)s, %(hogql_val_157)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_158)s), 0)) AS cohort_index, minus(activity.activity_index, dateDiff(%(hogql_val_159)s, toStartOfWeek(toDateTime(%(hogql_val_160)s, %(hogql_val_161)s), 0), toStartOfWeek(toTimeZone(acquisition.cohort_at, %(hogql_val_162)s), 0))) AS intervals_from_base, count(DISTINCT acquisition.actor_id) AS countFROM acquisition INNER JOIN activity ON equals(activity.actor_id, acquisition.actor_id)GROUP BY acquisition.breakdown_value, cohort_index, intervals_from_baseHAVING and(ifNull(greaterOrEquals(intervals_from_base, 0), 0), ifNull(less(intervals_from_base, 4), 0))), folded_sizes AS (@@ -187,7 +187,7 @@FROM cohort_sizesGROUP BY cohort_sizes.breakdown_valueORDER BY sum(cohort_sizes.cohort_size) DESC, cohort_sizes.breakdown_value ASC- LIMIT 20)), cohort_sizes.breakdown_value, %(hogql_val_162)s) AS breakdown_value, cohort_sizes.cohort_index AS cohort_index, sum(cohort_sizes.cohort_size) AS cohort_size+ LIMIT 20)), cohort_sizes.breakdown_value, %(hogql_val_163)s) AS breakdown_value, cohort_sizes.cohort_index AS cohort_index, sum(cohort_sizes.cohort_size) AS cohort_sizeFROM cohort_sizesGROUP BY breakdown_value, cohort_sizes.cohort_index), folded_matrix AS (SELECT if(globalIn(matrix.breakdown_value, (@@ -195,7 +195,7 @@FROM cohort_sizesGROUP BY cohort_sizes.breakdown_valueORDER BY sum(cohort_sizes.cohort_size) DESC, cohort_sizes.breakdown_value ASC- LIMIT 20)), matrix.breakdown_value, %(hogql_val_163)s) AS breakdown_value, matrix.cohort_index AS cohort_index, matrix.intervals_from_base AS intervals_from_base, sum(matrix.count) AS count+ LIMIT 20)), matrix.breakdown_value, %(hogql_val_164)s) AS breakdown_value, matrix.cohort_index AS cohort_index, matrix.intervals_from_base AS intervals_from_base, sum(matrix.count) AS countFROM matrixGROUP BY breakdown_value, matrix.cohort_index, matrix.intervals_from_base), summary AS (SELECT uniqExact(cohort_sizes.breakdown_value) AS distinct_breakdowns@@ -290,21 +290,21 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_94)s), notEmpty(events.properties.`$session_id`), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_95)s, %(hogql_val_96)s), toIntervalDay(90))), less(events.timestamp, toDateTime(%(hogql_val_97)s, %(hogql_val_98)s))))))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_94)s), notEmpty(events.properties.`$session_id`), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_95)s, %(hogql_val_96)s), toIntervalDay(90)), 6, %(hogql_val_97)s)), less(events.timestamp, toDateTime(%(hogql_val_98)s, %(hogql_val_99)s))))))GROUP BY actor_id UNION ALL- SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS actor_id, min(events__session.`$start_timestamp`) AS first_session_at, argMin(if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_107)s)), events__session.`$entry_utm_source`, %(hogql_val_108)s)), [%(hogql_val_109)s, %(hogql_val_110)s, %(hogql_val_111)s]), %(hogql_val_112)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_113)s)), events__session.`$entry_utm_source`, %(hogql_val_114)s)), [%(hogql_val_115)s, %(hogql_val_116)s, %(hogql_val_117)s, %(hogql_val_118)s, %(hogql_val_119)s, %(hogql_val_120)s, %(hogql_val_121)s, %(hogql_val_122)s]), %(hogql_val_123)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_124)s)), events__session.`$entry_utm_source`, %(hogql_val_125)s)), [%(hogql_val_126)s]), %(hogql_val_127)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_128)s)), events__session.`$entry_utm_source`, %(hogql_val_129)s)), [%(hogql_val_130)s, %(hogql_val_131)s, %(hogql_val_132)s, %(hogql_val_133)s, %(hogql_val_134)s, %(hogql_val_135)s, %(hogql_val_136)s, %(hogql_val_137)s, %(hogql_val_138)s]), %(hogql_val_139)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_140)s)), events__session.`$entry_utm_source`, %(hogql_val_141)s)), [%(hogql_val_142)s]), %(hogql_val_143)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_144)s)), events__session.`$entry_utm_source`, %(hogql_val_145)s)), [%(hogql_val_146)s, %(hogql_val_147)s]), %(hogql_val_148)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_149)s)), events__session.`$entry_utm_source`, %(hogql_val_150)s)), [%(hogql_val_151)s, %(hogql_val_152)s, %(hogql_val_153)s]), %(hogql_val_154)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_155)s)), events__session.`$entry_utm_source`, %(hogql_val_156)s)), [%(hogql_val_157)s]), %(hogql_val_158)s, if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_159)s)), events__session.`$entry_utm_source`, %(hogql_val_160)s))))))))), events__session.`$start_timestamp`) AS breakdown_value, 1 AS previous, %(hogql_val_161)s AS observation_end, argMin(events.properties.`$session_id`, events__session.`$start_timestamp`) AS first_session_id+ SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS actor_id, min(events__session.`$start_timestamp`) AS first_session_at, argMin(if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_108)s)), events__session.`$entry_utm_source`, %(hogql_val_109)s)), [%(hogql_val_110)s, %(hogql_val_111)s, %(hogql_val_112)s]), %(hogql_val_113)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_114)s)), events__session.`$entry_utm_source`, %(hogql_val_115)s)), [%(hogql_val_116)s, %(hogql_val_117)s, %(hogql_val_118)s, %(hogql_val_119)s, %(hogql_val_120)s, %(hogql_val_121)s, %(hogql_val_122)s, %(hogql_val_123)s]), %(hogql_val_124)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_125)s)), events__session.`$entry_utm_source`, %(hogql_val_126)s)), [%(hogql_val_127)s]), %(hogql_val_128)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_129)s)), events__session.`$entry_utm_source`, %(hogql_val_130)s)), [%(hogql_val_131)s, %(hogql_val_132)s, %(hogql_val_133)s, %(hogql_val_134)s, %(hogql_val_135)s, %(hogql_val_136)s, %(hogql_val_137)s, %(hogql_val_138)s, %(hogql_val_139)s]), %(hogql_val_140)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_141)s)), events__session.`$entry_utm_source`, %(hogql_val_142)s)), [%(hogql_val_143)s]), %(hogql_val_144)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_145)s)), events__session.`$entry_utm_source`, %(hogql_val_146)s)), [%(hogql_val_147)s, %(hogql_val_148)s]), %(hogql_val_149)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_150)s)), events__session.`$entry_utm_source`, %(hogql_val_151)s)), [%(hogql_val_152)s, %(hogql_val_153)s, %(hogql_val_154)s]), %(hogql_val_155)s, if(in(lower(if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_156)s)), events__session.`$entry_utm_source`, %(hogql_val_157)s)), [%(hogql_val_158)s]), %(hogql_val_159)s, if(notEmpty(ifNull(events__session.`$entry_utm_source`, %(hogql_val_160)s)), events__session.`$entry_utm_source`, %(hogql_val_161)s))))))))), events__session.`$start_timestamp`) AS breakdown_value, 1 AS previous, %(hogql_val_162)s AS observation_end, argMin(events.properties.`$session_id`, events__session.`$start_timestamp`) AS first_session_idFROM events_json AS events LEFT JOIN (- SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_99)s)) AS `$start_timestamp`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_100)s), %(hogql_val_101)s) AS `$entry_utm_source`, raw_sessions.session_id_v7 AS session_id_v7+ SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_100)s)) AS `$start_timestamp`, nullIf(nullIf(argMinMerge(raw_sessions.initial_utm_source), %(hogql_val_101)s), %(hogql_val_102)s) AS `$entry_utm_source`, raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessions- WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toDateTime(%(hogql_val_102)s, %(hogql_val_103)s), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime(%(hogql_val_104)s, %(hogql_val_105)s), toIntervalDay(3))))- GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.properties.`$session_id`, %(hogql_val_106)s)), events__session.session_id_v7) LEFT OUTER JOIN (+ WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toDateTime(%(hogql_val_103)s, %(hogql_val_104)s), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime(%(hogql_val_105)s, %(hogql_val_106)s), toIntervalDay(3))))+ GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.properties.`$session_id`, %(hogql_val_107)s)), events__session.session_id_v7) 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_idFROM person_distinct_id_overridesWHERE equals(person_distinct_id_overrides.team_id, 420)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), and(equals(events.event, %(hogql_val_162)s), notEmpty(events.properties.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_163)s, %(hogql_val_164)s)), lessOrEquals(events.timestamp, toDateTime(%(hogql_val_165)s, %(hogql_val_166)s)), ifNull(greaterOrEquals(events__session.`$start_timestamp`, toDateTime(%(hogql_val_167)s, %(hogql_val_168)s)), 0), ifNull(lessOrEquals(events__session.`$start_timestamp`, toDateTime(%(hogql_val_169)s, %(hogql_val_170)s)), 0), globalNotIn(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), (+ WHERE and(equals(events.team_id, 420), and(equals(events.event, %(hogql_val_163)s), notEmpty(events.properties.`$session_id`), greater(toUnixTimestamp(events__session.`$start_timestamp`), 0)), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_164)s, %(hogql_val_165)s)), lessOrEquals(events.timestamp, toDateTime(%(hogql_val_166)s, %(hogql_val_167)s)), ifNull(greaterOrEquals(events__session.`$start_timestamp`, toDateTime(%(hogql_val_168)s, %(hogql_val_169)s)), 0), ifNull(lessOrEquals(events__session.`$start_timestamp`, toDateTime(%(hogql_val_170)s, %(hogql_val_171)s)), 0), globalNotIn(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), (SELECT DISTINCT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_idFROM 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@@ -313,23 +313,23 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_171)s), notEmpty(events.properties.`$session_id`), greaterOrEquals(events.timestamp, minus(toDateTime(%(hogql_val_172)s, %(hogql_val_173)s), toIntervalDay(90))), less(events.timestamp, toDateTime(%(hogql_val_174)s, %(hogql_val_175)s))))))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_172)s), notEmpty(events.properties.`$session_id`), greaterOrEquals(events.timestamp, toDateTime64(minus(toDateTime(%(hogql_val_173)s, %(hogql_val_174)s), toIntervalDay(90)), 6, %(hogql_val_175)s)), less(events.timestamp, toDateTime(%(hogql_val_176)s, %(hogql_val_177)s))))))GROUP BY actor_id), activity AS (SELECT acquisition.actor_id AS actor_id, acquisition.previous AS previous, min(events__session.`$start_timestamp`) AS returned_atFROM events_json AS events LEFT JOIN (- SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_176)s)) AS `$start_timestamp`, raw_sessions.session_id_v7 AS session_id_v7+ SELECT min(toTimeZone(raw_sessions.min_timestamp, %(hogql_val_178)s)) AS `$start_timestamp`, raw_sessions.session_id_v7 AS session_id_v7FROM raw_sessions- WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toDateTime(%(hogql_val_177)s, %(hogql_val_178)s), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime(%(hogql_val_179)s, %(hogql_val_180)s), toIntervalDay(3))))- GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.properties.`$session_id`, %(hogql_val_181)s)), events__session.session_id_v7) LEFT OUTER JOIN (+ WHERE and(equals(raw_sessions.team_id, 420), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toDateTime(%(hogql_val_179)s, %(hogql_val_180)s), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(toDateTime(%(hogql_val_181)s, %(hogql_val_182)s), toIntervalDay(3))))+ GROUP BY raw_sessions.session_id_v7) AS events__session ON equals(toUInt128(accurateCastOrNull(events.properties.`$session_id`, %(hogql_val_183)s)), events__session.session_id_v7) 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_idFROM person_distinct_id_overridesWHERE equals(person_distinct_id_overrides.team_id, 420)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id) GLOBAL INNER JOIN acquisition ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), acquisition.actor_id)- WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_182)s), notEmpty(events.properties.`$session_id`), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_183)s, %(hogql_val_184)s)), lessOrEquals(events.timestamp, toDateTime(%(hogql_val_185)s, %(hogql_val_186)s)), notEquals(events.properties.`$session_id`, acquisition.first_session_id), greater(toDate(events__session.`$start_timestamp`), toDate(toTimeZone(acquisition.first_session_at, %(hogql_val_187)s))), lessOrEquals(events__session.`$start_timestamp`, plus(toTimeZone(acquisition.first_session_at, %(hogql_val_188)s), toIntervalDay(30))), ifNull(lessOrEquals(events__session.`$start_timestamp`, parseDateTime64BestEffortOrNull(acquisition.observation_end, 6, %(hogql_val_189)s)), 0))+ WHERE and(equals(events.team_id, 420), equals(events.event, %(hogql_val_184)s), notEmpty(events.properties.`$session_id`), greaterOrEquals(events.timestamp, toDateTime(%(hogql_val_185)s, %(hogql_val_186)s)), lessOrEquals(events.timestamp, toDateTime(%(hogql_val_187)s, %(hogql_val_188)s)), notEquals(events.properties.`$session_id`, acquisition.first_session_id), greater(toDate(events__session.`$start_timestamp`), toDate(toTimeZone(acquisition.first_session_at, %(hogql_val_189)s))), lessOrEquals(events__session.`$start_timestamp`, plus(toTimeZone(acquisition.first_session_at, %(hogql_val_190)s), toIntervalDay(30))), ifNull(lessOrEquals(events__session.`$start_timestamp`, parseDateTime64BestEffortOrNull(acquisition.observation_end, 6, %(hogql_val_191)s)), 0))GROUP BY actor_id, previous), people AS MATERIALIZED (- SELECT acquisition.actor_id AS actor_id, acquisition.breakdown_value AS breakdown_value, acquisition.previous AS previous, toTimeZone(acquisition.first_session_at, %(hogql_val_190)s) AS first_session_at, parseDateTime64BestEffortOrNull(acquisition.observation_end, 6, %(hogql_val_191)s) AS observation_end, toTimeZone(activity.returned_at, %(hogql_val_192)s) AS returned_at+ SELECT acquisition.actor_id AS actor_id, acquisition.breakdown_value AS breakdown_value, acquisition.previous AS previous, toTimeZone(acquisition.first_session_at, %(hogql_val_192)s) AS first_session_at, parseDateTime64BestEffortOrNull(acquisition.observation_end, 6, %(hogql_val_193)s) AS observation_end, toTimeZone(activity.returned_at, %(hogql_val_194)s) AS returned_atFROM acquisition LEFT JOIN activity ON and(equals(acquisition.actor_id, activity.actor_id), equals(acquisition.previous, activity.previous)))SELECT if(globalIn(people.breakdown_value, (SELECT people.breakdown_value AS breakdown_valuediff --git a/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation.ambr b/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation.ambrindex 84ce45af67f7..7e8b9ba3231e 100644--- a/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation.ambr+++ b/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation.ambr@@ -37,7 +37,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS event__override ON equals(event.distinct_id, event__override.distinct_id)JOIN funnel_actors ON equals(if(not(empty(event__override.distinct_id)), event__override.person_id, event.person_id), funnel_actors.actor_id)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_from), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_to), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to)), notIn(event.event, funnel_step_names), notIn(event.event, []))+ WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), notIn(event.event, []))GROUP BY nameLIMIT 100UNION ALL@@ -663,7 +663,7 @@or isNotNull(target_step))) AS failure_countFROM events AS eventJOIN funnel_actors ON equals(funnel_actors.actor_id, event.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_from), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_to), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to)), notIn(event.event, funnel_step_names), notIn(event.event, []))+ WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), notIn(event.event, []))GROUP BY nameLIMIT 100UNION ALL@@ -734,8 +734,8 @@actor_id AS keyFROM events AS eventJOIN funnel_actors ON equals(funnel_actors.actor_id, event.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_from), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_to), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to)), notIn(event.event, funnel_step_names), equals(event.event, 'positively_related'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step)))+ WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'positively_related'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)+ and isNull(target_step)))GROUP BY actor_idORDER BY actor_id ASC) AS sourceORDER BY source.actor_id ASC@@ -803,8 +803,8 @@actor_id AS keyFROM events AS eventJOIN funnel_actors ON equals(funnel_actors.actor_id, event.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_from), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_to), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to)), notIn(event.event, funnel_step_names), equals(event.event, 'positively_related'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step)))+ WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'positively_related'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)+ or isNotNull(target_step)))GROUP BY actor_idORDER BY actor_id ASC) AS sourceORDER BY source.actor_id ASC@@ -872,8 +872,8 @@actor_id AS keyFROM events AS eventJOIN funnel_actors ON equals(funnel_actors.actor_id, event.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_from), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_to), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to)), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step)))+ WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)+ and isNull(target_step)))GROUP BY actor_idORDER BY actor_id ASC) AS sourceORDER BY source.actor_id ASC@@ -941,8 +941,8 @@actor_id AS keyFROM events AS eventJOIN funnel_actors ON equals(funnel_actors.actor_id, event.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_from), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_to), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to)), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step)))+ WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)+ or isNotNull(target_step)))GROUP BY actor_idORDER BY actor_id ASC) AS sourceORDER BY source.actor_id ASC@@ -993,7 +993,7 @@or isNotNull(target_step))) AS failure_countFROM events AS eventJOIN funnel_actors ON equals(funnel_actors.actor_id, event.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_from), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_to), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to)), notIn(event.event, funnel_step_names), notIn(event.event, []))+ WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), notIn(event.event, []))GROUP BY nameLIMIT 100UNION ALL@@ -1064,8 +1064,8 @@actor_id AS keyFROM events AS eventJOIN funnel_actors ON equals(funnel_actors.actor_id, event.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_from), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_to), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to)), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step)))+ WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)+ and isNull(target_step)))GROUP BY actor_idORDER BY actor_id ASC) AS sourceORDER BY source.actor_id ASC@@ -1133,8 +1133,8 @@actor_id AS keyFROM events AS eventJOIN funnel_actors ON equals(funnel_actors.actor_id, event.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_from), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_to), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to)), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step)))+ WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)+ or isNotNull(target_step)))GROUP BY actor_idORDER BY actor_id ASC) AS sourceORDER BY source.actor_id ASCdiff --git a/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation.new_events_schema.ambr b/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation.new_events_schema.ambrindex a6806a394d54..25f796134134 100644--- a/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation.new_events_schema.ambr+++ b/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation.new_events_schema.ambr@@ -37,7 +37,7 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS event__override ON equals(event.distinct_id, event__override.distinct_id)JOIN funnel_actors ON equals(if(not(empty(event__override.distinct_id)), event__override.person_id, event.person_id), funnel_actors.actor_id)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_from), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_to), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to)), notIn(event.event, funnel_step_names), notIn(event.event, []))+ WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), notIn(event.event, []))GROUP BY nameLIMIT 100UNION ALL@@ -596,8 +596,8 @@actor_id AS keyFROM events_json AS eventJOIN funnel_actors ON equals(funnel_actors.actor_id, event.properties.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_from), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_to), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to)), notIn(event.event, funnel_step_names), equals(event.event, 'positively_related'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step)))+ WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'positively_related'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)+ and isNull(target_step)))GROUP BY actor_idORDER BY actor_id ASC) AS sourceORDER BY source.actor_id ASC@@ -666,8 +666,8 @@actor_id AS keyFROM events_json AS eventJOIN funnel_actors ON equals(funnel_actors.actor_id, event.properties.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_from), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_to), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to)), notIn(event.event, funnel_step_names), equals(event.event, 'positively_related'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step)))+ WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'positively_related'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)+ or isNotNull(target_step)))GROUP BY actor_idORDER BY actor_id ASC) AS sourceORDER BY source.actor_id ASC@@ -736,8 +736,8 @@actor_id AS keyFROM events_json AS eventJOIN funnel_actors ON equals(funnel_actors.actor_id, event.properties.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_from), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_to), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to)), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step)))+ WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)+ and isNull(target_step)))GROUP BY actor_idORDER BY actor_id ASC) AS sourceORDER BY source.actor_id ASC@@ -806,8 +806,8 @@actor_id AS keyFROM events_json AS eventJOIN funnel_actors ON equals(funnel_actors.actor_id, event.properties.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_from), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_to), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to)), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step)))+ WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)+ or isNotNull(target_step)))GROUP BY actor_idORDER BY actor_id ASC) AS sourceORDER BY source.actor_id ASC@@ -859,7 +859,7 @@or isNotNull(target_step))) AS failure_countFROM events_json AS eventJOIN funnel_actors ON equals(funnel_actors.actor_id, event.properties.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_from), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_to), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to)), notIn(event.event, funnel_step_names), notIn(event.event, []))+ WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), notIn(event.event, []))GROUP BY nameLIMIT 100UNION ALL@@ -931,8 +931,8 @@actor_id AS keyFROM events_json AS eventJOIN funnel_actors ON equals(funnel_actors.actor_id, event.properties.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_from), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_to), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to)), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step)))+ WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)+ and isNull(target_step)))GROUP BY actor_idORDER BY actor_id ASC) AS sourceORDER BY source.actor_id ASC@@ -1001,8 +1001,8 @@actor_id AS keyFROM events_json AS eventJOIN funnel_actors ON equals(funnel_actors.actor_id, event.properties.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_from), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_to), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to)), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step)))+ WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)+ or isNotNull(target_step)))GROUP BY actor_idORDER BY actor_id ASC) AS sourceORDER BY source.actor_id ASC@@ -1049,7 +1049,7 @@or isNotNull(target_step))) AS failure_countFROM events_json AS eventJOIN funnel_actors ON equals(funnel_actors.actor_id, event.properties.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_from), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_to), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to)), notIn(event.event, funnel_step_names), notIn(event.event, []))+ WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), notIn(event.event, []))GROUP BY nameLIMIT 100UNION ALLdiff --git a/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation_actors.ambr b/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation_actors.ambrindex db86cc71386c..5d969373bdad 100644--- a/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation_actors.ambr+++ b/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation_actors.ambr@@ -62,8 +62,8 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS event__override ON equals(event.distinct_id, event__override.distinct_id)JOIN funnel_actors ON equals(if(not(empty(event__override.distinct_id)), event__override.person_id, event.person_id), funnel_actors.actor_id)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_from), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_to), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to)), notIn(event.event, funnel_step_names), equals(event.event, 'insight loaded'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step)))+ WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'insight loaded'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)+ and isNull(target_step)))GROUP BY actor_idORDER BY actor_id ASC) AS sourceORDER BY source.id ASC@@ -172,8 +172,8 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS event__override ON equals(event.distinct_id, event__override.distinct_id)JOIN funnel_actors ON equals(if(not(empty(event__override.distinct_id)), event__override.person_id, event.person_id), funnel_actors.actor_id)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_from), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_to), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to)), notIn(event.event, funnel_step_names), equals(event.event, 'insight loaded'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step)))+ WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'insight loaded'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)+ or isNotNull(target_step)))GROUP BY actor_idORDER BY actor_id ASC) AS sourceORDER BY source.id ASCdiff --git a/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation_actors.new_events_schema.ambr b/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation_actors.new_events_schema.ambrindex e2d4a0cbb046..1125c86a853e 100644--- a/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation_actors.new_events_schema.ambr+++ b/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation_actors.new_events_schema.ambr@@ -63,8 +63,8 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS event__override ON equals(event.distinct_id, event__override.distinct_id)JOIN funnel_actors ON equals(if(not(empty(event__override.distinct_id)), event__override.person_id, event.person_id), funnel_actors.actor_id)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_from), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_to), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to)), notIn(event.event, funnel_step_names), equals(event.event, 'insight loaded'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step)))+ WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'insight loaded'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)+ or isNotNull(target_step)))GROUP BY actor_idORDER BY actor_id ASC) AS sourceORDER BY source.id ASC@@ -149,8 +149,8 @@GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS event__override ON equals(event.distinct_id, event__override.distinct_id)JOIN funnel_actors ON equals(if(not(empty(event__override.distinct_id)), event__override.person_id, event.person_id), funnel_actors.actor_id)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_from), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), date_to), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to)), notIn(event.event, funnel_step_names), equals(event.event, 'insight loaded'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step)))+ WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'insight loaded'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)+ and isNull(target_step)))GROUP BY actor_idORDER BY actor_id ASC) AS sourceORDER BY source.id ASCdiff --git a/products/product_analytics/backend/hogql_queries/lifecycle/test/__snapshots__/test_lifecycle_insight_actors.ambr b/products/product_analytics/backend/hogql_queries/lifecycle/test/__snapshots__/test_lifecycle_insight_actors.ambrindex b5f658e8c512..ae8cafd0d693 100644--- a/products/product_analytics/backend/hogql_queries/lifecycle/test/__snapshots__/test_lifecycle_insight_actors.ambr+++ b/products/product_analytics/backend/hogql_queries/lifecycle/test/__snapshots__/test_lifecycle_insight_actors.ambr@@ -31,7 +31,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), ifNull(notEquals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$process_person_profile'), ''), 'null'), '^"|"$', ''), 'false'), 1), greaterOrEquals(events.timestamp, minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-09 00:00:00', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1))), less(events.timestamp, plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), ifNull(notEquals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$process_person_profile'), ''), 'null'), '^"|"$', ''), 'false'), 1), greaterOrEquals(events.timestamp, toDateTime64(minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-09 00:00:00', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1)), 6, 'US/Pacific')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1)), 6, 'US/Pacific')), equals(events.event, '$pageview'))GROUP BY actor_id)WHERE and(ifNull(equals(start_of_period, toStartOfInterval(toDateTime('2020-01-12', 'US/Pacific'), toIntervalDay(1))), isNull(start_of_period)and isNull(toStartOfInterval(toDateTime('2020-01-12', 'US/Pacific'), toIntervalDay(1)))), equals(status, 'returning'))) AS source@@ -58,7 +58,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), ifNull(notEquals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$process_person_profile'), ''), 'null'), '^"|"$', ''), 'false'), 1), greaterOrEquals(events.timestamp, minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-09 00:00:00', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1))), less(events.timestamp, plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), ifNull(notEquals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$process_person_profile'), ''), 'null'), '^"|"$', ''), 'false'), 1), greaterOrEquals(events.timestamp, toDateTime64(minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-09 00:00:00', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1)), 6, 'US/Pacific')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1)), 6, 'US/Pacific')), equals(events.event, '$pageview'))GROUP BY actor_id)WHERE and(ifNull(equals(start_of_period, toStartOfInterval(toDateTime('2020-01-12', 'US/Pacific'), toIntervalDay(1))), isNull(start_of_period)and isNull(toStartOfInterval(toDateTime('2020-01-12', 'US/Pacific'), toIntervalDay(1)))), equals(status, 'returning'))) AS source)))diff --git a/products/product_analytics/backend/hogql_queries/lifecycle/test/__snapshots__/test_lifecycle_insight_actors.new_events_schema.ambr b/products/product_analytics/backend/hogql_queries/lifecycle/test/__snapshots__/test_lifecycle_insight_actors.new_events_schema.ambrindex 95ce7f372a34..793cd4ceb707 100644--- a/products/product_analytics/backend/hogql_queries/lifecycle/test/__snapshots__/test_lifecycle_insight_actors.new_events_schema.ambr+++ b/products/product_analytics/backend/hogql_queries/lifecycle/test/__snapshots__/test_lifecycle_insight_actors.new_events_schema.ambr@@ -31,7 +31,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), ifNull(notEquals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), if(isNull(nullIf(toString(events.properties.`$process_person_profile`), '')), NULL, if(and(in(ascii(toString(events.properties.`$process_person_profile`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$process_person_profile`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$process_person_profile`), '[]'), '{}'), toString(events.properties.`$process_person_profile`)))), 'false'), 1), greaterOrEquals(events.timestamp, minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-09 00:00:00', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1))), less(events.timestamp, plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), ifNull(notEquals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), if(isNull(nullIf(toString(events.properties.`$process_person_profile`), '')), NULL, if(and(in(ascii(toString(events.properties.`$process_person_profile`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$process_person_profile`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$process_person_profile`), '[]'), '{}'), toString(events.properties.`$process_person_profile`)))), 'false'), 1), greaterOrEquals(events.timestamp, toDateTime64(minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-09 00:00:00', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1)), 6, 'US/Pacific')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1)), 6, 'US/Pacific')), equals(events.event, '$pageview'))GROUP BY actor_id)WHERE and(ifNull(equals(start_of_period, toStartOfInterval(toDateTime('2020-01-12', 'US/Pacific'), toIntervalDay(1))), isNull(start_of_period)and isNull(toStartOfInterval(toDateTime('2020-01-12', 'US/Pacific'), toIntervalDay(1)))), equals(status, 'returning'))) AS source@@ -58,7 +58,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), ifNull(notEquals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), if(isNull(nullIf(toString(events.properties.`$process_person_profile`), '')), NULL, if(and(in(ascii(toString(events.properties.`$process_person_profile`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$process_person_profile`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$process_person_profile`), '[]'), '{}'), toString(events.properties.`$process_person_profile`)))), 'false'), 1), greaterOrEquals(events.timestamp, minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-09 00:00:00', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1))), less(events.timestamp, plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), ifNull(notEquals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), if(isNull(nullIf(toString(events.properties.`$process_person_profile`), '')), NULL, if(and(in(ascii(toString(events.properties.`$process_person_profile`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$process_person_profile`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$process_person_profile`), '[]'), '{}'), toString(events.properties.`$process_person_profile`)))), 'false'), 1), greaterOrEquals(events.timestamp, toDateTime64(minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-09 00:00:00', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1)), 6, 'US/Pacific')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1)), 6, 'US/Pacific')), equals(events.event, '$pageview'))GROUP BY actor_id)WHERE and(ifNull(equals(start_of_period, toStartOfInterval(toDateTime('2020-01-12', 'US/Pacific'), toIntervalDay(1))), isNull(start_of_period)and isNull(toStartOfInterval(toDateTime('2020-01-12', 'US/Pacific'), toIntervalDay(1)))), equals(status, 'returning'))) AS source)))diff --git a/products/product_analytics/backend/hogql_queries/lifecycle/test/__snapshots__/test_lifecycle_query_runner.ambr b/products/product_analytics/backend/hogql_queries/lifecycle/test/__snapshots__/test_lifecycle_query_runner.ambrindex 267d1024559a..410a5993cc6f 100644--- a/products/product_analytics/backend/hogql_queries/lifecycle/test/__snapshots__/test_lifecycle_query_runner.ambr+++ b/products/product_analytics/backend/hogql_queries/lifecycle/test/__snapshots__/test_lifecycle_query_runner.ambr@@ -60,10 +60,10 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), ifNull(notEquals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$process_person_profile'), ''), 'null'), '^"|"$', ''), 'false'), 1), greaterOrEquals(events.timestamp, minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(1))), less(events.timestamp, plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'UTC')), toIntervalDay(1)), toIntervalDay(1))), 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)))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), ifNull(notEquals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$process_person_profile'), ''), 'null'), '^"|"$', ''), 'false'), 1), greaterOrEquals(events.timestamp, toDateTime64(minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'UTC')), toIntervalDay(1)), toIntervalDay(1)), 6, 'UTC')), 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)))), equals(events.event, '$pageview'))GROUP BY actor_id)GROUP BY start_of_period,status)@@ -137,7 +137,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), ifNull(notEquals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$process_person_profile'), ''), 'null'), '^"|"$', ''), 'false'), 1), greaterOrEquals(events.timestamp, minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(1))), less(events.timestamp, plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'UTC')), toIntervalDay(1)), toIntervalDay(1))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), ifNull(notEquals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$process_person_profile'), ''), 'null'), '^"|"$', ''), 'false'), 1), greaterOrEquals(events.timestamp, toDateTime64(minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'UTC')), toIntervalDay(1)), toIntervalDay(1)), 6, 'UTC')), equals(events.event, '$pageview'))GROUP BY actor_id)GROUP BY start_of_period,status)@@ -211,7 +211,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), ifNull(notEquals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$process_person_profile'), ''), 'null'), '^"|"$', ''), 'false'), 1), greaterOrEquals(events.timestamp, minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(1))), less(events.timestamp, plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'UTC')), toIntervalDay(1)), toIntervalDay(1))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), ifNull(notEquals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$process_person_profile'), ''), 'null'), '^"|"$', ''), 'false'), 1), greaterOrEquals(events.timestamp, toDateTime64(minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'UTC')), toIntervalDay(1)), toIntervalDay(1)), 6, 'UTC')), equals(events.event, '$pageview'))GROUP BY actor_id)GROUP BY start_of_period,status)@@ -285,7 +285,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), ifNull(notEquals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$process_person_profile'), ''), 'null'), '^"|"$', ''), 'false'), 1), greaterOrEquals(events.timestamp, minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1))), less(events.timestamp, plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), ifNull(notEquals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$process_person_profile'), ''), 'null'), '^"|"$', ''), 'false'), 1), greaterOrEquals(events.timestamp, toDateTime64(minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1)), 6, 'US/Pacific')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1)), 6, 'US/Pacific')), equals(events.event, '$pageview'))GROUP BY actor_id)GROUP BY start_of_period,status)diff --git a/products/product_analytics/backend/hogql_queries/lifecycle/test/__snapshots__/test_lifecycle_query_runner.new_events_schema.ambr b/products/product_analytics/backend/hogql_queries/lifecycle/test/__snapshots__/test_lifecycle_query_runner.new_events_schema.ambrindex 4be70fb54589..022d05eb4241 100644--- a/products/product_analytics/backend/hogql_queries/lifecycle/test/__snapshots__/test_lifecycle_query_runner.new_events_schema.ambr+++ b/products/product_analytics/backend/hogql_queries/lifecycle/test/__snapshots__/test_lifecycle_query_runner.new_events_schema.ambr@@ -50,10 +50,10 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), ifNull(notEquals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), if(isNull(nullIf(toString(events.properties.`$process_person_profile`), '')), NULL, if(and(in(ascii(toString(events.properties.`$process_person_profile`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$process_person_profile`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$process_person_profile`), '[]'), '{}'), toString(events.properties.`$process_person_profile`)))), 'false'), 1), greaterOrEquals(events.timestamp, minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(1))), less(events.timestamp, plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'UTC')), toIntervalDay(1)), toIntervalDay(1))), 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)))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), ifNull(notEquals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), if(isNull(nullIf(toString(events.properties.`$process_person_profile`), '')), NULL, if(and(in(ascii(toString(events.properties.`$process_person_profile`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$process_person_profile`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$process_person_profile`), '[]'), '{}'), toString(events.properties.`$process_person_profile`)))), 'false'), 1), greaterOrEquals(events.timestamp, toDateTime64(minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'UTC')), toIntervalDay(1)), toIntervalDay(1)), 6, 'UTC')), 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)))), equals(events.event, '$pageview'))GROUP BY actor_id)GROUP BY start_of_period,status)@@ -128,7 +128,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), ifNull(notEquals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), if(isNull(nullIf(toString(events.properties.`$process_person_profile`), '')), NULL, if(and(in(ascii(toString(events.properties.`$process_person_profile`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$process_person_profile`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$process_person_profile`), '[]'), '{}'), toString(events.properties.`$process_person_profile`)))), 'false'), 1), greaterOrEquals(events.timestamp, minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(1))), less(events.timestamp, plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'UTC')), toIntervalDay(1)), toIntervalDay(1))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), ifNull(notEquals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), if(isNull(nullIf(toString(events.properties.`$process_person_profile`), '')), NULL, if(and(in(ascii(toString(events.properties.`$process_person_profile`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$process_person_profile`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$process_person_profile`), '[]'), '{}'), toString(events.properties.`$process_person_profile`)))), 'false'), 1), greaterOrEquals(events.timestamp, toDateTime64(minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'UTC')), toIntervalDay(1)), toIntervalDay(1)), 6, 'UTC')), equals(events.event, '$pageview'))GROUP BY actor_id)GROUP BY start_of_period,status)@@ -203,7 +203,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), ifNull(notEquals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), if(isNull(nullIf(toString(events.properties.`$process_person_profile`), '')), NULL, if(and(in(ascii(toString(events.properties.`$process_person_profile`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$process_person_profile`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$process_person_profile`), '[]'), '{}'), toString(events.properties.`$process_person_profile`)))), 'false'), 1), greaterOrEquals(events.timestamp, minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1))), less(events.timestamp, plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), ifNull(notEquals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), if(isNull(nullIf(toString(events.properties.`$process_person_profile`), '')), NULL, if(and(in(ascii(toString(events.properties.`$process_person_profile`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$process_person_profile`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$process_person_profile`), '[]'), '{}'), toString(events.properties.`$process_person_profile`)))), 'false'), 1), greaterOrEquals(events.timestamp, toDateTime64(minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1)), 6, 'US/Pacific')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1)), 6, 'US/Pacific')), equals(events.event, '$pageview'))GROUP BY actor_id)GROUP BY start_of_period,status)@@ -278,7 +278,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), ifNull(notEquals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), if(isNull(nullIf(toString(events.properties.`$process_person_profile`), '')), NULL, if(and(in(ascii(toString(events.properties.`$process_person_profile`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$process_person_profile`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$process_person_profile`), '[]'), '{}'), toString(events.properties.`$process_person_profile`)))), 'false'), 1), greaterOrEquals(events.timestamp, minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(1))), less(events.timestamp, plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'UTC')), toIntervalDay(1)), toIntervalDay(1))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), ifNull(notEquals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$process_person_profile`)), if(isNull(nullIf(toString(events.properties.`$process_person_profile`), '')), NULL, if(and(in(ascii(toString(events.properties.`$process_person_profile`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$process_person_profile`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$process_person_profile`), '[]'), '{}'), toString(events.properties.`$process_person_profile`)))), 'false'), 1), greaterOrEquals(events.timestamp, toDateTime64(minus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'UTC')), toIntervalDay(1)), toIntervalDay(1)), 6, 'UTC')), equals(events.event, '$pageview'))GROUP BY actor_id)GROUP BY start_of_period,status)diff --git a/products/product_analytics/backend/hogql_queries/paths/test/__snapshots__/test_paths_query_runner_ee.ambr b/products/product_analytics/backend/hogql_queries/paths/test/__snapshots__/test_paths_query_runner_ee.ambrindex 9e672fb96380..b83d328db307 100644--- a/products/product_analytics/backend/hogql_queries/paths/test/__snapshots__/test_paths_query_runner_ee.ambr+++ b/products/product_analytics/backend/hogql_queries/paths/test/__snapshots__/test_paths_query_runner_ee.ambr@@ -59,7 +59,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -147,7 +147,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -235,7 +235,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), and(equals(events.event, '$pageview'), ifNull(notIn(path_item, ['/bar/*/foo']), 1)))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), and(equals(events.event, '$pageview'), ifNull(notIn(path_item, ['/bar/*/foo']), 1)))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -322,7 +322,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), and(equals(events.event, '$pageview'), ifNull(notIn(path_item, ['/bar/*/foo']), 1)))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), and(equals(events.event, '$pageview'), ifNull(notIn(path_item, ['/bar/*/foo']), 1)))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -409,7 +409,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -496,7 +496,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), equals(events.event, '$screen'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), equals(events.event, '$screen'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -583,7 +583,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -670,7 +670,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), and(or(equals(events.event, '$pageview'), equals(events.event, '$screen'), not(startsWith(events.event, '$'))), ifNull(notIn(path_item, ['/custom1', '/1', '/2', '/3']), 1)))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), and(or(equals(events.event, '$pageview'), equals(events.event, '$screen'), not(startsWith(events.event, '$'))), ifNull(notIn(path_item, ['/custom1', '/1', '/2', '/3']), 1)))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -757,7 +757,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-03 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-03 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -852,7 +852,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), ifNull(equals(events__group_0.properties___industry, 'finance'), 0), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-02-01 23:59:59', 'UTC')))), or(equals(events.event, '$pageview'), equals(events.event, '$screen'), not(startsWith(events.event, '$'))))+ WHERE and(equals(events.team_id, 99999), ifNull(equals(events__group_0.properties___industry, 'finance'), 0), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-02-01 23:59:59', 'UTC')))), or(equals(events.event, '$pageview'), equals(events.event, '$screen'), not(startsWith(events.event, '$'))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -947,7 +947,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), ifNull(equals(events__group_0.properties___industry, 'technology'), 0), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-02-01 23:59:59', 'UTC')))), or(equals(events.event, '$pageview'), equals(events.event, '$screen'), not(startsWith(events.event, '$'))))+ WHERE and(equals(events.team_id, 99999), ifNull(equals(events__group_0.properties___industry, 'technology'), 0), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-02-01 23:59:59', 'UTC')))), or(equals(events.event, '$pageview'), equals(events.event, '$screen'), not(startsWith(events.event, '$'))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -1042,7 +1042,7 @@WHERE and(equals(groups.team_id, 99999), equals(index, 1))GROUP BY groups.group_type_index,groups.group_key) AS events__group_1 ON equals(events.`$group_1`, events__group_1.key)- WHERE and(equals(events.team_id, 99999), ifNull(equals(events__group_1.properties___industry, 'technology'), 0), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-02-01 23:59:59', 'UTC')))), or(equals(events.event, '$pageview'), equals(events.event, '$screen'), not(startsWith(events.event, '$'))))+ WHERE and(equals(events.team_id, 99999), ifNull(equals(events__group_1.properties___industry, 'technology'), 0), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-02-01 23:59:59', 'UTC')))), or(equals(events.event, '$pageview'), equals(events.event, '$screen'), not(startsWith(events.event, '$'))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -1163,7 +1163,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -1284,7 +1284,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -1405,7 +1405,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -1526,7 +1526,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -1647,7 +1647,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -1768,7 +1768,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -1889,7 +1889,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -2010,7 +2010,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -2131,7 +2131,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -2227,7 +2227,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-02-01 23:59:59', 'UTC')))), or(equals(events.event, '$pageview'), equals(events.event, '$screen'), not(startsWith(events.event, '$'))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-02-01 23:59:59', 'UTC')))), or(equals(events.event, '$pageview'), equals(events.event, '$screen'), not(startsWith(events.event, '$'))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -2350,7 +2350,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-02 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-02 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -2385,7 +2385,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-02 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-02 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple, arrayEnumerate(session_paths) AS session_index) ARRAY@@ -2532,7 +2532,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-02 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-02 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -2567,7 +2567,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-02 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-02 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple, arrayEnumerate(session_paths) AS session_index) ARRAY@@ -2690,7 +2690,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-02 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-02 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -2725,7 +2725,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-02 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-02 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple, arrayEnumerate(session_paths) AS session_index) ARRAY@@ -2872,7 +2872,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-02 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-02 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -2907,7 +2907,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-02 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-02 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple, arrayEnumerate(session_paths) AS session_index) ARRAY@@ -3200,11 +3200,12 @@events__override.distinct_id)WHERE and(equals(events.team_id,99999), and(greaterOrEquals(events.timestamp,- toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',- 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp,- assumeNotNull(toDateTime('2012-01-02 23:59:59',- 'UTC')))), equals(events.event,- '$pageview'))+ toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',+ 'UTC')), toIntervalDay(1)), 6,+ 'UTC')), lessOrEquals(events.timestamp,+ assumeNotNull(toDateTime('2012-01-02 23:59:59',+ 'UTC')))), equals(events.event,+ '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id,events.person_id) ASC, toTimeZone(events.timestamp,'UTC') ASC)@@ -3461,11 +3462,12 @@events__override.distinct_id)WHERE and(equals(events.team_id,99999), and(greaterOrEquals(events.timestamp,- toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',- 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp,- assumeNotNull(toDateTime('2012-01-02 23:59:59',- 'UTC')))), equals(events.event,- '$pageview'))+ toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',+ 'UTC')), toIntervalDay(1)), 6,+ 'UTC')), lessOrEquals(events.timestamp,+ assumeNotNull(toDateTime('2012-01-02 23:59:59',+ 'UTC')))), equals(events.event,+ '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id,events.person_id) ASC, toTimeZone(events.timestamp,'UTC') ASC)@@ -3587,7 +3589,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -3678,7 +3680,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -3808,7 +3810,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -3900,7 +3902,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -4030,7 +4032,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -4118,7 +4120,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -4206,7 +4208,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -4293,7 +4295,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -4414,7 +4416,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -4535,7 +4537,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -4622,7 +4624,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -4743,7 +4745,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -4830,7 +4832,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -4951,7 +4953,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -5072,7 +5074,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -5193,7 +5195,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -5280,7 +5282,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -5372,7 +5374,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,diff --git a/products/product_analytics/backend/hogql_queries/paths/test/__snapshots__/test_paths_query_runner_ee.new_events_schema.ambr b/products/product_analytics/backend/hogql_queries/paths/test/__snapshots__/test_paths_query_runner_ee.new_events_schema.ambrindex 9887df86a0b4..2c52cde14850 100644--- a/products/product_analytics/backend/hogql_queries/paths/test/__snapshots__/test_paths_query_runner_ee.new_events_schema.ambr+++ b/products/product_analytics/backend/hogql_queries/paths/test/__snapshots__/test_paths_query_runner_ee.new_events_schema.ambr@@ -59,7 +59,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -148,7 +148,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -237,7 +237,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), and(equals(events.event, '$pageview'), ifNull(notIn(path_item, ['/bar/*/foo']), 1)))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), and(equals(events.event, '$pageview'), ifNull(notIn(path_item, ['/bar/*/foo']), 1)))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -325,7 +325,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), and(equals(events.event, '$pageview'), ifNull(notIn(path_item, ['/bar/*/foo']), 1)))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), and(equals(events.event, '$pageview'), ifNull(notIn(path_item, ['/bar/*/foo']), 1)))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -413,7 +413,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), equals(events.event, '$screen'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), equals(events.event, '$screen'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -501,7 +501,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -589,7 +589,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), and(or(equals(events.event, '$pageview'), equals(events.event, '$screen'), not(startsWith(events.event, '$'))), ifNull(notIn(path_item, ['/custom1', '/1', '/2', '/3']), 1)))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), and(or(equals(events.event, '$pageview'), equals(events.event, '$screen'), not(startsWith(events.event, '$'))), ifNull(notIn(path_item, ['/custom1', '/1', '/2', '/3']), 1)))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -677,7 +677,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -765,7 +765,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-03 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-03 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -861,7 +861,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), ifNull(equals(events__group_0.properties___industry, 'technology'), 0), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-02-01 23:59:59', 'UTC')))), or(equals(events.event, '$pageview'), equals(events.event, '$screen'), not(startsWith(events.event, '$'))))+ WHERE and(equals(events.team_id, 99999), ifNull(equals(events__group_0.properties___industry, 'technology'), 0), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-02-01 23:59:59', 'UTC')))), or(equals(events.event, '$pageview'), equals(events.event, '$screen'), not(startsWith(events.event, '$'))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -957,7 +957,7 @@WHERE and(equals(groups.team_id, 99999), equals(index, 1))GROUP BY groups.group_type_index,groups.group_key) AS events__group_1 ON equals(events.properties.`$group_1`, events__group_1.key)- WHERE and(equals(events.team_id, 99999), ifNull(equals(events__group_1.properties___industry, 'technology'), 0), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-02-01 23:59:59', 'UTC')))), or(equals(events.event, '$pageview'), equals(events.event, '$screen'), not(startsWith(events.event, '$'))))+ WHERE and(equals(events.team_id, 99999), ifNull(equals(events__group_1.properties___industry, 'technology'), 0), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-02-01 23:59:59', 'UTC')))), or(equals(events.event, '$pageview'), equals(events.event, '$screen'), not(startsWith(events.event, '$'))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -1053,7 +1053,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), ifNull(equals(events__group_0.properties___industry, 'finance'), 0), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-02-01 23:59:59', 'UTC')))), or(equals(events.event, '$pageview'), equals(events.event, '$screen'), not(startsWith(events.event, '$'))))+ WHERE and(equals(events.team_id, 99999), ifNull(equals(events__group_0.properties___industry, 'finance'), 0), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-02-01 23:59:59', 'UTC')))), or(equals(events.event, '$pageview'), equals(events.event, '$screen'), not(startsWith(events.event, '$'))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -1175,7 +1175,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -1297,7 +1297,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -1419,7 +1419,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -1541,7 +1541,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -1663,7 +1663,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -1785,7 +1785,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -1907,7 +1907,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -2029,7 +2029,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -2151,7 +2151,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), not(startsWith(events.event, '$')))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -2239,7 +2239,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-02-01 23:59:59', 'UTC')))), or(equals(events.event, '$pageview'), equals(events.event, '$screen'), not(startsWith(events.event, '$'))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-02-01 23:59:59', 'UTC')))), or(equals(events.event, '$pageview'), equals(events.event, '$screen'), not(startsWith(events.event, '$'))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -2451,11 +2451,12 @@events__override.distinct_id)WHERE and(equals(events.team_id,99999), and(greaterOrEquals(events.timestamp,- toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',- 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp,- assumeNotNull(toDateTime('2012-01-02 23:59:59',- 'UTC')))), equals(events.event,- '$pageview'))+ toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',+ 'UTC')), toIntervalDay(1)), 6,+ 'UTC')), lessOrEquals(events.timestamp,+ assumeNotNull(toDateTime('2012-01-02 23:59:59',+ 'UTC')))), equals(events.event,+ '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id,events.person_id) ASC, toTimeZone(events.timestamp,'UTC') ASC)@@ -2652,11 +2653,12 @@events__override.distinct_id)WHERE and(equals(events.team_id,99999), and(greaterOrEquals(events.timestamp,- toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',- 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp,- assumeNotNull(toDateTime('2012-01-02 23:59:59',- 'UTC')))), equals(events.event,- '$pageview'))+ toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',+ 'UTC')), toIntervalDay(1)), 6,+ 'UTC')), lessOrEquals(events.timestamp,+ assumeNotNull(toDateTime('2012-01-02 23:59:59',+ 'UTC')))), equals(events.event,+ '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id,events.person_id) ASC, toTimeZone(events.timestamp,'UTC') ASC)@@ -2877,11 +2879,12 @@events__override.distinct_id)WHERE and(equals(events.team_id,99999), and(greaterOrEquals(events.timestamp,- toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',- 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp,- assumeNotNull(toDateTime('2012-01-02 23:59:59',- 'UTC')))), equals(events.event,- '$pageview'))+ toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',+ 'UTC')), toIntervalDay(1)), 6,+ 'UTC')), lessOrEquals(events.timestamp,+ assumeNotNull(toDateTime('2012-01-02 23:59:59',+ 'UTC')))), equals(events.event,+ '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id,events.person_id) ASC, toTimeZone(events.timestamp,'UTC') ASC)@@ -3079,11 +3082,12 @@events__override.distinct_id)WHERE and(equals(events.team_id,99999), and(greaterOrEquals(events.timestamp,- toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',- 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp,- assumeNotNull(toDateTime('2012-01-02 23:59:59',- 'UTC')))), equals(events.event,- '$pageview'))+ toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',+ 'UTC')), toIntervalDay(1)), 6,+ 'UTC')), lessOrEquals(events.timestamp,+ assumeNotNull(toDateTime('2012-01-02 23:59:59',+ 'UTC')))), equals(events.event,+ '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id,events.person_id) ASC, toTimeZone(events.timestamp,'UTC') ASC)@@ -3305,11 +3309,12 @@events__override.distinct_id)WHERE and(equals(events.team_id,99999), and(greaterOrEquals(events.timestamp,- toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',- 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp,- assumeNotNull(toDateTime('2012-01-02 23:59:59',- 'UTC')))), equals(events.event,- '$pageview'))+ toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',+ 'UTC')), toIntervalDay(1)), 6,+ 'UTC')), lessOrEquals(events.timestamp,+ assumeNotNull(toDateTime('2012-01-02 23:59:59',+ 'UTC')))), equals(events.event,+ '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id,events.person_id) ASC, toTimeZone(events.timestamp,'UTC') ASC)@@ -3507,11 +3512,12 @@events__override.distinct_id)WHERE and(equals(events.team_id,99999), and(greaterOrEquals(events.timestamp,- toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',- 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp,- assumeNotNull(toDateTime('2012-01-02 23:59:59',- 'UTC')))), equals(events.event,- '$pageview'))+ toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',+ 'UTC')), toIntervalDay(1)), 6,+ 'UTC')), lessOrEquals(events.timestamp,+ assumeNotNull(toDateTime('2012-01-02 23:59:59',+ 'UTC')))), equals(events.event,+ '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id,events.person_id) ASC, toTimeZone(events.timestamp,'UTC') ASC)@@ -3733,11 +3739,12 @@events__override.distinct_id)WHERE and(equals(events.team_id,99999), and(greaterOrEquals(events.timestamp,- toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',- 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp,- assumeNotNull(toDateTime('2012-01-02 23:59:59',- 'UTC')))), equals(events.event,- '$pageview'))+ toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',+ 'UTC')), toIntervalDay(1)), 6,+ 'UTC')), lessOrEquals(events.timestamp,+ assumeNotNull(toDateTime('2012-01-02 23:59:59',+ 'UTC')))), equals(events.event,+ '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id,events.person_id) ASC, toTimeZone(events.timestamp,'UTC') ASC)@@ -3934,11 +3941,12 @@events__override.distinct_id)WHERE and(equals(events.team_id,99999), and(greaterOrEquals(events.timestamp,- toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',- 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp,- assumeNotNull(toDateTime('2012-01-02 23:59:59',- 'UTC')))), equals(events.event,- '$pageview'))+ toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',+ 'UTC')), toIntervalDay(1)), 6,+ 'UTC')), lessOrEquals(events.timestamp,+ assumeNotNull(toDateTime('2012-01-02 23:59:59',+ 'UTC')))), equals(events.event,+ '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id,events.person_id) ASC, toTimeZone(events.timestamp,'UTC') ASC)@@ -4222,11 +4230,12 @@events__override.distinct_id)WHERE and(equals(events.team_id,99999), and(greaterOrEquals(events.timestamp,- toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',- 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp,- assumeNotNull(toDateTime('2012-01-02 23:59:59',- 'UTC')))), equals(events.event,- '$pageview'))+ toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',+ 'UTC')), toIntervalDay(1)), 6,+ 'UTC')), lessOrEquals(events.timestamp,+ assumeNotNull(toDateTime('2012-01-02 23:59:59',+ 'UTC')))), equals(events.event,+ '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id,events.person_id) ASC, toTimeZone(events.timestamp,'UTC') ASC)@@ -4488,11 +4497,12 @@events__override.distinct_id)WHERE and(equals(events.team_id,99999), and(greaterOrEquals(events.timestamp,- toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',- 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp,- assumeNotNull(toDateTime('2012-01-02 23:59:59',- 'UTC')))), equals(events.event,- '$pageview'))+ toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00',+ 'UTC')), toIntervalDay(1)), 6,+ 'UTC')), lessOrEquals(events.timestamp,+ assumeNotNull(toDateTime('2012-01-02 23:59:59',+ 'UTC')))), equals(events.event,+ '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id,events.person_id) ASC, toTimeZone(events.timestamp,'UTC') ASC)@@ -4591,7 +4601,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -4721,7 +4731,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -4814,7 +4824,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -4945,7 +4955,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -5038,7 +5048,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -5127,7 +5137,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2021-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2021-05-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -5216,7 +5226,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -5338,7 +5348,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -5460,7 +5470,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -5548,7 +5558,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -5670,7 +5680,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -5758,7 +5768,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -5880,7 +5890,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -6002,7 +6012,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -6124,7 +6134,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -6212,7 +6222,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2011-12-31 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2012-01-07 23:59:59', 'UTC')))))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -6300,7 +6310,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,@@ -6393,7 +6403,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2012-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-05-23 23:59:59', 'UTC')))), equals(events.event, '$pageview'))ORDER BY if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) ASC, toTimeZone(events.timestamp, 'UTC') ASC)GROUP BY person_id) ARRAYJOIN session_paths AS path_time_tuple,diff --git a/products/product_analytics/backend/hogql_queries/paths_v2/test/__snapshots__/test_paths_v2_query_runner.ambr b/products/product_analytics/backend/hogql_queries/paths_v2/test/__snapshots__/test_paths_v2_query_runner.ambrindex 68c567873914..de77e85c7ca1 100644--- a/products/product_analytics/backend/hogql_queries/paths_v2/test/__snapshots__/test_paths_v2_query_runner.ambr+++ b/products/product_analytics/backend/hogql_queries/paths_v2/test/__snapshots__/test_paths_v2_query_runner.ambr@@ -55,7 +55,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-03-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-03-31 23:59:59', 'UTC'))), in(events.event, ['$pageview'])))+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-03-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-03-31 23:59:59', 'UTC'))), in(events.event, ['$pageview'])))GROUP BY actor_id) ARRAYJOIN elements AS elementGROUP BY kind,@@ -115,7 +115,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-03-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-03-31 23:59:59', 'UTC'))), in(events.event, ['$pageview'])))+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-03-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-03-31 23:59:59', 'UTC'))), in(events.event, ['$pageview'])))GROUP BY actor_id) ARRAYJOIN arrayFilter(pair -> in(pair, tuple(tuple(tuple('$pageview', '/'), tuple('$pageview', '/pricing')))), arrayDistinct(arrayFlatten(arrayMap(journey -> arrayZip(arrayPopBack(journey), arrayPopFront(journey)), collapsed_journeys)))) AS pairGROUP BY pairdiff --git a/products/product_analytics/backend/hogql_queries/paths_v2/test/__snapshots__/test_paths_v2_query_runner.new_events_schema.ambr b/products/product_analytics/backend/hogql_queries/paths_v2/test/__snapshots__/test_paths_v2_query_runner.new_events_schema.ambrindex aba256edd507..8ae7159a3931 100644--- a/products/product_analytics/backend/hogql_queries/paths_v2/test/__snapshots__/test_paths_v2_query_runner.new_events_schema.ambr+++ b/products/product_analytics/backend/hogql_queries/paths_v2/test/__snapshots__/test_paths_v2_query_runner.new_events_schema.ambr@@ -29,7 +29,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-03-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-03-31 23:59:59', 'UTC'))), in(events.event, ['$pageview'])))+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-03-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-03-31 23:59:59', 'UTC'))), in(events.event, ['$pageview'])))GROUP BY actor_id) ARRAYJOIN arrayFilter(pair -> in(pair, tuple(tuple(tuple('$pageview', '/'), tuple('$pageview', '/pricing')))), arrayDistinct(arrayFlatten(arrayMap(journey -> arrayZip(arrayPopBack(journey), arrayPopFront(journey)), collapsed_journeys)))) AS pairGROUP BY pair@@ -104,7 +104,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-03-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-03-31 23:59:59', 'UTC'))), in(events.event, ['$pageview'])))+ WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-03-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-03-31 23:59:59', 'UTC'))), in(events.event, ['$pageview'])))GROUP BY actor_id) ARRAYJOIN elements AS elementGROUP BY kind,diff --git a/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_data_warehouse.ambr b/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_data_warehouse.ambrindex 1e047db0d2c5..8bd5b30d87e1 100644--- a/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_data_warehouse.ambr+++ b/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_data_warehouse.ambr@@ -28,7 +28,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2025-01-01 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('paid')), equals(events.event, 'paid'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('paid')), equals(events.event, 'paid'))GROUP BY actor_id) AS retention_eventsGROUP BY actor_idHAVING 1) AS actor_activity@@ -80,7 +80,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2025-01-01 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('paid')), equals(events.event, 'paid'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('paid')), equals(events.event, 'paid'))GROUP BY actor_id) AS retention_eventsGROUP BY actor_idHAVING 1) AS actor_activitydiff --git a/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_data_warehouse.new_events_schema.ambr b/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_data_warehouse.new_events_schema.ambrindex 9bf62b55f34b..da190b086c1f 100644--- a/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_data_warehouse.new_events_schema.ambr+++ b/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_data_warehouse.new_events_schema.ambr@@ -28,7 +28,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2025-01-01 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('paid')), equals(events.event, 'paid'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('paid')), equals(events.event, 'paid'))GROUP BY actor_id) AS retention_eventsGROUP BY actor_idHAVING 1) AS actor_activity@@ -81,7 +81,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2025-01-01 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('paid')), equals(events.event, 'paid'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('paid')), equals(events.event, 'paid'))GROUP BY actor_id) AS retention_eventsGROUP BY actor_idHAVING 1) AS actor_activitydiff --git a/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_data_warehouse_24h_window.ambr b/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_data_warehouse_24h_window.ambrindex b0a7fff23aad..1369ec7e893c 100644--- a/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_data_warehouse_24h_window.ambr+++ b/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_data_warehouse_24h_window.ambr@@ -26,7 +26,7 @@(SELECT toString(posthog_test_warehouse_renewals_ft.person_id) AS actor_id,toTimeZone(posthog_test_warehouse_renewals_ft.occurred_at, 'UTC') AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-products.product_analytics.backend.hogql_queries.retention.data_warehouse_24h_window/posthog_test_warehouse_renewals_ft/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` Int64, `person_id` UUID, `occurred_at` DateTime64(3, \'UTC\')') AS posthog_test_warehouse_renewals_ft- WHERE and(greaterOrEquals(posthog_test_warehouse_renewals_ft.occurred_at, toStartOfInterval(assumeNotNull(toDateTime('2025-01-01 00:00:00', 'UTC')), toIntervalDay(1))), less(posthog_test_warehouse_renewals_ft.occurred_at, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))) AS return_events ON equals(actors_with_t0.actor_id, return_events.actor_id)+ WHERE and(greaterOrEquals(posthog_test_warehouse_renewals_ft.occurred_at, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(posthog_test_warehouse_renewals_ft.occurred_at, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))) AS return_events ON equals(actors_with_t0.actor_id, return_events.actor_id)GROUP BY actors_with_t0.actor_id,actors_with_t0.t_0) AS actor_activityGROUP BY start_event_matching_interval,@@ -61,13 +61,13 @@(SELECT toString(posthog_test_warehouse_activity.person_id) AS actor_id,min(toTimeZone(posthog_test_warehouse_activity.occurred_at, 'UTC')) AS t_0FROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-products.product_analytics.backend.hogql_queries.retention.data_warehouse_24h_window/posthog_test_warehouse_activity/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` Int64, `person_id` UUID, `occurred_at` DateTime64(3, \'UTC\'), `activity_type` String') AS posthog_test_warehouse_activity- WHERE and(equals(posthog_test_warehouse_activity.activity_type, 'signed_up'), and(greaterOrEquals(posthog_test_warehouse_activity.occurred_at, toStartOfInterval(assumeNotNull(toDateTime('2025-01-01 00:00:00', 'UTC')), toIntervalDay(1))), less(posthog_test_warehouse_activity.occurred_at, toDateTime64('2025-01-06 00:00:00.000000', 6, 'UTC'))))+ WHERE and(equals(posthog_test_warehouse_activity.activity_type, 'signed_up'), and(greaterOrEquals(posthog_test_warehouse_activity.occurred_at, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(posthog_test_warehouse_activity.occurred_at, toDateTime64('2025-01-06 00:00:00.000000', 6, 'UTC'))))GROUP BY actor_id) AS actors_with_t0LEFT JOIN(SELECT toString(posthog_test_warehouse_activity.person_id) AS actor_id,toTimeZone(posthog_test_warehouse_activity.occurred_at, 'UTC') AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-products.product_analytics.backend.hogql_queries.retention.data_warehouse_24h_window/posthog_test_warehouse_activity/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` Int64, `person_id` UUID, `occurred_at` DateTime64(3, \'UTC\'), `activity_type` String') AS posthog_test_warehouse_activity- WHERE and(equals(posthog_test_warehouse_activity.activity_type, 'renewed'), and(greaterOrEquals(posthog_test_warehouse_activity.occurred_at, toStartOfInterval(assumeNotNull(toDateTime('2025-01-01 00:00:00', 'UTC')), toIntervalDay(1))), less(posthog_test_warehouse_activity.occurred_at, toDateTime64('2025-01-06 00:00:00.000000', 6, 'UTC'))))) AS return_events ON equals(actors_with_t0.actor_id, return_events.actor_id)+ WHERE and(equals(posthog_test_warehouse_activity.activity_type, 'renewed'), and(greaterOrEquals(posthog_test_warehouse_activity.occurred_at, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(posthog_test_warehouse_activity.occurred_at, toDateTime64('2025-01-06 00:00:00.000000', 6, 'UTC'))))) AS return_events ON equals(actors_with_t0.actor_id, return_events.actor_id)GROUP BY actors_with_t0.actor_id,actors_with_t0.t_0) AS actor_activityGROUP BY start_event_matching_interval,diff --git a/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_data_warehouse_24h_window.new_events_schema.ambr b/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_data_warehouse_24h_window.new_events_schema.ambrindex 6e9f4030a978..aa00518e9bb4 100644--- a/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_data_warehouse_24h_window.new_events_schema.ambr+++ b/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_data_warehouse_24h_window.new_events_schema.ambr@@ -26,7 +26,7 @@(SELECT toString(posthog_test_warehouse_renewals_ft.person_id) AS actor_id,toTimeZone(posthog_test_warehouse_renewals_ft.occurred_at, 'UTC') AS timestampFROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-products.product_analytics.backend.hogql_queries.retention.data_warehouse_24h_window/posthog_test_warehouse_renewals_ft/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` Int64, `person_id` UUID, `occurred_at` DateTime64(3, \'UTC\')') AS posthog_test_warehouse_renewals_ft- WHERE and(greaterOrEquals(posthog_test_warehouse_renewals_ft.occurred_at, toStartOfInterval(assumeNotNull(toDateTime('2025-01-01 00:00:00', 'UTC')), toIntervalDay(1))), less(posthog_test_warehouse_renewals_ft.occurred_at, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))) AS return_events ON equals(actors_with_t0.actor_id, return_events.actor_id)+ WHERE and(greaterOrEquals(posthog_test_warehouse_renewals_ft.occurred_at, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2025-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(posthog_test_warehouse_renewals_ft.occurred_at, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))) AS return_events ON equals(actors_with_t0.actor_id, return_events.actor_id)GROUP BY actors_with_t0.actor_id,actors_with_t0.t_0) AS actor_activityGROUP BY start_event_matching_interval,diff --git a/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_query_runner.ambr b/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_query_runner.ambrindex 4f6f776dd8c4..d5b20f44c3be 100644--- a/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_query_runner.ambr+++ b/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_query_runner.ambr@@ -12,7 +12,7 @@arrayJoin(arrayFilter(x -> ifNull(greater(x, -1), 0), arrayMap((interval_index, interval_date, _start_event_timestamps) -> if(has(_start_event_timestamps, interval_date), minus(interval_index, 1), -1), arrayEnumerate(date_range), date_range, arrayResize([start_event_timestamps], length(date_range), start_event_timestamps)))) AS start_interval_index,arrayJoin(arrayConcat(if(has(start_event_timestamps, date_range[plus(start_interval_index, 1)]), [0], []), arrayFilter(x -> ifNull(greater(x, 0), 0), arrayMap(_timestamp -> minus(indexOf(arraySlice(date_range, plus(start_interval_index, 1), 7), _timestamp), 1), return_event_timestamps)))) AS intervals_from_baseFROM events- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0)), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.`$group_0`)))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0), 6, 'UTC')), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.`$group_0`)))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -57,7 +57,7 @@arrayJoin(arrayFilter(x -> ifNull(greater(x, -1), 0), arrayMap((interval_index, interval_date, _start_event_timestamps) -> if(has(_start_event_timestamps, interval_date), minus(interval_index, 1), -1), arrayEnumerate(date_range), date_range, arrayResize([start_event_timestamps], length(date_range), start_event_timestamps)))) AS start_interval_index,arrayJoin(arrayConcat(if(has(start_event_timestamps, date_range[plus(start_interval_index, 1)]), [0], []), arrayFilter(x -> ifNull(greater(x, 0), 0), arrayMap(_timestamp -> minus(indexOf(arraySlice(date_range, plus(start_interval_index, 1), 7), _timestamp), 1), return_event_timestamps)))) AS intervals_from_baseFROM events- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0)), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.`$group_0`)))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0), 6, 'UTC')), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.`$group_0`)))GROUP BY actor_idHAVING equals(start_interval_index, 0)) AS actor_activityGROUP BY actor_activity.actor_id) AS source@@ -92,7 +92,7 @@arrayJoin(arrayFilter(x -> ifNull(greater(x, -1), 0), arrayMap((interval_index, interval_date, _start_event_timestamps) -> if(has(_start_event_timestamps, interval_date), minus(interval_index, 1), -1), arrayEnumerate(date_range), date_range, arrayResize([start_event_timestamps], length(date_range), start_event_timestamps)))) AS start_interval_index,arrayJoin(arrayConcat(if(has(start_event_timestamps, date_range[plus(start_interval_index, 1)]), [0], []), arrayFilter(x -> ifNull(greater(x, 0), 0), arrayMap(_timestamp -> minus(indexOf(arraySlice(date_range, plus(start_interval_index, 1), 7), _timestamp), 1), return_event_timestamps)))) AS intervals_from_baseFROM events- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0)), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.`$group_1`)))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0), 6, 'UTC')), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.`$group_1`)))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -126,7 +126,7 @@arrayJoin(arrayFilter(x -> ifNull(greater(x, -1), 0), arrayMap((interval_index, interval_date, _start_event_timestamps) -> if(has(_start_event_timestamps, interval_date), minus(interval_index, 1), -1), arrayEnumerate(date_range), date_range, arrayResize([start_event_timestamps], length(date_range), start_event_timestamps)))) AS start_interval_index,arrayJoin(arrayConcat(if(has(start_event_timestamps, date_range[plus(start_interval_index, 1)]), [0], []), arrayFilter(x -> ifNull(greater(x, 0), 0), arrayMap(_timestamp -> minus(indexOf(arraySlice(date_range, plus(start_interval_index, 1), 7), _timestamp), 1), return_event_timestamps)))) AS intervals_from_baseFROM events- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0)), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.`$group_0`)))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0), 6, 'UTC')), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.`$group_0`)))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -171,7 +171,7 @@arrayJoin(arrayFilter(x -> ifNull(greater(x, -1), 0), arrayMap((interval_index, interval_date, _start_event_timestamps) -> if(has(_start_event_timestamps, interval_date), minus(interval_index, 1), -1), arrayEnumerate(date_range), date_range, arrayResize([start_event_timestamps], length(date_range), start_event_timestamps)))) AS start_interval_index,arrayJoin(arrayConcat(if(has(start_event_timestamps, date_range[plus(start_interval_index, 1)]), [0], []), arrayFilter(x -> ifNull(greater(x, 0), 0), arrayMap(_timestamp -> minus(indexOf(arraySlice(date_range, plus(start_interval_index, 1), 7), _timestamp), 1), return_event_timestamps)))) AS intervals_from_baseFROM events- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0)), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.`$group_0`)))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0), 6, 'UTC')), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.`$group_0`)))GROUP BY actor_idHAVING equals(start_interval_index, 0)) AS actor_activityGROUP BY actor_activity.actor_id) AS source@@ -206,7 +206,7 @@arrayJoin(arrayFilter(x -> ifNull(greater(x, -1), 0), arrayMap((interval_index, interval_date, _start_event_timestamps) -> if(has(_start_event_timestamps, interval_date), minus(interval_index, 1), -1), arrayEnumerate(date_range), date_range, arrayResize([start_event_timestamps], length(date_range), start_event_timestamps)))) AS start_interval_index,arrayJoin(arrayConcat(if(has(start_event_timestamps, date_range[plus(start_interval_index, 1)]), [0], []), arrayFilter(x -> ifNull(greater(x, 0), 0), arrayMap(_timestamp -> minus(indexOf(arraySlice(date_range, plus(start_interval_index, 1), 7), _timestamp), 1), return_event_timestamps)))) AS intervals_from_baseFROM events- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0)), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.`$group_1`)))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0), 6, 'UTC')), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.`$group_1`)))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -247,7 +247,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -296,10 +296,10 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))GROUP BY actor_idHAVING isNotNull(t_0)) AS actors_with_t0 ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), actors_with_t0.actor_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), greaterOrEquals(events.timestamp, actors_with_t0.t_0))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), greaterOrEquals(events.timestamp, toDateTime64(actors_with_t0.t_0, 6, 'UTC')))GROUP BY actors_with_t0.actor_id,actors_with_t0.t_0) AS actor_activityGROUP BY start_event_matching_interval,@@ -340,7 +340,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -389,10 +389,10 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))GROUP BY actor_idHAVING isNotNull(t_0)) AS actors_with_t0 ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), actors_with_t0.actor_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), greaterOrEquals(events.timestamp, actors_with_t0.t_0))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), greaterOrEquals(events.timestamp, toDateTime64(actors_with_t0.t_0, 6, 'UTC')))GROUP BY actors_with_t0.actor_id,actors_with_t0.t_0) AS actor_activityGROUP BY start_event_matching_interval,@@ -433,7 +433,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -483,7 +483,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalMonth(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalMonth(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -540,7 +540,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('signed_up')), equals(events.event, 'signed_up'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('signed_up')), equals(events.event, 'signed_up'))GROUP BY actor_idUNION ALL SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS actor_id,[] AS start_event_timestamps,@@ -555,7 +555,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('purchased')), equals(events.event, 'purchased'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('purchased')), equals(events.event, 'purchased'))GROUP BY actor_id) AS retention_eventsGROUP BY actor_idHAVING 1) AS actor_activity@@ -609,7 +609,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), equals(events.event, '$pageview'))GROUP BY actor_idUNION ALL SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS actor_id,[] AS start_event_timestamps,@@ -624,7 +624,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), equals(events.event, '$pageview'))GROUP BY actor_id) AS retention_eventsGROUP BY actor_idHAVING 1) AS actor_activity@@ -666,7 +666,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$some_event', 'sign up')), or(equals(events.event, 'sign up'), equals(events.event, '$some_event')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$some_event', 'sign up')), or(equals(events.event, 'sign up'), equals(events.event, '$some_event')))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -754,7 +754,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), in(events.event, tuple('act_a', 'signup')), or(in(events.event, tuple('signup')), and(in(events.event, tuple('act_a')), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))))))+ WHERE and(equals(events.team_id, 99999), in(events.event, tuple('act_a', 'signup')), or(in(events.event, tuple('signup')), and(in(events.event, tuple('act_a')), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))))))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -819,7 +819,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), in(events.event, tuple('returning_event')), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), equals(events.event, 'returning_event'))) AS events+ WHERE and(equals(events.team_id, 99999), in(events.event, tuple('returning_event')), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), equals(events.event, 'returning_event'))) AS eventsGROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -882,7 +882,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), in(events.event, tuple('returning_event')), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), equals(events.event, 'returning_event'))) AS events+ WHERE and(equals(events.team_id, 99999), in(events.event, tuple('returning_event')), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), equals(events.event, 'returning_event'))) AS eventsGROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -923,7 +923,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview', 'non_matching_event')), or(or(and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0)), equals(events.event, 'non_matching_event')), equals(events.event, '$pageview')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview', 'non_matching_event')), or(or(and(equals(events.event, '$pageview'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, 'email'), ''), 'null'), '^"|"$', ''), '[email protected]'), 0)), equals(events.event, 'non_matching_event')), equals(events.event, '$pageview')))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -964,7 +964,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -1005,7 +1005,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'US/Pacific')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'US/Pacific'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'US/Pacific')), toIntervalDay(1)), 6, 'US/Pacific')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'US/Pacific'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -1046,7 +1046,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0)), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -1087,7 +1087,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfWeek(assumeNotNull(toDateTime('2020-06-08 00:00:00', 'UTC')), 3)), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfWeek(assumeNotNull(toDateTime('2020-06-08 00:00:00', 'UTC')), 3), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,diff --git a/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_query_runner.new_events_schema.ambr b/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_query_runner.new_events_schema.ambrindex 9047e9517dd8..323afece69ec 100644--- a/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_query_runner.new_events_schema.ambr+++ b/products/product_analytics/backend/hogql_queries/retention/test/__snapshots__/test_retention_query_runner.new_events_schema.ambr@@ -23,7 +23,7 @@arrayJoin(arrayFilter(x -> ifNull(greater(x, -1), 0), arrayMap((interval_index, interval_date, _start_event_timestamps) -> if(has(_start_event_timestamps, interval_date), minus(interval_index, 1), -1), arrayEnumerate(date_range), date_range, arrayResize([start_event_timestamps], length(date_range), start_event_timestamps)))) AS start_interval_index,arrayJoin(arrayConcat(if(has(start_event_timestamps, date_range[plus(start_interval_index, 1)]), [0], []), arrayFilter(x -> ifNull(greater(x, 0), 0), arrayMap(_timestamp -> minus(indexOf(arraySlice(date_range, plus(start_interval_index, 1), 7), _timestamp), 1), return_event_timestamps)))) AS intervals_from_baseFROM events_json AS events- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0)), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.properties.`$group_0`)))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0), 6, 'UTC')), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.properties.`$group_0`)))GROUP BY actor_idHAVING equals(start_interval_index, 0)) AS actor_activityGROUP BY actor_activity.actor_id) AS source@@ -59,7 +59,7 @@arrayJoin(arrayFilter(x -> ifNull(greater(x, -1), 0), arrayMap((interval_index, interval_date, _start_event_timestamps) -> if(has(_start_event_timestamps, interval_date), minus(interval_index, 1), -1), arrayEnumerate(date_range), date_range, arrayResize([start_event_timestamps], length(date_range), start_event_timestamps)))) AS start_interval_index,arrayJoin(arrayConcat(if(has(start_event_timestamps, date_range[plus(start_interval_index, 1)]), [0], []), arrayFilter(x -> ifNull(greater(x, 0), 0), arrayMap(_timestamp -> minus(indexOf(arraySlice(date_range, plus(start_interval_index, 1), 7), _timestamp), 1), return_event_timestamps)))) AS intervals_from_baseFROM events_json AS events- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0)), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.properties.`$group_1`)))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0), 6, 'UTC')), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.properties.`$group_1`)))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -94,7 +94,7 @@arrayJoin(arrayFilter(x -> ifNull(greater(x, -1), 0), arrayMap((interval_index, interval_date, _start_event_timestamps) -> if(has(_start_event_timestamps, interval_date), minus(interval_index, 1), -1), arrayEnumerate(date_range), date_range, arrayResize([start_event_timestamps], length(date_range), start_event_timestamps)))) AS start_interval_index,arrayJoin(arrayConcat(if(has(start_event_timestamps, date_range[plus(start_interval_index, 1)]), [0], []), arrayFilter(x -> ifNull(greater(x, 0), 0), arrayMap(_timestamp -> minus(indexOf(arraySlice(date_range, plus(start_interval_index, 1), 7), _timestamp), 1), return_event_timestamps)))) AS intervals_from_baseFROM events_json AS events- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0)), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.properties.`$group_0`)))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0), 6, 'UTC')), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.properties.`$group_0`)))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -140,7 +140,7 @@arrayJoin(arrayFilter(x -> ifNull(greater(x, -1), 0), arrayMap((interval_index, interval_date, _start_event_timestamps) -> if(has(_start_event_timestamps, interval_date), minus(interval_index, 1), -1), arrayEnumerate(date_range), date_range, arrayResize([start_event_timestamps], length(date_range), start_event_timestamps)))) AS start_interval_index,arrayJoin(arrayConcat(if(has(start_event_timestamps, date_range[plus(start_interval_index, 1)]), [0], []), arrayFilter(x -> ifNull(greater(x, 0), 0), arrayMap(_timestamp -> minus(indexOf(arraySlice(date_range, plus(start_interval_index, 1), 7), _timestamp), 1), return_event_timestamps)))) AS intervals_from_baseFROM events_json AS events- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0)), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.properties.`$group_0`)))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0), 6, 'UTC')), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.properties.`$group_0`)))GROUP BY actor_idHAVING equals(start_interval_index, 0)) AS actor_activityGROUP BY actor_activity.actor_id) AS source@@ -176,7 +176,7 @@arrayJoin(arrayFilter(x -> ifNull(greater(x, -1), 0), arrayMap((interval_index, interval_date, _start_event_timestamps) -> if(has(_start_event_timestamps, interval_date), minus(interval_index, 1), -1), arrayEnumerate(date_range), date_range, arrayResize([start_event_timestamps], length(date_range), start_event_timestamps)))) AS start_interval_index,arrayJoin(arrayConcat(if(has(start_event_timestamps, date_range[plus(start_interval_index, 1)]), [0], []), arrayFilter(x -> ifNull(greater(x, 0), 0), arrayMap(_timestamp -> minus(indexOf(arraySlice(date_range, plus(start_interval_index, 1), 7), _timestamp), 1), return_event_timestamps)))) AS intervals_from_baseFROM events_json AS events- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0)), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.properties.`$group_1`)))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0), 6, 'UTC')), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.properties.`$group_1`)))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -211,7 +211,7 @@arrayJoin(arrayFilter(x -> ifNull(greater(x, -1), 0), arrayMap((interval_index, interval_date, _start_event_timestamps) -> if(has(_start_event_timestamps, interval_date), minus(interval_index, 1), -1), arrayEnumerate(date_range), date_range, arrayResize([start_event_timestamps], length(date_range), start_event_timestamps)))) AS start_interval_index,arrayJoin(arrayConcat(if(has(start_event_timestamps, date_range[plus(start_interval_index, 1)]), [0], []), arrayFilter(x -> ifNull(greater(x, 0), 0), arrayMap(_timestamp -> minus(indexOf(arraySlice(date_range, plus(start_interval_index, 1), 7), _timestamp), 1), return_event_timestamps)))) AS intervals_from_baseFROM events_json AS events- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0)), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.properties.`$group_0`)))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0), 6, 'UTC')), less(events.timestamp, toDateTime64('2020-07-26 00:00:00.000000', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), not(has([''], events.properties.`$group_0`)))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -261,10 +261,10 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))GROUP BY actor_idHAVING isNotNull(t_0)) AS actors_with_t0 ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), actors_with_t0.actor_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), greaterOrEquals(events.timestamp, actors_with_t0.t_0))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), greaterOrEquals(events.timestamp, toDateTime64(actors_with_t0.t_0, 6, 'UTC')))GROUP BY actors_with_t0.actor_id,actors_with_t0.t_0) AS actor_activityGROUP BY start_event_matching_interval,@@ -306,7 +306,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -356,10 +356,10 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))GROUP BY actor_idHAVING isNotNull(t_0)) AS actors_with_t0 ON equals(if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id), actors_with_t0.actor_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), greaterOrEquals(events.timestamp, actors_with_t0.t_0))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')), greaterOrEquals(events.timestamp, toDateTime64(actors_with_t0.t_0, 6, 'UTC')))GROUP BY actors_with_t0.actor_id,actors_with_t0.t_0) AS actor_activityGROUP BY start_event_matching_interval,@@ -401,7 +401,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -443,7 +443,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -485,7 +485,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalMonth(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalMonth(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -543,7 +543,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('signed_up')), equals(events.event, 'signed_up'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('signed_up')), equals(events.event, 'signed_up'))GROUP BY actor_idUNION ALL SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS actor_id,[] AS start_event_timestamps,@@ -558,7 +558,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('purchased')), equals(events.event, 'purchased'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('purchased')), equals(events.event, 'purchased'))GROUP BY actor_id) AS retention_eventsGROUP BY actor_idHAVING 1) AS actor_activity@@ -613,7 +613,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), equals(events.event, '$pageview'))GROUP BY actor_idUNION ALL SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS actor_id,[] AS start_event_timestamps,@@ -628,7 +628,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), equals(events.event, '$pageview'))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), equals(events.event, '$pageview'))GROUP BY actor_id) AS retention_eventsGROUP BY actor_idHAVING 1) AS actor_activity@@ -671,7 +671,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$some_event', 'sign up')), or(equals(events.event, 'sign up'), equals(events.event, '$some_event')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$some_event', 'sign up')), or(equals(events.event, 'sign up'), equals(events.event, '$some_event')))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -717,7 +717,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), in(events.event, tuple('act_a', 'signup')), or(in(events.event, tuple('signup')), and(in(events.event, tuple('act_a')), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))))))+ WHERE and(equals(events.team_id, 99999), in(events.event, tuple('act_a', 'signup')), or(in(events.event, tuple('signup')), and(in(events.event, tuple('act_a')), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))))))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -827,7 +827,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), in(events.event, tuple('returning_event')), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), equals(events.event, 'returning_event'))) AS events+ WHERE and(equals(events.team_id, 99999), in(events.event, tuple('returning_event')), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), equals(events.event, 'returning_event'))) AS eventsGROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -891,7 +891,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), in(events.event, tuple('returning_event')), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), equals(events.event, 'returning_event'))) AS events+ WHERE and(equals(events.team_id, 99999), in(events.event, tuple('returning_event')), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), equals(events.event, 'returning_event'))) AS eventsGROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -933,7 +933,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview', 'non_matching_event')), or(or(and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), '[email protected]'), 0)), equals(events.event, 'non_matching_event')), equals(events.event, '$pageview')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview', 'non_matching_event')), or(or(and(equals(events.event, '$pageview'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.person_properties.^email)), if(isNull(nullIf(toString(events.person_properties.email), '')), NULL, if(and(in(ascii(toString(events.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(events.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.person_properties.email), '[]'), '{}'), toString(events.person_properties.email)))), '[email protected]'), 0)), equals(events.event, 'non_matching_event')), equals(events.event, '$pageview')))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -975,7 +975,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'US/Pacific')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'US/Pacific'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'US/Pacific')), toIntervalDay(1)), 6, 'US/Pacific')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'US/Pacific'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -1017,7 +1017,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1))), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-06-10 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -1059,7 +1059,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfWeek(assumeNotNull(toDateTime('2020-06-08 00:00:00', 'UTC')), 3)), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfWeek(assumeNotNull(toDateTime('2020-06-08 00:00:00', 'UTC')), 3), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,@@ -1101,7 +1101,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0)), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))+ WHERE and(equals(events.team_id, 99999), and(greaterOrEquals(events.timestamp, toDateTime64(toStartOfWeek(assumeNotNull(toDateTime('2020-06-07 00:00:00', 'UTC')), 0), 6, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), or(equals(events.event, '$pageview'), equals(events.event, '$pageview')))GROUP BY actor_idHAVING 1) AS actor_activityGROUP BY start_event_matching_interval,diff --git a/products/product_analytics/backend/hogql_queries/stickiness/test/__snapshots__/test_stickiness_insight_actors.ambr b/products/product_analytics/backend/hogql_queries/stickiness/test/__snapshots__/test_stickiness_insight_actors.ambrindex 073ae2e73cd1..dce5cd2727c2 100644--- a/products/product_analytics/backend/hogql_queries/stickiness/test/__snapshots__/test_stickiness_insight_actors.ambr+++ b/products/product_analytics/backend/hogql_queries/stickiness/test/__snapshots__/test_stickiness_insight_actors.ambr@@ -13,7 +13,7 @@(SELECT e.`$group_0` AS aggregation_target,toStartOfInterval(toTimeZone(e.timestamp, 'US/Pacific'), toIntervalDay(1)) AS start_of_intervalFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'US/Pacific')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific'))), equals(e.event, '$pageview'), notEquals(e.`$group_0`, ''))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'US/Pacific')), toIntervalDay(1)), 6, 'US/Pacific')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific'))), equals(e.event, '$pageview'), notEquals(e.`$group_0`, ''))GROUP BY aggregation_target,start_of_intervalHAVING greater(count(), 0))@@ -64,7 +64,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-09 00:00:00', 'US/Pacific')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-09 00:00:00', 'US/Pacific')), toIntervalDay(1)), 6, 'US/Pacific')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific'))), equals(e.event, '$pageview'))GROUP BY aggregation_target,start_of_intervalHAVING greater(count(), 0))@@ -92,7 +92,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-09 00:00:00', 'US/Pacific')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-09 00:00:00', 'US/Pacific')), toIntervalDay(1)), 6, 'US/Pacific')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific'))), equals(e.event, '$pageview'))GROUP BY aggregation_target, start_of_intervalHAVING greater(count(), 0))GROUP BY aggregation_target)diff --git a/products/product_analytics/backend/hogql_queries/stickiness/test/__snapshots__/test_stickiness_insight_actors.new_events_schema.ambr b/products/product_analytics/backend/hogql_queries/stickiness/test/__snapshots__/test_stickiness_insight_actors.new_events_schema.ambrindex 85df1edb5ccd..45f37656b88a 100644--- a/products/product_analytics/backend/hogql_queries/stickiness/test/__snapshots__/test_stickiness_insight_actors.new_events_schema.ambr+++ b/products/product_analytics/backend/hogql_queries/stickiness/test/__snapshots__/test_stickiness_insight_actors.new_events_schema.ambr@@ -13,7 +13,7 @@(SELECT e.properties.`$group_0` AS aggregation_target,toStartOfInterval(toTimeZone(e.timestamp, 'US/Pacific'), toIntervalDay(1)) AS start_of_intervalFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'US/Pacific')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific'))), equals(e.event, '$pageview'), notEquals(e.properties.`$group_0`, ''))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'US/Pacific')), toIntervalDay(1)), 6, 'US/Pacific')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific'))), equals(e.event, '$pageview'), notEquals(e.properties.`$group_0`, ''))GROUP BY aggregation_target,start_of_intervalHAVING greater(count(), 0))@@ -65,7 +65,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-09 00:00:00', 'US/Pacific')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-09 00:00:00', 'US/Pacific')), toIntervalDay(1)), 6, 'US/Pacific')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific'))), equals(e.event, '$pageview'))GROUP BY aggregation_target,start_of_intervalHAVING greater(count(), 0))@@ -93,7 +93,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-09 00:00:00', 'US/Pacific')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-09 00:00:00', 'US/Pacific')), toIntervalDay(1)), 6, 'US/Pacific')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific'))), equals(e.event, '$pageview'))GROUP BY aggregation_target, start_of_intervalHAVING greater(count(), 0))GROUP BY aggregation_target)diff --git a/products/product_analytics/backend/hogql_queries/stickiness/test/__snapshots__/test_stickiness_query_runner.ambr b/products/product_analytics/backend/hogql_queries/stickiness/test/__snapshots__/test_stickiness_query_runner.ambrindex 32bc4269e898..40d67b5b69af 100644--- a/products/product_analytics/backend/hogql_queries/stickiness/test/__snapshots__/test_stickiness_query_runner.ambr+++ b/products/product_analytics/backend/hogql_queries/stickiness/test/__snapshots__/test_stickiness_query_runner.ambr@@ -16,7 +16,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY aggregation_target,start_of_intervalHAVING greater(count(), 0))@@ -53,7 +53,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY aggregation_target,start_of_intervalHAVING greater(count(), 0))@@ -90,7 +90,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY aggregation_target,start_of_intervalHAVING greater(count(), 0))@@ -127,7 +127,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY aggregation_target,start_of_intervalHAVING greater(count(), 0))@@ -164,7 +164,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY aggregation_target,start_of_intervalHAVING greater(count(), 0))@@ -201,7 +201,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY aggregation_target,start_of_intervalHAVING greater(count(), 0))@@ -248,7 +248,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY aggregation_target,start_of_intervalHAVING greater(count(), 0))@@ -342,7 +342,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-20 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-20 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY aggregation_target,start_of_intervalHAVING greater(count(), 0))diff --git a/products/product_analytics/backend/hogql_queries/stickiness/test/__snapshots__/test_stickiness_query_runner.new_events_schema.ambr b/products/product_analytics/backend/hogql_queries/stickiness/test/__snapshots__/test_stickiness_query_runner.new_events_schema.ambrindex 4fec70578980..c1415f87debb 100644--- a/products/product_analytics/backend/hogql_queries/stickiness/test/__snapshots__/test_stickiness_query_runner.new_events_schema.ambr+++ b/products/product_analytics/backend/hogql_queries/stickiness/test/__snapshots__/test_stickiness_query_runner.new_events_schema.ambr@@ -16,7 +16,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY aggregation_target,start_of_intervalHAVING greater(count(), 0))@@ -54,7 +54,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY aggregation_target,start_of_intervalHAVING greater(count(), 0))@@ -92,7 +92,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY aggregation_target,start_of_intervalHAVING greater(count(), 0))@@ -130,7 +130,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY aggregation_target,start_of_intervalHAVING greater(count(), 0))@@ -168,7 +168,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY aggregation_target,start_of_intervalHAVING greater(count(), 0))@@ -206,7 +206,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY aggregation_target,start_of_intervalHAVING greater(count(), 0))@@ -254,7 +254,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY aggregation_target,start_of_intervalHAVING greater(count(), 0))@@ -305,7 +305,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-20 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-11 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-20 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY aggregation_target,start_of_intervalHAVING greater(count(), 0))diff --git a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_boxplot_trends_query_runner.ambr b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_boxplot_trends_query_runner.ambrindex 28101faa4bde..ac04b06ff09f 100644--- a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_boxplot_trends_query_runner.ambr+++ b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_boxplot_trends_query_runner.ambr@@ -9,7 +9,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'amount'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'amount'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), equals(e.event, 'purchase'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), equals(e.event, 'purchase'))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -36,7 +36,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -63,7 +63,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 10:00:00', 'UTC')), toIntervalHour(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 12:00:00', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 10:00:00', 'UTC')), toIntervalHour(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 12:00:00', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -90,7 +90,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 10:00:00', 'UTC')), toIntervalMinute(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 10:05:00', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 10:00:00', 'UTC')), toIntervalMinute(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 10:05:00', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -117,7 +117,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-11-27 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-10 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-11-27 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-10 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -144,7 +144,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-10-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-31 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-10-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-31 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -171,7 +171,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-03 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-03 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -198,7 +198,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -225,7 +225,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -252,7 +252,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-03 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-03 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -279,7 +279,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -306,7 +306,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'other_prop'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'other_prop'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), equals(e.event, 'other_event'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), equals(e.event, 'other_event'))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -333,7 +333,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -360,7 +360,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-08 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-10 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-08 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-10 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -387,7 +387,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -414,7 +414,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -441,7 +441,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -468,7 +468,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -495,7 +495,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -522,7 +522,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-05 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-05 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -558,7 +558,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(e.`$session_id_uuid`, e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY e.`$session_id`,day_start)GROUP BY day_start@@ -587,7 +587,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-07 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-07 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -614,7 +614,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -641,7 +641,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -668,7 +668,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -695,7 +695,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -722,7 +722,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -749,7 +749,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -776,7 +776,7 @@max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_valFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,diff --git a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_boxplot_trends_query_runner.new_events_schema.ambr b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_boxplot_trends_query_runner.new_events_schema.ambrindex 6820a0fe7551..53e4613fe70a 100644--- a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_boxplot_trends_query_runner.new_events_schema.ambr+++ b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_boxplot_trends_query_runner.new_events_schema.ambr@@ -9,7 +9,7 @@max(accurateCastOrNull(e.properties.amount, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.amount, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), equals(e.event, 'purchase'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), equals(e.event, 'purchase'))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -37,7 +37,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -65,7 +65,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 10:00:00', 'UTC')), toIntervalHour(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 12:00:00', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 10:00:00', 'UTC')), toIntervalHour(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 12:00:00', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -93,7 +93,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 10:00:00', 'UTC')), toIntervalMinute(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 10:05:00', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 10:00:00', 'UTC')), toIntervalMinute(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 10:05:00', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -121,7 +121,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-11-27 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-10 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-11-27 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-10 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -149,7 +149,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-10-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-31 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-10-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-31 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -177,7 +177,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-03 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-03 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -205,7 +205,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -233,7 +233,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^email)), if(isNull(nullIf(toString(e.person_properties.email), '')), NULL, if(and(in(ascii(toString(e.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.email), '[]'), '{}'), toString(e.person_properties.email))))), '%@posthog.com%'), 1))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^email)), if(isNull(nullIf(toString(e.person_properties.email), '')), NULL, if(and(in(ascii(toString(e.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.email), '[]'), '{}'), toString(e.person_properties.email))))), '%@posthog.com%'), 1))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -261,7 +261,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-03 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-03 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -289,7 +289,7 @@max(accurateCastOrNull(e.properties.other_prop, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.other_prop, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), equals(e.event, 'other_event'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), equals(e.event, 'other_event'))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -317,7 +317,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -345,7 +345,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -373,7 +373,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-08 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-10 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-08 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-10 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -401,7 +401,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -429,7 +429,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -457,7 +457,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), if(isNull(nullIf(toString(e.properties.`$browser`), '')), NULL, if(and(in(ascii(toString(e.properties.`$browser`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$browser`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$browser`), '[]'), '{}'), toString(e.properties.`$browser`)))), 'Chrome'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), if(isNull(nullIf(toString(e.properties.`$browser`), '')), NULL, if(and(in(ascii(toString(e.properties.`$browser`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$browser`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$browser`), '[]'), '{}'), toString(e.properties.`$browser`)))), 'Chrome'), 0))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -485,7 +485,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), if(isNull(nullIf(toString(e.properties.`$browser`), '')), NULL, if(and(in(ascii(toString(e.properties.`$browser`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$browser`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$browser`), '[]'), '{}'), toString(e.properties.`$browser`)))), 'Firefox'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), if(isNull(nullIf(toString(e.properties.`$browser`), '')), NULL, if(and(in(ascii(toString(e.properties.`$browser`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$browser`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$browser`), '[]'), '{}'), toString(e.properties.`$browser`)))), 'Firefox'), 0))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -513,7 +513,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -541,7 +541,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-05 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-05 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -578,7 +578,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(toUInt128(toUUIDOrNull(e.properties.`$session_id`)), e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY e.properties.`$session_id`,day_start)GROUP BY day_start@@ -608,7 +608,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-07 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-07 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -636,7 +636,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -664,7 +664,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -692,7 +692,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -720,7 +720,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -748,7 +748,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -776,7 +776,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,@@ -804,7 +804,7 @@max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_valFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))GROUP BY day_startORDER BY day_start ASCLIMIT 100 SETTINGS readonly=2,diff --git a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_formula.ambr b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_formula.ambrindex c8f47a8aff7e..5fd254d68c35 100644--- a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_formula.ambr+++ b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_formula.ambr@@ -3,7 +3,7 @@'''SELECT ifNull(sum(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'xyz'), ''), 'null'), '^"|"$', ''), 'Float64')), 0) AS totalFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))ORDER BY 1 DESCLIMIT 50000 SETTINGS readonly=2,max_execution_time=60,@@ -23,7 +23,7 @@'''SELECT ifNull(sum(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'session not here'), ''), 'null'), '^"|"$', ''), 'Float64')), 0) AS totalFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session error'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session error'))ORDER BY 1 DESCLIMIT 50000 SETTINGS readonly=2,max_execution_time=60,@@ -59,7 +59,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'location'), ''), 'null'), '^"|"$', '')), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -105,7 +105,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'location'), ''), 'null'), '^"|"$', '')), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -147,7 +147,7 @@(SELECT ifNull(sum(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'xyz'), ''), 'null'), '^"|"$', ''), 'Float64')), 0) AS total,ifNull(nullIf(leftUTF8(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'location'), ''), 'null'), '^"|"$', '')), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY breakdown_value)GROUP BY breakdown_valueORDER BY breakdown_value ASC)@@ -187,7 +187,7 @@(SELECT ifNull(avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'xyz'), ''), 'null'), '^"|"$', ''), 'Float64')), 0) AS total,ifNull(nullIf(leftUTF8(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'location'), ''), 'null'), '^"|"$', '')), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY breakdown_value)GROUP BY breakdown_valueORDER BY breakdown_value ASC)@@ -241,7 +241,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,toString(0) AS breakdown_valueFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -287,7 +287,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,toString(0) AS breakdown_valueFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -340,10 +340,10 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.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)))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.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)))))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -396,10 +396,10 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.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)))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.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)))))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -445,7 +445,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(concat(ifNull(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, '$some_prop'), ''), 'null'), '^"|"$', '')), ''), ' : ', ifNull(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'location'), ''), 'null'), '^"|"$', '')), ''))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -491,7 +491,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(concat(ifNull(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, '$some_prop'), ''), 'null'), '^"|"$', '')), ''), ' : ', ifNull(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'location'), ''), 'null'), '^"|"$', '')), ''))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -537,7 +537,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'location'), ''), 'null'), '^"|"$', '')), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -583,7 +583,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'location'), ''), 'null'), '^"|"$', '')), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -629,7 +629,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'location'), ''), 'null'), '^"|"$', '')), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -675,7 +675,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'location'), ''), 'null'), '^"|"$', '')), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session end'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session end'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -705,7 +705,7 @@'''SELECT ifNull(accurateCastOrNull(sum(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'xyz'), ''), 'null'), '^"|"$', ''), 'Float64')), 'Float64'), 0) AS totalFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'nonexistent_event_that_has_no_data'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'nonexistent_event_that_has_no_data'))ORDER BY 1 DESCLIMIT 50000 SETTINGS readonly=2,max_execution_time=60,@@ -725,7 +725,7 @@'''SELECT ifNull(sum(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'xyz'), ''), 'null'), '^"|"$', ''), 'Float64')), 0) AS totalFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))ORDER BY 1 DESCLIMIT 50000 SETTINGS readonly=2,max_execution_time=60,@@ -753,7 +753,7 @@(SELECT count(DISTINCT e.`$session_id`) AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -791,7 +791,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -955,7 +955,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(e.`$session_id_uuid`, e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start,e.`$session_id`,day_start)@@ -989,7 +989,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session end'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session end'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1026,7 +1026,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(e.`$session_id_uuid`, e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'), greater(e__session.`$session_duration`, 12.0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'), greater(e__session.`$session_duration`, 12.0))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1057,7 +1057,7 @@(SELECT count(DISTINCT e.`$session_id`) AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1094,7 +1094,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(e.`$session_id_uuid`, e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, '$autocapture'), less(e__session.`$session_duration`, 30.0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, '$autocapture'), less(e__session.`$session_duration`, 30.0))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1131,7 +1131,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(e.`$session_id_uuid`, e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'), greater(e__session.`$session_duration`, 500.0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'), greater(e__session.`$session_duration`, 500.0))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)diff --git a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_formula.new_events_schema.ambr b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_formula.new_events_schema.ambrindex 1862717b2a1b..7d122e382aff 100644--- a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_formula.new_events_schema.ambr+++ b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_formula.new_events_schema.ambr@@ -3,7 +3,7 @@'''SELECT ifNull(sum(accurateCastOrNull(e.properties.`session not here`, 'Float64')), 0) AS totalFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session error'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session error'))ORDER BY 1 DESCLIMIT 50000 SETTINGS readonly=2,max_execution_time=60,@@ -24,7 +24,7 @@'''SELECT ifNull(sum(accurateCastOrNull(e.properties.xyz, 'Float64')), 0) AS totalFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))ORDER BY 1 DESCLIMIT 50000 SETTINGS readonly=2,max_execution_time=60,@@ -61,7 +61,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^location)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^location)), if(isNull(nullIf(toString(e.properties.location), '')), NULL, if(and(in(ascii(toString(e.properties.location)), tuple(91, 123)), in(ascii(toJSONString(e.properties.location)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.location), '[]'), '{}'), toString(e.properties.location))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -108,7 +108,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^location)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^location)), if(isNull(nullIf(toString(e.properties.location), '')), NULL, if(and(in(ascii(toString(e.properties.location)), tuple(91, 123)), in(ascii(toJSONString(e.properties.location)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.location), '[]'), '{}'), toString(e.properties.location))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -151,7 +151,7 @@(SELECT ifNull(avg(accurateCastOrNull(e.properties.xyz, 'Float64')), 0) AS total,ifNull(nullIf(leftUTF8(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^location)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^location)), if(isNull(nullIf(toString(e.properties.location), '')), NULL, if(and(in(ascii(toString(e.properties.location)), tuple(91, 123)), in(ascii(toJSONString(e.properties.location)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.location), '[]'), '{}'), toString(e.properties.location))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY breakdown_value)GROUP BY breakdown_valueORDER BY breakdown_value ASC)@@ -192,7 +192,7 @@(SELECT ifNull(sum(accurateCastOrNull(e.properties.xyz, 'Float64')), 0) AS total,ifNull(nullIf(leftUTF8(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^location)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^location)), if(isNull(nullIf(toString(e.properties.location), '')), NULL, if(and(in(ascii(toString(e.properties.location)), tuple(91, 123)), in(ascii(toJSONString(e.properties.location)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.location), '[]'), '{}'), toString(e.properties.location))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY breakdown_value)GROUP BY breakdown_valueORDER BY breakdown_value ASC)@@ -237,7 +237,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,toString(0) AS breakdown_valueFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -291,10 +291,10 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.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)))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.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)))))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -348,10 +348,10 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.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)))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.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)))))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -398,7 +398,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,toString(0) AS breakdown_valueFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -445,7 +445,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(concat(ifNull(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$some_prop`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$some_prop`)), if(isNull(nullIf(toString(e.person_properties.`$some_prop`), '')), NULL, if(and(in(ascii(toString(e.person_properties.`$some_prop`)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.`$some_prop`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.`$some_prop`), '[]'), '{}'), toString(e.person_properties.`$some_prop`))))), ''), ' : ', ifNull(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^location)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^location)), if(isNull(nullIf(toString(e.properties.location), '')), NULL, if(and(in(ascii(toString(e.properties.location)), tuple(91, 123)), in(ascii(toJSONString(e.properties.location)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.location), '[]'), '{}'), toString(e.properties.location))))), ''))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -492,7 +492,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(concat(ifNull(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$some_prop`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$some_prop`)), if(isNull(nullIf(toString(e.person_properties.`$some_prop`), '')), NULL, if(and(in(ascii(toString(e.person_properties.`$some_prop`)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.`$some_prop`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.`$some_prop`), '[]'), '{}'), toString(e.person_properties.`$some_prop`))))), ''), ' : ', ifNull(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^location)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^location)), if(isNull(nullIf(toString(e.properties.location), '')), NULL, if(and(in(ascii(toString(e.properties.location)), tuple(91, 123)), in(ascii(toJSONString(e.properties.location)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.location), '[]'), '{}'), toString(e.properties.location))))), ''))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -539,7 +539,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^location)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^location)), if(isNull(nullIf(toString(e.properties.location), '')), NULL, if(and(in(ascii(toString(e.properties.location)), tuple(91, 123)), in(ascii(toJSONString(e.properties.location)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.location), '[]'), '{}'), toString(e.properties.location))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -586,7 +586,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^location)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^location)), if(isNull(nullIf(toString(e.properties.location), '')), NULL, if(and(in(ascii(toString(e.properties.location)), tuple(91, 123)), in(ascii(toJSONString(e.properties.location)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.location), '[]'), '{}'), toString(e.properties.location))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -633,7 +633,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^location)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^location)), if(isNull(nullIf(toString(e.properties.location), '')), NULL, if(and(in(ascii(toString(e.properties.location)), tuple(91, 123)), in(ascii(toJSONString(e.properties.location)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.location), '[]'), '{}'), toString(e.properties.location))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session end'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session end'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -680,7 +680,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^location)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^location)), if(isNull(nullIf(toString(e.properties.location), '')), NULL, if(and(in(ascii(toString(e.properties.location)), tuple(91, 123)), in(ascii(toJSONString(e.properties.location)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.location), '[]'), '{}'), toString(e.properties.location))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -711,7 +711,7 @@'''SELECT ifNull(sum(accurateCastOrNull(e.properties.xyz, 'Float64')), 0) AS totalFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))ORDER BY 1 DESCLIMIT 50000 SETTINGS readonly=2,max_execution_time=60,@@ -732,7 +732,7 @@'''SELECT ifNull(accurateCastOrNull(sum(accurateCastOrNull(e.properties.xyz, 'Float64')), 'Float64'), 0) AS totalFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'nonexistent_event_that_has_no_data'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'nonexistent_event_that_has_no_data'))ORDER BY 1 DESCLIMIT 50000 SETTINGS readonly=2,max_execution_time=60,@@ -768,7 +768,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -800,7 +800,7 @@(SELECT count(DISTINCT e.properties.`$session_id`) AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -960,7 +960,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session end'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session end'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1001,7 +1001,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(toUInt128(toUUIDOrNull(e.properties.`$session_id`)), e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start,e.properties.`$session_id`,day_start)@@ -1036,7 +1036,7 @@(SELECT count(DISTINCT e.properties.`$session_id`) AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1074,7 +1074,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(toUInt128(toUUIDOrNull(e.properties.`$session_id`)), e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'), greater(e__session.`$session_duration`, 12.0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'), greater(e__session.`$session_duration`, 12.0))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1112,7 +1112,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(toUInt128(toUUIDOrNull(e.properties.`$session_id`)), e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'), greater(e__session.`$session_duration`, 500.0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'), greater(e__session.`$session_duration`, 500.0))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1150,7 +1150,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(toUInt128(toUUIDOrNull(e.properties.`$session_id`)), e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, '$autocapture'), less(e__session.`$session_duration`, 30.0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, '$autocapture'), less(e__session.`$session_duration`, 30.0))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)diff --git a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_slope_graph_trends_query_runner.ambr b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_slope_graph_trends_query_runner.ambrindex ca1c43081a0b..8428ceabb020 100644--- a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_slope_graph_trends_query_runner.ambr+++ b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_slope_graph_trends_query_runner.ambr@@ -70,7 +70,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'plan'), ''), 'null'), '^"|"$', '')), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -108,7 +108,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -139,7 +139,7 @@(SELECT count() AS total,toStartOfMonth(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-03-31 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-01-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-02-01 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-03-01 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-03-31 23:59:59', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-03-31 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-01-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-02-01 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-03-01 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-03-31 23:59:59', 6, 'UTC')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -170,7 +170,7 @@(SELECT count() AS total,toStartOfHour(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-06-14 00:00:00', 'UTC')), toIntervalHour(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-06-14 04:30:00', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-14 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-14 01:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-14 04:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-14 04:30:00', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-06-14 00:00:00', 'UTC')), toIntervalHour(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-06-14 04:30:00', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-14 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-14 01:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-14 04:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-14 04:30:00', 6, 'UTC')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -201,7 +201,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), and(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'plan'), ''), 'null'), '^"|"$', ''), 'paid'), 0), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC'))))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), and(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'plan'), ''), 'null'), '^"|"$', ''), 'paid'), 0), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC'))))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -232,7 +232,7 @@(SELECT count() AS total,toStartOfMonth(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-04-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-06-15 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-04-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-01 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-15 23:59:59', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-04-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-06-15 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-04-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-01 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-15 23:59:59', 6, 'UTC')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -314,7 +314,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -345,7 +345,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'US/Pacific')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'US/Pacific')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'US/Pacific'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'US/Pacific')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'US/Pacific'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'US/Pacific')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'US/Pacific')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'US/Pacific')), toIntervalDay(1)), 6, 'US/Pacific')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'US/Pacific'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'US/Pacific')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'US/Pacific'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'US/Pacific')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'US/Pacific')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -376,7 +376,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), and(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'plan'), ''), 'null'), '^"|"$', ''), 'paid'), 0), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC'))))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), and(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'plan'), ''), 'null'), '^"|"$', ''), 'paid'), 0), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC'))))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -407,7 +407,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-06-08 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-06-15 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-08 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-09 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-15 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-15 23:59:59', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-06-08 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-06-15 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-08 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-09 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-15 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-15 23:59:59', 6, 'UTC')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -438,7 +438,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -469,7 +469,7 @@(SELECT count() AS total,toStartOfMonth(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-31 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-01 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-31 23:59:59', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-31 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-01 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-31 23:59:59', 6, 'UTC')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -500,7 +500,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -538,7 +538,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -569,7 +569,7 @@(SELECT count() AS total,toStartOfWeek(toTimeZone(e.timestamp, 'UTC'), 0) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-28 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-04-28 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-05 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-26 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-28 23:59:59', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-28 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-04-28 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-05 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-26 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-28 23:59:59', 6, 'UTC')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)diff --git a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_slope_graph_trends_query_runner.new_events_schema.ambr b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_slope_graph_trends_query_runner.new_events_schema.ambrindex 444df3a2da68..7e6c8e62dd54 100644--- a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_slope_graph_trends_query_runner.new_events_schema.ambr+++ b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_slope_graph_trends_query_runner.new_events_schema.ambr@@ -71,7 +71,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^plan)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^plan)), if(isNull(nullIf(toString(e.properties.plan), '')), NULL, if(and(in(ascii(toString(e.properties.plan)), tuple(91, 123)), in(ascii(toJSONString(e.properties.plan)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.plan), '[]'), '{}'), toString(e.properties.plan))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -110,7 +110,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -142,7 +142,7 @@(SELECT count() AS total,toStartOfMonth(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-03-31 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-01-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-02-01 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-03-01 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-03-31 23:59:59', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-03-31 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-01-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-02-01 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-03-01 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-03-31 23:59:59', 6, 'UTC')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -174,7 +174,7 @@(SELECT count() AS total,toStartOfHour(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-06-14 00:00:00', 'UTC')), toIntervalHour(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-06-14 04:30:00', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-14 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-14 01:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-14 04:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-14 04:30:00', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-06-14 00:00:00', 'UTC')), toIntervalHour(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-06-14 04:30:00', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-14 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-14 01:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-14 04:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-14 04:30:00', 6, 'UTC')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -206,7 +206,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^plan)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^plan)), if(isNull(nullIf(toString(e.properties.plan), '')), NULL, if(and(in(ascii(toString(e.properties.plan)), tuple(91, 123)), in(ascii(toJSONString(e.properties.plan)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.plan), '[]'), '{}'), toString(e.properties.plan)))), 'paid'), 0), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC'))))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^plan)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^plan)), if(isNull(nullIf(toString(e.properties.plan), '')), NULL, if(and(in(ascii(toString(e.properties.plan)), tuple(91, 123)), in(ascii(toJSONString(e.properties.plan)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.plan), '[]'), '{}'), toString(e.properties.plan)))), 'paid'), 0), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC'))))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -238,7 +238,7 @@(SELECT count() AS total,toStartOfMonth(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-04-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-06-15 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-04-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-01 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-15 23:59:59', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-04-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-06-15 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-04-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-01 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-15 23:59:59', 6, 'UTC')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -322,7 +322,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -354,7 +354,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'US/Pacific')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'US/Pacific')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'US/Pacific'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'US/Pacific')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'US/Pacific'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'US/Pacific')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'US/Pacific')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'US/Pacific')), toIntervalDay(1)), 6, 'US/Pacific')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'US/Pacific'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'US/Pacific')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'US/Pacific'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'US/Pacific')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'US/Pacific')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -386,7 +386,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^plan)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^plan)), if(isNull(nullIf(toString(e.properties.plan), '')), NULL, if(and(in(ascii(toString(e.properties.plan)), tuple(91, 123)), in(ascii(toJSONString(e.properties.plan)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.plan), '[]'), '{}'), toString(e.properties.plan)))), 'paid'), 0), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC'))))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^plan)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^plan)), if(isNull(nullIf(toString(e.properties.plan), '')), NULL, if(and(in(ascii(toString(e.properties.plan)), tuple(91, 123)), in(ascii(toJSONString(e.properties.plan)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.plan), '[]'), '{}'), toString(e.properties.plan)))), 'paid'), 0), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC'))))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -418,7 +418,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-06-08 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-06-15 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-08 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-09 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-15 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-15 23:59:59', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-06-08 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-06-15 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-08 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-09 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-15 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-15 23:59:59', 6, 'UTC')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -450,7 +450,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -482,7 +482,7 @@(SELECT count() AS total,toStartOfMonth(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-31 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-01 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-31 23:59:59', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-31 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-06-01 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-31 23:59:59', 6, 'UTC')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -514,7 +514,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -553,7 +553,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-10 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-01 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-02 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-10 23:59:59', 6, 'UTC')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -585,7 +585,7 @@(SELECT count() AS total,toStartOfWeek(toTimeZone(e.timestamp, 'UTC'), 0) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-28 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-04-28 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-05 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-26 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-28 23:59:59', 6, 'UTC')))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2024-05-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2024-05-28 23:59:59', 'UTC'))), equals(e.event, '$pageview'), or(and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-04-28 00:00:00', 6, 'UTC')), less(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-05 00:00:00', 6, 'UTC'))), and(greaterOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-26 00:00:00', 6, 'UTC')), lessOrEquals(e.timestamp, parseDateTime64BestEffortOrNull('2024-05-28 23:59:59', 6, 'UTC')))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)diff --git a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_trends.ambr b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_trends.ambrindex e98d91d5bed3..5e2f54641589 100644--- a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_trends.ambr+++ b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_trends.ambr@@ -38,10 +38,10 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-07 23:59:59', 'UTC'))), and(equals(e.event, 'sign up'), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.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, 2))))), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, '$bool_prop'), ''), 'null'), '^"|"$', ''), 'x'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-07 23:59:59', 'UTC'))), and(equals(e.event, 'sign up'), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.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, 2))))), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, '$bool_prop'), ''), 'null'), '^"|"$', ''), 'x'), 0))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -88,7 +88,7 @@WHERE and(equals(groups.team_id, 99999), equals(index, 0))GROUP BY groups.group_type_index,groups.group_key) AS e__group_0 ON equals(e.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -248,7 +248,7 @@WHERE and(equals(groups.team_id, 99999), equals(index, 0))GROUP BY groups.group_type_index,groups.group_key) AS e__group_0 ON equals(e.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, 'sign up'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, 'key'), ''), 'null'), '^"|"$', ''), 'value'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, 'sign up'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, 'key'), ''), 'null'), '^"|"$', ''), 'value'), 0))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -294,7 +294,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$current_url'), ''), 'null'), '^"|"$', '')), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-22 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'), or(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$os'), ''), 'null'), '^"|"$', ''), 'Windows'), 0)), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$os'), ''), 'null'), '^"|"$', ''), 'Mac'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-22 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'), or(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$os'), ''), 'null'), '^"|"$', ''), 'Windows'), 0)), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$os'), ''), 'null'), '^"|"$', ''), 'Mac'), 0))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -340,7 +340,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$current_url'), ''), 'null'), '^"|"$', '')), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-22 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'), and(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$os'), ''), 'null'), '^"|"$', ''), 'Windows'), 0)), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$os'), ''), 'null'), '^"|"$', ''), 'Mac'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-22 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'), and(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$os'), ''), 'null'), '^"|"$', ''), 'Windows'), 0)), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$os'), ''), 'null'), '^"|"$', ''), 'Mac'), 0))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -386,7 +386,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$current_url'), ''), 'null'), '^"|"$', '')), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value_1FROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-22 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'), or(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$os'), ''), 'null'), '^"|"$', ''), 'Windows'), 0)), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$os'), ''), 'null'), '^"|"$', ''), 'Mac'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-22 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'), or(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$os'), ''), 'null'), '^"|"$', ''), 'Windows'), 0)), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$os'), ''), 'null'), '^"|"$', ''), 'Mac'), 0))GROUP BY day_start,breakdown_value_1)GROUP BY day_start,@@ -432,7 +432,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$current_url'), ''), 'null'), '^"|"$', '')), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value_1FROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-22 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'), and(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$os'), ''), 'null'), '^"|"$', ''), 'Windows'), 0)), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$os'), ''), 'null'), '^"|"$', ''), 'Mac'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-22 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'), and(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$os'), ''), 'null'), '^"|"$', ''), 'Windows'), 0)), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$os'), ''), 'null'), '^"|"$', ''), 'Mac'), 0))GROUP BY day_start,breakdown_value_1)GROUP BY day_start,@@ -634,7 +634,7 @@WHERE and(equals(groups.team_id, 99999), equals(index, 0))GROUP BY groups.group_type_index,groups.group_key) AS e__group_0 ON equals(e.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, 'sign up'), ifNull(equals(e__group_0.properties___industry, 'finance'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, 'sign up'), ifNull(equals(e__group_0.properties___industry, 'finance'), 0))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -704,7 +704,7 @@WHERE and(equals(groups.team_id, 99999), equals(index, 0))GROUP BY groups.group_type_index,groups.group_key) AS e__group_0 ON equals(e.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, 'sign up'), ifNull(equals(e__group_0.properties___industry, 'finance'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, 'sign up'), ifNull(equals(e__group_0.properties___industry, 'finance'), 0))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -757,7 +757,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -810,7 +810,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -863,7 +863,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,breakdown_value_1)GROUP BY day_start,@@ -916,7 +916,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,breakdown_value_1)GROUP BY day_start,@@ -981,10 +981,10 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-26 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-02 23:59:59', 'UTC'))), equals(e.event, 'event_name'), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.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)))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-26 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-02 23:59:59', 'UTC'))), equals(e.event, 'event_name'), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.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)))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1031,7 +1031,7 @@WHERE and(equals(groups.team_id, 99999), equals(index, 0))GROUP BY groups.group_type_index,groups.group_key) AS e__group_0 ON equals(e.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, 'sign up'), and(ifNull(equals(e__group_0.properties___industry, 'finance'), 0), ifNull(equals(e__group_2.properties___name, 'six'), 0)))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, 'sign up'), and(ifNull(equals(e__group_0.properties___industry, 'finance'), 0), ifNull(equals(e__group_2.properties___name, 'six'), 0)))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1189,7 +1189,7 @@WHERE and(equals(groups.team_id, 99999), equals(index, 0))GROUP BY groups.group_type_index,groups.group_key) AS e__group_0 ON equals(e.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, '$pageview'), and(ifNull(equals(e__group_0.properties___industry, 'finance'), 0), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, 'key'), ''), 'null'), '^"|"$', ''), 'value'), 0)))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, '$pageview'), and(ifNull(equals(e__group_0.properties___industry, 'finance'), 0), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, 'key'), ''), 'null'), '^"|"$', ''), 'value'), 0)))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1358,7 +1358,7 @@(SELECT count() AS total,toStartOfWeek(toTimeZone(e.timestamp, 'US/Pacific'), 0) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2022-10-31 00:00:00', 'US/Pacific')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2022-11-30 23:59:59', 'US/Pacific'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2022-10-31 00:00:00', 'US/Pacific')), toIntervalDay(1)), 6, 'US/Pacific')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2022-11-30 23:59:59', 'US/Pacific'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1414,10 +1414,10 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), and(equals(e.event, 'sign up'), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.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))))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), and(equals(e.event, 'sign up'), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.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))))))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -1455,7 +1455,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'watched movie'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, 'name'), ''), 'null'), '^"|"$', ''), 'person1'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'watched movie'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, 'name'), ''), 'null'), '^"|"$', ''), 'person1'), 0))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1486,7 +1486,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'watched movie'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, 'name'), ''), 'null'), '^"|"$', ''), 'person1'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'watched movie'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, 'name'), ''), 'null'), '^"|"$', ''), 'person1'), 0))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1517,7 +1517,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'watched movie'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'name'), ''), 'null'), '^"|"$', ''), '1'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'watched movie'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'name'), ''), 'null'), '^"|"$', ''), '1'), 0))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1557,7 +1557,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-03 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-03 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-03 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-03 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1595,7 +1595,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-03 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-03 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-03 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-03 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1642,7 +1642,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-03 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-03 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-03 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-03 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1689,7 +1689,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-03 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-03 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-03 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-03 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1736,7 +1736,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-03 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-03 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-03 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-03 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1767,7 +1767,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-29 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-29 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1805,7 +1805,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-22 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-22 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1887,7 +1887,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-29 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-29 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1933,7 +1933,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-29 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-29 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -2040,7 +2040,7 @@(SELECT count() AS total,toStartOfWeek(toTimeZone(e.timestamp, 'UTC'), 0) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-26 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-26 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -2071,7 +2071,7 @@(SELECT count() AS total,toStartOfWeek(toTimeZone(e.timestamp, 'UTC'), 3) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-26 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-26 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -2110,7 +2110,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, 'email'), ''), 'null'), '^"|"$', '')), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-07-01 23:59:59', 'UTC'))), equals(e.event, 'sign up'), and(or(ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'key'), ''), 'null'), '^"|"$', ''), 'val'), 0)), or(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, '$os'), ''), 'null'), '^"|"$', ''), 'android'), 0), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, '$browser'), ''), 'null'), '^"|"$', ''), 'safari'), 0))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-07-01 23:59:59', 'UTC'))), equals(e.event, 'sign up'), and(or(ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'key'), ''), 'null'), '^"|"$', ''), 'val'), 0)), or(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, '$os'), ''), 'null'), '^"|"$', ''), 'android'), 0), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, '$browser'), ''), 'null'), '^"|"$', ''), 'safari'), 0))))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -2156,7 +2156,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, 'email'), ''), 'null'), '^"|"$', '')), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-07-01 23:59:59', 'UTC'))), equals(e.event, 'sign up'), and(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, '$os'), ''), 'null'), '^"|"$', ''), 'android'), 0), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, '$browser'), ''), 'null'), '^"|"$', ''), 'chrome'), 0)), and(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'key'), ''), 'null'), '^"|"$', ''), 'val'), 0), ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 0)))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-07-01 23:59:59', 'UTC'))), equals(e.event, 'sign up'), and(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, '$os'), ''), 'null'), '^"|"$', ''), 'android'), 0), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, '$browser'), ''), 'null'), '^"|"$', ''), 'chrome'), 0)), and(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'key'), ''), 'null'), '^"|"$', ''), 'val'), 0), ifNull(ilike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 0)))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -2194,7 +2194,7 @@(SELECT count(DISTINCT e.distinct_id) AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-24 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-31 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-24 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-31 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -2225,7 +2225,7 @@(SELECT count(DISTINCT e.distinct_id) AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-24 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-31 23:59:59', 'UTC'))), equals(e.event, 'sign up'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, '$some_prop'), ''), 'null'), '^"|"$', ''), 'some_val'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-24 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-31 23:59:59', 'UTC'))), equals(e.event, 'sign up'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, '$some_prop'), ''), 'null'), '^"|"$', ''), 'some_val'), 0))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -2264,7 +2264,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, '$some_prop'), ''), 'null'), '^"|"$', '')), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-24 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-31 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-24 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-31 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -2310,7 +2310,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, '$some_prop'), ''), 'null'), '^"|"$', '')), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value_1FROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-24 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-31 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-24 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-31 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,breakdown_value_1)GROUP BY day_start,@@ -2444,7 +2444,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$some_prop'), ''), 'null'), '^"|"$', '')), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-24 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-31 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-24 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-31 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -2482,7 +2482,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -2513,7 +2513,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -2564,7 +2564,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id),breakdown_value)GROUP BY day_start,@@ -2625,7 +2625,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id),breakdown_value)GROUP BY day_start,@@ -2677,7 +2677,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(e.`$session_id_uuid`, e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY e.`$session_id`,breakdown_value)GROUP BY breakdown_value)@@ -2728,7 +2728,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(e.`$session_id_uuid`, e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY e.`$session_id`,breakdown_value)GROUP BY breakdown_value)@@ -2779,7 +2779,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(e.`$session_id_uuid`, e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY e.`$session_id`,breakdown_value_1)GROUP BY breakdown_value_1)@@ -2830,7 +2830,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(e.`$session_id_uuid`, e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY e.`$session_id`,breakdown_value_1)GROUP BY breakdown_value_1)@@ -2868,7 +2868,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -2899,7 +2899,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-21 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-28 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-21 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-28 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -2930,7 +2930,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -2964,7 +2964,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), equals(e.event, 'viewed video'), greaterOrEquals(e.timestamp, minus(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(0))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-07 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), equals(e.event, 'viewed video'), greaterOrEquals(e.timestamp, toDateTime64(minus(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(0)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-07 23:59:59', 'UTC'))))GROUP BY if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id)))LIMIT 50000 SETTINGS readonly=2,max_execution_time=60,@@ -3009,7 +3009,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), equals(e.event, 'viewed video'), greaterOrEquals(e.timestamp, minus(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(0))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-07 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), equals(e.event, 'viewed video'), greaterOrEquals(e.timestamp, toDateTime64(minus(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(0)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-07 23:59:59', 'UTC'))))GROUP BY if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id),breakdown_value)GROUP BY breakdown_value))@@ -3060,7 +3060,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), equals(e.event, 'viewed video'), greaterOrEquals(e.timestamp, minus(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(0))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-07 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), equals(e.event, 'viewed video'), greaterOrEquals(e.timestamp, toDateTime64(minus(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(0)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-07 23:59:59', 'UTC'))))GROUP BY if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id),day_start)GROUP BY day_start))@@ -3093,7 +3093,7 @@(SELECT count(DISTINCT e.`$group_0`) AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-30 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-06 23:59:59', 'UTC'))), equals(e.event, 'viewed video'), notEquals(e.`$group_0`, ''))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-30 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-06 23:59:59', 'UTC'))), equals(e.event, 'viewed video'), notEquals(e.`$group_0`, ''))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -3128,7 +3128,7 @@(SELECT count(DISTINCT e.`$group_0`) AS total,min(toStartOfDay(toTimeZone(e.timestamp, 'UTC'))) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-30 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-06 23:59:59', 'UTC'))), equals(e.event, 'viewed video'), notEquals(e.`$group_0`, ''))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-30 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-06 23:59:59', 'UTC'))), equals(e.event, 'viewed video'), notEquals(e.`$group_0`, ''))GROUP BY e.`$group_0`)GROUP BY day_startORDER BY day_start ASC)@@ -3164,7 +3164,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -3207,7 +3207,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id))GROUP BY day_startORDER BY day_start ASC)@@ -3252,7 +3252,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(e.`$session_id_uuid`, e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY e.`$session_id`,breakdown_value)GROUP BY breakdown_value)@@ -3303,7 +3303,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(e.`$session_id_uuid`, e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY e.`$session_id`,breakdown_value_1)GROUP BY breakdown_value_1)@@ -3341,7 +3341,7 @@(SELECT ifNull(accurateCastOrNull(plus(avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'x'), ''), 'null'), '^"|"$', ''), 'Float64')), 1000), 'Float64'), 0) AS total,toStartOfWeek(toTimeZone(e.timestamp, 'UTC'), 0) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -3372,7 +3372,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(e.`$session_id_uuid`, e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY e.`$session_id`ORDER BY 1 DESC)LIMIT 50000 SETTINGS readonly=2,@@ -3401,7 +3401,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(e.`$session_id_uuid`, e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY e.`$session_id`ORDER BY 1 DESC)LIMIT 50000 SETTINGS readonly=2,@@ -3439,7 +3439,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(e.`$session_id_uuid`, e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,e.`$session_id`,day_start)@@ -3482,7 +3482,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(e.`$session_id_uuid`, e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,e.`$session_id`,day_start)@@ -3534,7 +3534,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(e.`$session_id_uuid`, e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,e.`$session_id`,breakdown_value,@@ -3594,7 +3594,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(e.`$session_id_uuid`, e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,e.`$session_id`,breakdown_value,@@ -3654,7 +3654,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(e.`$session_id_uuid`, e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,e.`$session_id`,breakdown_value_1,@@ -3714,7 +3714,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(e.`$session_id_uuid`, e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,e.`$session_id`,breakdown_value_1,@@ -4083,7 +4083,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-29 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-18 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-29 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-18 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)diff --git a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_trends.new_events_schema.ambr b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_trends.new_events_schema.ambrindex 26f9b65d78b4..6e97f0ba16b3 100644--- a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_trends.new_events_schema.ambr+++ b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_trends.new_events_schema.ambr@@ -18,10 +18,10 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-07 23:59:59', 'UTC'))), and(equals(e.event, 'sign up'), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.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, 2))))), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$bool_prop`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$bool_prop`)), if(isNull(nullIf(toString(e.person_properties.`$bool_prop`), '')), NULL, if(and(in(ascii(toString(e.person_properties.`$bool_prop`)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.`$bool_prop`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.`$bool_prop`), '[]'), '{}'), toString(e.person_properties.`$bool_prop`)))), 'x'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-07 23:59:59', 'UTC'))), and(equals(e.event, 'sign up'), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.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, 2))))), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$bool_prop`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$bool_prop`)), if(isNull(nullIf(toString(e.person_properties.`$bool_prop`), '')), NULL, if(and(in(ascii(toString(e.person_properties.`$bool_prop`)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.`$bool_prop`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.`$bool_prop`), '[]'), '{}'), toString(e.person_properties.`$bool_prop`)))), 'x'), 0))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -152,7 +152,7 @@WHERE and(equals(groups.team_id, 99999), equals(index, 0))GROUP BY groups.group_type_index,groups.group_key) AS e__group_0 ON equals(e.properties.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -207,7 +207,7 @@WHERE and(equals(groups.team_id, 99999), equals(index, 0))GROUP BY groups.group_type_index,groups.group_key) AS e__group_0 ON equals(e.properties.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, 'sign up'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^key)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^key)), if(isNull(nullIf(toString(e.person_properties.key), '')), NULL, if(and(in(ascii(toString(e.person_properties.key)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.key)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.key), '[]'), '{}'), toString(e.person_properties.key)))), 'value'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, 'sign up'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^key)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^key)), if(isNull(nullIf(toString(e.person_properties.key), '')), NULL, if(and(in(ascii(toString(e.person_properties.key)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.key)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.key), '[]'), '{}'), toString(e.person_properties.key)))), 'value'), 0))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -254,7 +254,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$current_url`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$current_url`)), if(isNull(nullIf(toString(e.properties.`$current_url`), '')), NULL, if(and(in(ascii(toString(e.properties.`$current_url`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$current_url`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$current_url`), '[]'), '{}'), toString(e.properties.`$current_url`))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-22 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), if(isNull(nullIf(toString(e.properties.`$browser`), '')), NULL, if(and(in(ascii(toString(e.properties.`$browser`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$browser`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$browser`), '[]'), '{}'), toString(e.properties.`$browser`)))), 'Firefox'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), if(isNull(nullIf(toString(e.properties.`$os`), '')), NULL, if(and(in(ascii(toString(e.properties.`$os`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$os`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$os`), '[]'), '{}'), toString(e.properties.`$os`)))), 'Windows'), 0)), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), if(isNull(nullIf(toString(e.properties.`$os`), '')), NULL, if(and(in(ascii(toString(e.properties.`$os`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$os`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$os`), '[]'), '{}'), toString(e.properties.`$os`)))), 'Mac'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-22 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), if(isNull(nullIf(toString(e.properties.`$browser`), '')), NULL, if(and(in(ascii(toString(e.properties.`$browser`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$browser`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$browser`), '[]'), '{}'), toString(e.properties.`$browser`)))), 'Firefox'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), if(isNull(nullIf(toString(e.properties.`$os`), '')), NULL, if(and(in(ascii(toString(e.properties.`$os`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$os`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$os`), '[]'), '{}'), toString(e.properties.`$os`)))), 'Windows'), 0)), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), if(isNull(nullIf(toString(e.properties.`$os`), '')), NULL, if(and(in(ascii(toString(e.properties.`$os`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$os`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$os`), '[]'), '{}'), toString(e.properties.`$os`)))), 'Mac'), 0))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -301,7 +301,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$current_url`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$current_url`)), if(isNull(nullIf(toString(e.properties.`$current_url`), '')), NULL, if(and(in(ascii(toString(e.properties.`$current_url`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$current_url`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$current_url`), '[]'), '{}'), toString(e.properties.`$current_url`))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value_1FROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-22 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'), or(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), if(isNull(nullIf(toString(e.properties.`$browser`), '')), NULL, if(and(in(ascii(toString(e.properties.`$browser`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$browser`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$browser`), '[]'), '{}'), toString(e.properties.`$browser`)))), 'Firefox'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), if(isNull(nullIf(toString(e.properties.`$os`), '')), NULL, if(and(in(ascii(toString(e.properties.`$os`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$os`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$os`), '[]'), '{}'), toString(e.properties.`$os`)))), 'Windows'), 0)), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), if(isNull(nullIf(toString(e.properties.`$os`), '')), NULL, if(and(in(ascii(toString(e.properties.`$os`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$os`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$os`), '[]'), '{}'), toString(e.properties.`$os`)))), 'Mac'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-22 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'), or(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), if(isNull(nullIf(toString(e.properties.`$browser`), '')), NULL, if(and(in(ascii(toString(e.properties.`$browser`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$browser`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$browser`), '[]'), '{}'), toString(e.properties.`$browser`)))), 'Firefox'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), if(isNull(nullIf(toString(e.properties.`$os`), '')), NULL, if(and(in(ascii(toString(e.properties.`$os`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$os`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$os`), '[]'), '{}'), toString(e.properties.`$os`)))), 'Windows'), 0)), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), if(isNull(nullIf(toString(e.properties.`$os`), '')), NULL, if(and(in(ascii(toString(e.properties.`$os`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$os`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$os`), '[]'), '{}'), toString(e.properties.`$os`)))), 'Mac'), 0))GROUP BY day_start,breakdown_value_1)GROUP BY day_start,@@ -348,7 +348,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$current_url`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$current_url`)), if(isNull(nullIf(toString(e.properties.`$current_url`), '')), NULL, if(and(in(ascii(toString(e.properties.`$current_url`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$current_url`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$current_url`), '[]'), '{}'), toString(e.properties.`$current_url`))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value_1FROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-22 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), if(isNull(nullIf(toString(e.properties.`$browser`), '')), NULL, if(and(in(ascii(toString(e.properties.`$browser`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$browser`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$browser`), '[]'), '{}'), toString(e.properties.`$browser`)))), 'Firefox'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), if(isNull(nullIf(toString(e.properties.`$os`), '')), NULL, if(and(in(ascii(toString(e.properties.`$os`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$os`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$os`), '[]'), '{}'), toString(e.properties.`$os`)))), 'Windows'), 0)), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), if(isNull(nullIf(toString(e.properties.`$os`), '')), NULL, if(and(in(ascii(toString(e.properties.`$os`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$os`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$os`), '[]'), '{}'), toString(e.properties.`$os`)))), 'Mac'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-22 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), if(isNull(nullIf(toString(e.properties.`$browser`), '')), NULL, if(and(in(ascii(toString(e.properties.`$browser`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$browser`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$browser`), '[]'), '{}'), toString(e.properties.`$browser`)))), 'Firefox'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), if(isNull(nullIf(toString(e.properties.`$os`), '')), NULL, if(and(in(ascii(toString(e.properties.`$os`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$os`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$os`), '[]'), '{}'), toString(e.properties.`$os`)))), 'Windows'), 0)), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), if(isNull(nullIf(toString(e.properties.`$os`), '')), NULL, if(and(in(ascii(toString(e.properties.`$os`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$os`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$os`), '[]'), '{}'), toString(e.properties.`$os`)))), 'Mac'), 0))GROUP BY day_start,breakdown_value_1)GROUP BY day_start,@@ -395,7 +395,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$current_url`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$current_url`)), if(isNull(nullIf(toString(e.properties.`$current_url`), '')), NULL, if(and(in(ascii(toString(e.properties.`$current_url`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$current_url`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$current_url`), '[]'), '{}'), toString(e.properties.`$current_url`))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-22 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'), or(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), if(isNull(nullIf(toString(e.properties.`$browser`), '')), NULL, if(and(in(ascii(toString(e.properties.`$browser`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$browser`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$browser`), '[]'), '{}'), toString(e.properties.`$browser`)))), 'Firefox'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), if(isNull(nullIf(toString(e.properties.`$os`), '')), NULL, if(and(in(ascii(toString(e.properties.`$os`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$os`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$os`), '[]'), '{}'), toString(e.properties.`$os`)))), 'Windows'), 0)), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), if(isNull(nullIf(toString(e.properties.`$os`), '')), NULL, if(and(in(ascii(toString(e.properties.`$os`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$os`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$os`), '[]'), '{}'), toString(e.properties.`$os`)))), 'Mac'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-22 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'), or(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$browser`)), if(isNull(nullIf(toString(e.properties.`$browser`), '')), NULL, if(and(in(ascii(toString(e.properties.`$browser`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$browser`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$browser`), '[]'), '{}'), toString(e.properties.`$browser`)))), 'Firefox'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), if(isNull(nullIf(toString(e.properties.`$os`), '')), NULL, if(and(in(ascii(toString(e.properties.`$os`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$os`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$os`), '[]'), '{}'), toString(e.properties.`$os`)))), 'Windows'), 0)), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$os`)), if(isNull(nullIf(toString(e.properties.`$os`), '')), NULL, if(and(in(ascii(toString(e.properties.`$os`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$os`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$os`), '[]'), '{}'), toString(e.properties.`$os`)))), 'Mac'), 0))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -590,7 +590,7 @@WHERE and(equals(groups.team_id, 99999), equals(index, 0))GROUP BY groups.group_type_index,groups.group_key) AS e__group_0 ON equals(e.properties.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, 'sign up'), ifNull(equals(e__group_0.properties___industry, 'finance'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, 'sign up'), ifNull(equals(e__group_0.properties___industry, 'finance'), 0))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -652,7 +652,7 @@WHERE and(equals(groups.team_id, 99999), equals(index, 0))GROUP BY groups.group_type_index,groups.group_key) AS e__group_0 ON equals(e.properties.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, 'sign up'), ifNull(equals(e__group_0.properties___industry, 'finance'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, 'sign up'), ifNull(equals(e__group_0.properties___industry, 'finance'), 0))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -706,7 +706,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -760,7 +760,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,breakdown_value_1)GROUP BY day_start,@@ -814,7 +814,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,breakdown_value_1)GROUP BY day_start,@@ -868,7 +868,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -914,10 +914,10 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-26 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-02 23:59:59', 'UTC'))), equals(e.event, 'event_name'), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.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)))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-26 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-02 23:59:59', 'UTC'))), equals(e.event, 'event_name'), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.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)))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1061,7 +1061,7 @@WHERE and(equals(groups.team_id, 99999), equals(index, 0))GROUP BY groups.group_type_index,groups.group_key) AS e__group_0 ON equals(e.properties.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, 'sign up'), and(ifNull(equals(e__group_0.properties___industry, 'finance'), 0), ifNull(equals(e__group_2.properties___name, 'six'), 0)))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, 'sign up'), and(ifNull(equals(e__group_0.properties___industry, 'finance'), 0), ifNull(equals(e__group_2.properties___name, 'six'), 0)))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1101,7 +1101,7 @@WHERE and(equals(groups.team_id, 99999), equals(index, 0))GROUP BY groups.group_type_index,groups.group_key) AS e__group_0 ON equals(e.properties.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, '$pageview'), and(ifNull(equals(e__group_0.properties___industry, 'finance'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^key)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^key)), if(isNull(nullIf(toString(e.person_properties.key), '')), NULL, if(and(in(ascii(toString(e.person_properties.key)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.key)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.key), '[]'), '{}'), toString(e.person_properties.key)))), 'value'), 0)))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-12 23:59:59', 'UTC'))), equals(e.event, '$pageview'), and(ifNull(equals(e__group_0.properties___industry, 'finance'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^key)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^key)), if(isNull(nullIf(toString(e.person_properties.key), '')), NULL, if(and(in(ascii(toString(e.person_properties.key)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.key)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.key), '[]'), '{}'), toString(e.person_properties.key)))), 'value'), 0)))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1273,7 +1273,7 @@(SELECT count() AS total,toStartOfWeek(toTimeZone(e.timestamp, 'US/Pacific'), 0) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2022-10-31 00:00:00', 'US/Pacific')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2022-11-30 23:59:59', 'US/Pacific'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2022-10-31 00:00:00', 'US/Pacific')), toIntervalDay(1)), 6, 'US/Pacific')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2022-11-30 23:59:59', 'US/Pacific'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1320,10 +1320,10 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), and(equals(e.event, 'sign up'), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.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))))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), and(equals(e.event, 'sign up'), in(if(not(empty(e__override.distinct_id)), e__override.person_id, e.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))))))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -1362,7 +1362,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'watched movie'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^name)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^name)), if(isNull(nullIf(toString(e.person_properties.name), '')), NULL, if(and(in(ascii(toString(e.person_properties.name)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.name)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.name), '[]'), '{}'), toString(e.person_properties.name)))), 'person1'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'watched movie'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^name)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^name)), if(isNull(nullIf(toString(e.person_properties.name), '')), NULL, if(and(in(ascii(toString(e.person_properties.name)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.name)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.name), '[]'), '{}'), toString(e.person_properties.name)))), 'person1'), 0))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1394,7 +1394,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'watched movie'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^name)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^name)), if(isNull(nullIf(toString(e.properties.name), '')), NULL, if(and(in(ascii(toString(e.properties.name)), tuple(91, 123)), in(ascii(toJSONString(e.properties.name)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.name), '[]'), '{}'), toString(e.properties.name)))), '1'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'watched movie'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^name)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^name)), if(isNull(nullIf(toString(e.properties.name), '')), NULL, if(and(in(ascii(toString(e.properties.name)), tuple(91, 123)), in(ascii(toJSONString(e.properties.name)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.name), '[]'), '{}'), toString(e.properties.name)))), '1'), 0))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1426,7 +1426,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'watched movie'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^name)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^name)), if(isNull(nullIf(toString(e.person_properties.name), '')), NULL, if(and(in(ascii(toString(e.person_properties.name)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.name)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.name), '[]'), '{}'), toString(e.person_properties.name)))), 'person1'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'watched movie'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^name)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^name)), if(isNull(nullIf(toString(e.person_properties.name), '')), NULL, if(and(in(ascii(toString(e.person_properties.name)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.name)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.name), '[]'), '{}'), toString(e.person_properties.name)))), 'person1'), 0))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1465,7 +1465,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-03 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-03 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-03 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-03 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1497,7 +1497,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-03 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-03 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-03 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-03 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1536,7 +1536,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-03 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-03 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-03 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-03 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1575,7 +1575,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-03 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-03 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-03 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-03 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1614,7 +1614,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-03 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-03 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-03 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-03 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1653,7 +1653,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-22 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-22 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1737,7 +1737,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-29 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-29 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1784,7 +1784,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-29 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-29 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -1823,7 +1823,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-29 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-29 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-05 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1926,7 +1926,7 @@(SELECT count() AS total,toStartOfWeek(toTimeZone(e.timestamp, 'UTC'), 3) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-26 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-26 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1958,7 +1958,7 @@(SELECT count() AS total,toStartOfWeek(toTimeZone(e.timestamp, 'UTC'), 0) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-26 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-12 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-26 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -1998,7 +1998,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^email)), if(isNull(nullIf(toString(e.person_properties.email), '')), NULL, if(and(in(ascii(toString(e.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.email), '[]'), '{}'), toString(e.person_properties.email))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-07-01 23:59:59', 'UTC'))), equals(e.event, 'sign up'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$os`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$os`)), if(isNull(nullIf(toString(e.person_properties.`$os`), '')), NULL, if(and(in(ascii(toString(e.person_properties.`$os`)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.`$os`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.`$os`), '[]'), '{}'), toString(e.person_properties.`$os`)))), 'android'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$browser`)), if(isNull(nullIf(toString(e.person_properties.`$browser`), '')), NULL, if(and(in(ascii(toString(e.person_properties.`$browser`)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.`$browser`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.`$browser`), '[]'), '{}'), toString(e.person_properties.`$browser`)))), 'chrome'), 0)), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^key)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^key)), if(isNull(nullIf(toString(e.properties.key), '')), NULL, if(and(in(ascii(toString(e.properties.key)), tuple(91, 123)), in(ascii(toJSONString(e.properties.key)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.key), '[]'), '{}'), toString(e.properties.key)))), 'val'), 0), ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^email)), if(isNull(nullIf(toString(e.person_properties.email), '')), NULL, if(and(in(ascii(toString(e.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.email), '[]'), '{}'), toString(e.person_properties.email))))), '%@posthog.com%'), 0)))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-07-01 23:59:59', 'UTC'))), equals(e.event, 'sign up'), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$os`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$os`)), if(isNull(nullIf(toString(e.person_properties.`$os`), '')), NULL, if(and(in(ascii(toString(e.person_properties.`$os`)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.`$os`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.`$os`), '[]'), '{}'), toString(e.person_properties.`$os`)))), 'android'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$browser`)), if(isNull(nullIf(toString(e.person_properties.`$browser`), '')), NULL, if(and(in(ascii(toString(e.person_properties.`$browser`)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.`$browser`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.`$browser`), '[]'), '{}'), toString(e.person_properties.`$browser`)))), 'chrome'), 0)), and(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^key)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^key)), if(isNull(nullIf(toString(e.properties.key), '')), NULL, if(and(in(ascii(toString(e.properties.key)), tuple(91, 123)), in(ascii(toJSONString(e.properties.key)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.key), '[]'), '{}'), toString(e.properties.key)))), 'val'), 0), ifNull(ilike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^email)), if(isNull(nullIf(toString(e.person_properties.email), '')), NULL, if(and(in(ascii(toString(e.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.email), '[]'), '{}'), toString(e.person_properties.email))))), '%@posthog.com%'), 0)))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -2045,7 +2045,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^email)), if(isNull(nullIf(toString(e.person_properties.email), '')), NULL, if(and(in(ascii(toString(e.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.email), '[]'), '{}'), toString(e.person_properties.email))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-07-01 23:59:59', 'UTC'))), equals(e.event, 'sign up'), and(or(ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^email)), if(isNull(nullIf(toString(e.person_properties.email), '')), NULL, if(and(in(ascii(toString(e.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.email), '[]'), '{}'), toString(e.person_properties.email))))), '%@posthog.com%'), 1), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^key)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^key)), if(isNull(nullIf(toString(e.properties.key), '')), NULL, if(and(in(ascii(toString(e.properties.key)), tuple(91, 123)), in(ascii(toJSONString(e.properties.key)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.key), '[]'), '{}'), toString(e.properties.key)))), 'val'), 0)), or(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$os`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$os`)), if(isNull(nullIf(toString(e.person_properties.`$os`), '')), NULL, if(and(in(ascii(toString(e.person_properties.`$os`)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.`$os`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.`$os`), '[]'), '{}'), toString(e.person_properties.`$os`)))), 'android'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$browser`)), if(isNull(nullIf(toString(e.person_properties.`$browser`), '')), NULL, if(and(in(ascii(toString(e.person_properties.`$browser`)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.`$browser`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.`$browser`), '[]'), '{}'), toString(e.person_properties.`$browser`)))), 'safari'), 0))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-07-01 23:59:59', 'UTC'))), equals(e.event, 'sign up'), and(or(ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^email)), if(isNull(nullIf(toString(e.person_properties.email), '')), NULL, if(and(in(ascii(toString(e.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.email), '[]'), '{}'), toString(e.person_properties.email))))), '%@posthog.com%'), 1), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^key)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^key)), if(isNull(nullIf(toString(e.properties.key), '')), NULL, if(and(in(ascii(toString(e.properties.key)), tuple(91, 123)), in(ascii(toJSONString(e.properties.key)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.key), '[]'), '{}'), toString(e.properties.key)))), 'val'), 0)), or(ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$os`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$os`)), if(isNull(nullIf(toString(e.person_properties.`$os`), '')), NULL, if(and(in(ascii(toString(e.person_properties.`$os`)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.`$os`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.`$os`), '[]'), '{}'), toString(e.person_properties.`$os`)))), 'android'), 0), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$browser`)), if(isNull(nullIf(toString(e.person_properties.`$browser`), '')), NULL, if(and(in(ascii(toString(e.person_properties.`$browser`)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.`$browser`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.`$browser`), '[]'), '{}'), toString(e.person_properties.`$browser`)))), 'safari'), 0))))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -2084,7 +2084,7 @@(SELECT count(DISTINCT e.distinct_id) AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-24 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-31 23:59:59', 'UTC'))), equals(e.event, 'sign up'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$some_prop`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$some_prop`)), if(isNull(nullIf(toString(e.person_properties.`$some_prop`), '')), NULL, if(and(in(ascii(toString(e.person_properties.`$some_prop`)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.`$some_prop`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.`$some_prop`), '[]'), '{}'), toString(e.person_properties.`$some_prop`)))), 'some_val'), 0))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-24 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-31 23:59:59', 'UTC'))), equals(e.event, 'sign up'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$some_prop`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$some_prop`)), if(isNull(nullIf(toString(e.person_properties.`$some_prop`), '')), NULL, if(and(in(ascii(toString(e.person_properties.`$some_prop`)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.`$some_prop`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.`$some_prop`), '[]'), '{}'), toString(e.person_properties.`$some_prop`)))), 'some_val'), 0))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -2124,7 +2124,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$some_prop`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$some_prop`)), if(isNull(nullIf(toString(e.person_properties.`$some_prop`), '')), NULL, if(and(in(ascii(toString(e.person_properties.`$some_prop`)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.`$some_prop`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.`$some_prop`), '[]'), '{}'), toString(e.person_properties.`$some_prop`))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-24 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-31 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-24 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-31 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -2171,7 +2171,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$some_prop`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^`$some_prop`)), if(isNull(nullIf(toString(e.person_properties.`$some_prop`), '')), NULL, if(and(in(ascii(toString(e.person_properties.`$some_prop`)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.`$some_prop`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.`$some_prop`), '[]'), '{}'), toString(e.person_properties.`$some_prop`))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value_1FROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-24 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-31 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-24 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-31 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,breakdown_value_1)GROUP BY day_start,@@ -2308,7 +2308,7 @@toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,ifNull(nullIf(leftUTF8(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$some_prop`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^`$some_prop`)), if(isNull(nullIf(toString(e.properties.`$some_prop`), '')), NULL, if(and(in(ascii(toString(e.properties.`$some_prop`)), tuple(91, 123)), in(ascii(toJSONString(e.properties.`$some_prop`)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.properties.`$some_prop`), '[]'), '{}'), toString(e.properties.`$some_prop`))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_valueFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-24 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-31 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-24 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-31 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,breakdown_value)GROUP BY day_start,@@ -2347,7 +2347,7 @@(SELECT count(DISTINCT e.distinct_id) AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-24 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-31 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-24 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-31 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -2379,7 +2379,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -2411,7 +2411,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -2463,7 +2463,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id),breakdown_value)GROUP BY day_start,@@ -2525,7 +2525,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id),breakdown_value)GROUP BY day_start,@@ -2578,7 +2578,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(toUInt128(toUUIDOrNull(e.properties.`$session_id`)), e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY e.properties.`$session_id`,breakdown_value)GROUP BY breakdown_value)@@ -2630,7 +2630,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(toUInt128(toUUIDOrNull(e.properties.`$session_id`)), e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY e.properties.`$session_id`,breakdown_value_1)GROUP BY breakdown_value_1)@@ -2682,7 +2682,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(toUInt128(toUUIDOrNull(e.properties.`$session_id`)), e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY e.properties.`$session_id`,breakdown_value_1)GROUP BY breakdown_value_1)@@ -2734,7 +2734,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(toUInt128(toUUIDOrNull(e.properties.`$session_id`)), e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY e.properties.`$session_id`,breakdown_value)GROUP BY breakdown_value)@@ -2773,7 +2773,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-21 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-28 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-21 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2019-12-28 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -2805,7 +2805,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -2837,7 +2837,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -2872,7 +2872,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), equals(e.event, 'viewed video'), greaterOrEquals(e.timestamp, minus(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(0))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-07 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), equals(e.event, 'viewed video'), greaterOrEquals(e.timestamp, toDateTime64(minus(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(0)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-07 23:59:59', 'UTC'))))GROUP BY if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id)))LIMIT 50000 SETTINGS readonly=2,max_execution_time=60,@@ -2918,7 +2918,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), equals(e.event, 'viewed video'), greaterOrEquals(e.timestamp, minus(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(0))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-07 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), equals(e.event, 'viewed video'), greaterOrEquals(e.timestamp, toDateTime64(minus(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(0)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-07 23:59:59', 'UTC'))))GROUP BY if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id),breakdown_value)GROUP BY breakdown_value))@@ -2970,7 +2970,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), equals(e.event, 'viewed video'), greaterOrEquals(e.timestamp, minus(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(0))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-07 23:59:59', 'UTC'))))+ WHERE and(equals(e.team_id, 99999), equals(e.event, 'viewed video'), greaterOrEquals(e.timestamp, toDateTime64(minus(assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')), toIntervalDay(0)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-07 23:59:59', 'UTC'))))GROUP BY if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id),day_start)GROUP BY day_start))@@ -3004,7 +3004,7 @@(SELECT count(DISTINCT e.properties.`$group_0`) AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-30 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-06 23:59:59', 'UTC'))), equals(e.event, 'viewed video'), notEquals(e.properties.`$group_0`, ''))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-30 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-06 23:59:59', 'UTC'))), equals(e.event, 'viewed video'), notEquals(e.properties.`$group_0`, ''))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -3040,7 +3040,7 @@(SELECT count(DISTINCT e.properties.`$group_0`) AS total,min(toStartOfDay(toTimeZone(e.timestamp, 'UTC'))) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-30 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-06 23:59:59', 'UTC'))), equals(e.event, 'viewed video'), notEquals(e.properties.`$group_0`, ''))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-30 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-06 23:59:59', 'UTC'))), equals(e.event, 'viewed video'), notEquals(e.properties.`$group_0`, ''))GROUP BY e.properties.`$group_0`)GROUP BY day_startORDER BY day_start ASC)@@ -3077,7 +3077,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -3121,7 +3121,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id))GROUP BY day_startORDER BY day_start ASC)@@ -3167,7 +3167,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(toUInt128(toUUIDOrNull(e.properties.`$session_id`)), e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY e.properties.`$session_id`,breakdown_value_1)GROUP BY breakdown_value_1)@@ -3219,7 +3219,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(toUInt128(toUUIDOrNull(e.properties.`$session_id`)), e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY e.properties.`$session_id`,breakdown_value)GROUP BY breakdown_value)@@ -3258,7 +3258,7 @@(SELECT ifNull(accurateCastOrNull(plus(avg(accurateCastOrNull(e.properties.x, 'Float64')), 1000), 'Float64'), 0) AS total,toStartOfWeek(toTimeZone(e.timestamp, 'UTC'), 0) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -3290,7 +3290,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(toUInt128(toUUIDOrNull(e.properties.`$session_id`)), e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY e.properties.`$session_id`ORDER BY 1 DESC)LIMIT 50000 SETTINGS readonly=2,@@ -3320,7 +3320,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(toUInt128(toUUIDOrNull(e.properties.`$session_id`)), e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY e.properties.`$session_id`ORDER BY 1 DESC)LIMIT 50000 SETTINGS readonly=2,@@ -3359,7 +3359,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(toUInt128(toUUIDOrNull(e.properties.`$session_id`)), e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,e.properties.`$session_id`,day_start)@@ -3403,7 +3403,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(toUInt128(toUUIDOrNull(e.properties.`$session_id`)), e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,e.properties.`$session_id`,day_start)@@ -3456,7 +3456,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(toUInt128(toUUIDOrNull(e.properties.`$session_id`)), e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,e.properties.`$session_id`,breakdown_value,@@ -3517,7 +3517,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(toUInt128(toUUIDOrNull(e.properties.`$session_id`)), e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,e.properties.`$session_id`,breakdown_value_1,@@ -3578,7 +3578,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(toUInt128(toUUIDOrNull(e.properties.`$session_id`)), e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,e.properties.`$session_id`,breakdown_value_1,@@ -3639,7 +3639,7 @@FROM raw_sessionsWHERE and(equals(raw_sessions.team_id, 99999), greaterOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), minus(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), toIntervalDay(3))), lessOrEquals(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), plus(assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC')), toIntervalDay(3))))GROUP BY raw_sessions.session_id_v7) AS e__session ON equals(toUInt128(toUUIDOrNull(e.properties.`$session_id`)), e__session.session_id_v7)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-28 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'sign up'))GROUP BY day_start,e.properties.`$session_id`,breakdown_value,@@ -4016,7 +4016,7 @@WHERE equals(person_distinct_id_overrides.team_id, 99999)GROUP BY person_distinct_id_overrides.distinct_idHAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2019-12-29 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-18 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2019-12-29 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-18 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)diff --git a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_trends_data_warehouse_query.ambr b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_trends_data_warehouse_query.ambrindex b4f77b6a05b8..a2311a8d6ce8 100644--- a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_trends_data_warehouse_query.ambr+++ b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_trends_data_warehouse_query.ambr@@ -441,7 +441,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2022-12-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-01-07 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2022-12-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-01-07 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -496,7 +496,7 @@(SELECT posthog_test_test_table_1.id AS id,posthog_test_test_table_1.prop_1 AS e__posthog_test_test_table_1___prop_1FROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.hogql.datawarehouse.trendquery/posthog_test_test_table_1/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `prop_1` String, `prop_2` String, `created` DateTime64(3, \'UTC\')') AS posthog_test_test_table_1) AS e__posthog_test_test_table_1 ON equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, 'email'), ''), 'null'), '^"|"$', ''), e__posthog_test_test_table_1.e__posthog_test_test_table_1___prop_1)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2022-12-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-01-07 23:59:59', 'UTC'))), equals(e.event, '$pageview'), equals(e__posthog_test_test_table_1.id, 'false'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2022-12-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-01-07 23:59:59', 'UTC'))), equals(e.event, '$pageview'), equals(e__posthog_test_test_table_1.id, 'false'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)diff --git a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_trends_data_warehouse_query.new_events_schema.ambr b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_trends_data_warehouse_query.new_events_schema.ambrindex d294e13cc0ad..a87cde2435e3 100644--- a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_trends_data_warehouse_query.new_events_schema.ambr+++ b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_trends_data_warehouse_query.new_events_schema.ambr@@ -11,7 +11,7 @@(SELECT count() AS total,toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_startFROM events_json AS e- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2022-12-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-01-07 23:59:59', 'UTC'))), equals(e.event, '$pageview'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2022-12-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-01-07 23:59:59', 'UTC'))), equals(e.event, '$pageview'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)@@ -68,7 +68,7 @@(SELECT posthog_test_test_table_1.id AS id,posthog_test_test_table_1.prop_1 AS e__posthog_test_test_table_1___prop_1FROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.hogql.datawarehouse.trendquery/posthog_test_test_table_1/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `prop_1` String, `prop_2` String, `created` DateTime64(3, \'UTC\')') AS posthog_test_test_table_1) AS e__posthog_test_test_table_1 ON equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^email)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.person_properties.^email)), if(isNull(nullIf(toString(e.person_properties.email), '')), NULL, if(and(in(ascii(toString(e.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.email), '[]'), '{}'), toString(e.person_properties.email)))), e__posthog_test_test_table_1.e__posthog_test_test_table_1___prop_1)- WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toStartOfInterval(assumeNotNull(toDateTime('2022-12-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-01-07 23:59:59', 'UTC'))), equals(e.event, '$pageview'), equals(e__posthog_test_test_table_1.id, 'false'))+ WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2022-12-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-01-07 23:59:59', 'UTC'))), equals(e.event, '$pageview'), equals(e__posthog_test_test_table_1.id, 'false'))GROUP BY day_start)GROUP BY day_startORDER BY day_start ASC)diff --git a/products/web_analytics/backend/test/__snapshots__/test_heatmaps_api.ambr b/products/web_analytics/backend/test/__snapshots__/test_heatmaps_api.ambrindex 44b17a4d6818..7915b8e7313f 100644--- a/products/web_analytics/backend/test/__snapshots__/test_heatmaps_api.ambr+++ b/products/web_analytics/backend/test/__snapshots__/test_heatmaps_api.ambr@@ -12,9 +12,9 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), equals(trim(TRAILING '/'- FROM heatmaps.current_url), trim(TRAILING '/'- FROM 'http://example.com')), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), equals(trim(TRAILING '/'+ FROM heatmaps.current_url), trim(TRAILING '/'+ FROM 'http://example.com')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -41,9 +41,9 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), equals(trim(TRAILING '/'- FROM heatmaps.current_url), trim(TRAILING '/'- FROM 'http://example.com')), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), equals(trim(TRAILING '/'+ FROM heatmaps.current_url), trim(TRAILING '/'+ FROM 'http://example.com')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -71,9 +71,9 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), equals(trim(TRAILING '/'- FROM heatmaps.current_url), trim(TRAILING '/'- FROM 'http://example.com/about')), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), equals(trim(TRAILING '/'+ FROM heatmaps.current_url), trim(TRAILING '/'+ FROM 'http://example.com/about')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -100,9 +100,9 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), equals(trim(TRAILING '/'- FROM heatmaps.current_url), trim(TRAILING '/'- FROM 'http://example.com/about')), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), equals(trim(TRAILING '/'+ FROM heatmaps.current_url), trim(TRAILING '/'+ FROM 'http://example.com/about')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -130,10 +130,10 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.`$session_id` AS `$session_id`- FROM events- WHERE and(equals(events.team_id, 99999), notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('today', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-08 00:00:00.000000', 6, 'UTC')), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$host'), ''), 'null'), '^"|"$', '')), '%127.0.0.1%'), 1)))))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.`$session_id` AS `$session_id`+ FROM events+ WHERE and(equals(events.team_id, 99999), notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('today', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-08 00:00:00.000000', 6, 'UTC')), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$host'), ''), 'null'), '^"|"$', '')), '%127.0.0.1%'), 1)))))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -160,10 +160,10 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.`$session_id` AS `$session_id`- FROM events- WHERE and(equals(events.team_id, 99999), notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('today', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-08 00:00:00.000000', 6, 'UTC')), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$host'), ''), 'null'), '^"|"$', '')), '%127.0.0.1%'), 1))))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.`$session_id` AS `$session_id`+ FROM events+ WHERE and(equals(events.team_id, 99999), notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('today', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-08 00:00:00.000000', 6, 'UTC')), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$host'), ''), 'null'), '^"|"$', '')), '%127.0.0.1%'), 1))))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -191,7 +191,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -218,7 +218,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -246,7 +246,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -273,7 +273,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -301,7 +301,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http\\:\\/\\/example\\.com\\/?(\\?.*)?(#.*)?$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http\\:\\/\\/example\\.com\\/?(\\?.*)?(#.*)?$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -328,7 +328,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http\\:\\/\\/example\\.com\\/?(\\?.*)?(#.*)?$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http\\:\\/\\/example\\.com\\/?(\\?.*)?(#.*)?$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -356,7 +356,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -383,7 +383,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -411,7 +411,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com.+$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com.+$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -438,7 +438,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com.+$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com.+$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -466,7 +466,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -493,7 +493,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -521,7 +521,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com/products.+$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com/products.+$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -548,7 +548,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com/products.+$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com/products.+$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -576,7 +576,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -603,7 +603,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -631,7 +631,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com/products/.+/parts/.+$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com/products/.+/parts/.+$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -658,7 +658,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com/products/.+/parts/.+$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com/products/.+/parts/.+$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -686,7 +686,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -713,7 +713,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -741,7 +741,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com/products/.+/reviews/.+$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com/products/.+/reviews/.+$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -768,7 +768,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com/products/.+/reviews/.+$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com/products/.+/reviews/.+$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -796,7 +796,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -823,7 +823,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -851,7 +851,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com/products/1.+$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com/products/1.+$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -878,7 +878,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com/products/1.+$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com/products/1.+$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -906,7 +906,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -933,7 +933,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -961,7 +961,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com/products/1.+/parts/.+$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com/products/1.+/parts/.+$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -988,7 +988,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com/products/1.+/parts/.+$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com/products/1.+/parts/.+$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -1016,7 +1016,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -1043,7 +1043,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -1071,7 +1071,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http\\:\\/\\/example\\.com\\/products\\/.+\\/parts\\/.+$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http\\:\\/\\/example\\.com\\/products\\/.+\\/parts\\/.+$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -1098,7 +1098,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http\\:\\/\\/example\\.com\\/products\\/.+\\/parts\\/.+$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http\\:\\/\\/example\\.com\\/products\\/.+\\/parts\\/.+$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -1126,7 +1126,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -1153,7 +1153,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), match(heatmaps.current_url, '^http://example.com$'), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -1181,7 +1181,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), ifNull(greaterOrEquals(heatmaps.viewport_width, round(divide(150, 16))), 0), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), ifNull(greaterOrEquals(heatmaps.viewport_width, round(divide(150, 16))), 0), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -1208,7 +1208,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), ifNull(greaterOrEquals(heatmaps.viewport_width, round(divide(150, 16))), 0), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), ifNull(greaterOrEquals(heatmaps.viewport_width, round(divide(150, 16))), 0), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -1236,7 +1236,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), ifNull(greaterOrEquals(heatmaps.viewport_width, round(divide(161, 16))), 0), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), ifNull(greaterOrEquals(heatmaps.viewport_width, round(divide(161, 16))), 0), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -1263,7 +1263,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), ifNull(greaterOrEquals(heatmaps.viewport_width, round(divide(161, 16))), 0), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), ifNull(greaterOrEquals(heatmaps.viewport_width, round(divide(161, 16))), 0), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -1291,7 +1291,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), ifNull(greaterOrEquals(heatmaps.viewport_width, round(divide(177, 16))), 0), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), ifNull(greaterOrEquals(heatmaps.viewport_width, round(divide(177, 16))), 0), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -1318,7 +1318,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), ifNull(greaterOrEquals(heatmaps.viewport_width, round(divide(177, 16))), 0), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), ifNull(greaterOrEquals(heatmaps.viewport_width, round(divide(177, 16))), 0), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -1346,7 +1346,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), ifNull(greaterOrEquals(heatmaps.viewport_width, round(divide(201, 16))), 0), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), ifNull(greaterOrEquals(heatmaps.viewport_width, round(divide(201, 16))), 0), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -1373,7 +1373,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), ifNull(greaterOrEquals(heatmaps.viewport_width, round(divide(201, 16))), 0), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), ifNull(greaterOrEquals(heatmaps.viewport_width, round(divide(201, 16))), 0), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -1401,7 +1401,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), ifNull(greaterOrEquals(heatmaps.viewport_width, round(divide(161, 16))), 0), ifNull(lessOrEquals(heatmaps.viewport_width, round(divide(192, 16))), 0), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), ifNull(greaterOrEquals(heatmaps.viewport_width, round(divide(161, 16))), 0), ifNull(lessOrEquals(heatmaps.viewport_width, round(divide(192, 16))), 0), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -1428,7 +1428,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), ifNull(greaterOrEquals(heatmaps.viewport_width, round(divide(161, 16))), 0), ifNull(lessOrEquals(heatmaps.viewport_width, round(divide(192, 16))), 0), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), ifNull(greaterOrEquals(heatmaps.viewport_width, round(divide(161, 16))), 0), ifNull(lessOrEquals(heatmaps.viewport_width, round(divide(192, 16))), 0), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -1456,7 +1456,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -1483,7 +1483,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -1511,7 +1511,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -1538,7 +1538,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -1566,7 +1566,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -1593,7 +1593,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -1621,7 +1621,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2024-05-03'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2024-05-03'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -1648,7 +1648,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2024-05-03'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2024-05-03'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -1676,7 +1676,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -1703,7 +1703,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -1731,7 +1731,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -1758,7 +1758,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'rageclick'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -1786,7 +1786,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -1813,7 +1813,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -1841,7 +1841,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus(toDate('2023-03-14'), toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus(toDate('2023-03-14'), toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -1868,7 +1868,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus(toDate('2023-03-14'), toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus(toDate('2023-03-14'), toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -1896,7 +1896,7 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-15'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus(toDate('2023-03-15'), toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-15'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus(toDate('2023-03-15'), toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0)))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -1923,7 +1923,7 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-15'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus(toDate('2023-03-15'), toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-15'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus(toDate('2023-03-15'), toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -1952,7 +1952,7 @@(SELECT heatmaps.distinct_id AS distinct_id,multiply(plus(heatmaps.y, heatmaps.viewport_height), heatmaps.scale_factor) AS scroll_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'scrolldepth'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-06'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'scrolldepth'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-06'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC'))))GROUP BY bucket)ORDER BY bucket ASCLIMIT 1000000 SETTINGS readonly=2,@@ -1983,7 +1983,7 @@(SELECT heatmaps.distinct_id AS distinct_id,multiply(plus(heatmaps.y, heatmaps.viewport_height), heatmaps.scale_factor) AS scroll_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'scrolldepth'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-06'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1)))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'scrolldepth'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-06'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC'))))GROUP BY bucket)ORDER BY bucket ASCLIMIT 1000000 SETTINGS readonly=2,@@ -2005,10 +2005,10 @@/* user_id:0 request:_snapshot_ */SELECT count() AS `count()`FROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), and(ifNull(equals(round(divide(heatmaps.x, heatmaps.viewport_width), 2), 0.0), 0), equals(multiply(heatmaps.y, heatmaps.scale_factor), 16), equals(heatmaps.pointer_target_fixed, 1)), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.`$session_id` AS `$session_id`- FROM events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), and(ifNull(equals(round(divide(heatmaps.x, heatmaps.viewport_width), 2), 0.0), 0), equals(multiply(heatmaps.y, heatmaps.scale_factor), 16), equals(heatmaps.pointer_target_fixed, 1)), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.`$session_id` AS `$session_id`+ FROM events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -2034,10 +2034,10 @@heatmaps.current_url AS current_url,heatmaps.type AS typeFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), and(ifNull(equals(round(divide(heatmaps.x, heatmaps.viewport_width), 2), 0.0), 0), equals(multiply(heatmaps.y, heatmaps.scale_factor), 16), equals(heatmaps.pointer_target_fixed, 1)), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.`$session_id` AS `$session_id`- FROM events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), and(ifNull(equals(round(divide(heatmaps.x, heatmaps.viewport_width), 2), 0.0), 0), equals(multiply(heatmaps.y, heatmaps.scale_factor), 16), equals(heatmaps.pointer_target_fixed, 1)), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.`$session_id` AS `$session_id`+ FROM events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))))ORDER BY toTimeZone(heatmaps.timestamp, 'UTC') DESCLIMIT 50OFFSET 0 SETTINGS readonly=2,@@ -2067,10 +2067,10 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.`$session_id` AS `$session_id`- FROM events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), and(equals(events.event, 'purchase'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'plan'), ''), 'null'), '^"|"$', ''), 'pro'), 0)))))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.`$session_id` AS `$session_id`+ FROM events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), and(equals(events.event, 'purchase'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'plan'), ''), 'null'), '^"|"$', ''), 'pro'), 0)))))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -2097,10 +2097,10 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.`$session_id` AS `$session_id`- FROM events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), and(equals(events.event, 'purchase'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'plan'), ''), 'null'), '^"|"$', ''), 'pro'), 0))))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.`$session_id` AS `$session_id`+ FROM events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), and(equals(events.event, 'purchase'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'plan'), ''), 'null'), '^"|"$', ''), 'pro'), 0))))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -2128,10 +2128,10 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.`$session_id` AS `$session_id`- FROM events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase'))))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.`$session_id` AS `$session_id`+ FROM events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase'))))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -2158,10 +2158,10 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.`$session_id` AS `$session_id`- FROM events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.`$session_id` AS `$session_id`+ FROM events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -2189,10 +2189,10 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.`$session_id` AS `$session_id`- FROM events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase'))))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.`$session_id` AS `$session_id`+ FROM events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase'))))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -2219,10 +2219,10 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.`$session_id` AS `$session_id`- FROM events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.`$session_id` AS `$session_id`+ FROM events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -2250,13 +2250,13 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.`$session_id` AS `$session_id`- FROM events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.`$session_id` AS `$session_id`- FROM events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'signed_up'))))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.`$session_id` AS `$session_id`+ FROM events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.`$session_id` AS `$session_id`+ FROM events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'signed_up'))))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -2283,13 +2283,13 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.`$session_id` AS `$session_id`- FROM events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.`$session_id` AS `$session_id`- FROM events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'signed_up')))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.`$session_id` AS `$session_id`+ FROM events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.`$session_id` AS `$session_id`+ FROM events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'signed_up')))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,diff --git a/products/web_analytics/backend/test/__snapshots__/test_heatmaps_api.new_events_schema.ambr b/products/web_analytics/backend/test/__snapshots__/test_heatmaps_api.new_events_schema.ambrindex b8e375e5e783..13f3b41bc642 100644--- a/products/web_analytics/backend/test/__snapshots__/test_heatmaps_api.new_events_schema.ambr+++ b/products/web_analytics/backend/test/__snapshots__/test_heatmaps_api.new_events_schema.ambr@@ -6,10 +6,10 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`- FROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('today', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-08 00:00:00.000000', 6, 'UTC')), ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$host`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), '%127.0.0.1%'), 1))))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`+ FROM events_json AS events+ WHERE and(equals(events.team_id, 99999), notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('today', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-08 00:00:00.000000', 6, 'UTC')), ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$host`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), '%127.0.0.1%'), 1))))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -38,10 +38,10 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`- FROM events_json AS events- WHERE and(equals(events.team_id, 99999), notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('today', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-08 00:00:00.000000', 6, 'UTC')), ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$host`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), '%127.0.0.1%'), 1)))))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`+ FROM events_json AS events+ WHERE and(equals(events.team_id, 99999), notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('today', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-08 00:00:00.000000', 6, 'UTC')), ifNull(notILike(toString(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$host`)), '{}'), JSONStripEmptyStringsAndNulls(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`))))), '%127.0.0.1%'), 1)))))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -73,10 +73,10 @@heatmaps.current_url AS current_url,heatmaps.type AS typeFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), and(ifNull(equals(round(divide(heatmaps.x, heatmaps.viewport_width), 2), 0.0), 0), equals(multiply(heatmaps.y, heatmaps.scale_factor), 16), equals(heatmaps.pointer_target_fixed, 1)), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`- FROM events_json AS events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), and(ifNull(equals(round(divide(heatmaps.x, heatmaps.viewport_width), 2), 0.0), 0), equals(multiply(heatmaps.y, heatmaps.scale_factor), 16), equals(heatmaps.pointer_target_fixed, 1)), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`+ FROM events_json AS events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))))ORDER BY toTimeZone(heatmaps.timestamp, 'UTC') DESCLIMIT 50OFFSET 0 SETTINGS readonly=2,@@ -99,10 +99,10 @@/* user_id:0 request:_snapshot_ */SELECT count() AS `count()`FROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), and(ifNull(equals(round(divide(heatmaps.x, heatmaps.viewport_width), 2), 0.0), 0), equals(multiply(heatmaps.y, heatmaps.scale_factor), 16), equals(heatmaps.pointer_target_fixed, 1)), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`- FROM events_json AS events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), and(ifNull(equals(round(divide(heatmaps.x, heatmaps.viewport_width), 2), 0.0), 0), equals(multiply(heatmaps.y, heatmaps.scale_factor), 16), equals(heatmaps.pointer_target_fixed, 1)), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`+ FROM events_json AS events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -125,10 +125,10 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`- FROM events_json AS events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), and(equals(events.event, 'purchase'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^plan)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^plan)), if(isNull(nullIf(toString(events.properties.plan), '')), NULL, if(and(in(ascii(toString(events.properties.plan)), tuple(91, 123)), in(ascii(toJSONString(events.properties.plan)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.plan), '[]'), '{}'), toString(events.properties.plan)))), 'pro'), 0))))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`+ FROM events_json AS events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), and(equals(events.event, 'purchase'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^plan)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^plan)), if(isNull(nullIf(toString(events.properties.plan), '')), NULL, if(and(in(ascii(toString(events.properties.plan)), tuple(91, 123)), in(ascii(toJSONString(events.properties.plan)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.plan), '[]'), '{}'), toString(events.properties.plan)))), 'pro'), 0))))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -157,10 +157,10 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`- FROM events_json AS events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), and(equals(events.event, 'purchase'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^plan)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^plan)), if(isNull(nullIf(toString(events.properties.plan), '')), NULL, if(and(in(ascii(toString(events.properties.plan)), tuple(91, 123)), in(ascii(toJSONString(events.properties.plan)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.plan), '[]'), '{}'), toString(events.properties.plan)))), 'pro'), 0)))))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`+ FROM events_json AS events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), and(equals(events.event, 'purchase'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^plan)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^plan)), if(isNull(nullIf(toString(events.properties.plan), '')), NULL, if(and(in(ascii(toString(events.properties.plan)), tuple(91, 123)), in(ascii(toJSONString(events.properties.plan)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.plan), '[]'), '{}'), toString(events.properties.plan)))), 'pro'), 0)))))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -188,10 +188,10 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`- FROM events_json AS events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`+ FROM events_json AS events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -220,10 +220,10 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`- FROM events_json AS events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase'))))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`+ FROM events_json AS events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase'))))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -251,10 +251,10 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`- FROM events_json AS events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`+ FROM events_json AS events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -283,13 +283,13 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`- FROM events_json AS events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`- FROM events_json AS events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'signed_up'))))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`+ FROM events_json AS events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`+ FROM events_json AS events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'signed_up'))))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y@@ -317,13 +317,13 @@countIf(and(greater(heatmaps.y, heatmaps.viewport_height), not(heatmaps.pointer_target_fixed))) AS below_fold,round(quantile(0.5)(multiply(heatmaps.viewport_height, heatmaps.scale_factor))) AS median_viewport_heightFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`- FROM events_json AS events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`- FROM events_json AS events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'signed_up')))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`+ FROM events_json AS events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase')))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`+ FROM events_json AS events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'signed_up')))))LIMIT 1000000 SETTINGS readonly=2,max_execution_time=60,allow_experimental_object_type=1,@@ -352,10 +352,10 @@round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,multiply(heatmaps.y, heatmaps.scale_factor) AS client_yFROM heatmaps- WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), ifNull(greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), 0), lessOrEquals(heatmaps.timestamp, plus('2025-03-31', toIntervalDay(1))), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,- (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`- FROM events_json AS events- WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase'))))))+ WHERE and(equals(heatmaps.team_id, 99999), equals(heatmaps.type, 'click'), greaterOrEquals(heatmaps.timestamp, toDateTime64(toDate('2023-03-08'), 6, 'UTC')), lessOrEquals(heatmaps.timestamp, toDateTime64(plus('2025-03-31', toIntervalDay(1)), 6, 'UTC')), not(and(equals(heatmaps.x, 0), equals(heatmaps.y, 0))), globalIn(heatmaps.session_id,+ (SELECT DISTINCT events.properties.`$session_id` AS `$session_id`+ FROM events_json AS events+ WHERE and(equals(events.team_id, 99999), and(notEmpty(events.properties.`$session_id`), and(less(events.timestamp, toDateTime64('2025-04-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2023-03-07 00:00:00.000000', 6, 'UTC')))), equals(events.event, 'purchase'))))))GROUP BY pointer_target_fixed,pointer_relative_x,client_y