Skip to content

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

fix(hogql): compare date bounds in the project time zone (#106419)

Andy Zhao8bf108531245
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.ambr
index 2d67837b0ec4..c49d0c92dade 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)), 9, '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_1
ORDER 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)), 9, '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)), 9, '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_1
ORDER 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)), 9, '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_1
ORDER 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)), 9, '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)), 9, '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)), 9, '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)), 9, '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.ambr
index c02f2d6f6fd1..2a1fcdaef787 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
@@ -1087,7 +1087,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)), 9, '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_1
ORDER BY day_start ASC, breakdown_value ASC)
@@ -1458,11 +1458,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)), 9,
+ '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,
@@ -1605,7 +1606,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)), 9, '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_1
ORDER BY day_start ASC, breakdown_value ASC)
@@ -1738,7 +1739,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)), 9, '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_1
ORDER BY day_start ASC, breakdown_value ASC)
@@ -1826,7 +1827,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)), 9, '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,
@@ -1969,7 +1970,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)), 9, '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,
@@ -2119,7 +2120,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)), 9, '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,
@@ -2276,7 +2277,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)), 9, '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.ambr
index 41a4b46305b9..cf6c9ad44c21 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
@@ -94,7 +94,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)), 9, '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
@@ -119,7 +119,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)), 9, '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
@@ -168,7 +168,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)), 9, '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
@@ -194,7 +194,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)), 9, '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 ASC
diff --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.ambr
index cae2f7ea62b6..7aeb0c90869d 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)), 9, '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
@@ -31,7 +31,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(startsWith(dynamicType(accurateCast(events.properties.`$current_url`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$current_url`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$current_url`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$current_url`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$current_url`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$current_url`, 'Dynamic')), 'Tuple')), 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)), 9, '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
@@ -80,7 +80,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(startsWith(dynamicType(accurateCast(events.properties.`$current_url`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$current_url`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$current_url`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$current_url`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$current_url`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$current_url`, 'Dynamic')), 'Tuple')), 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)), 9, '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
@@ -106,7 +106,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(startsWith(dynamicType(accurateCast(events.person_properties.person_property, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.person_property, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.person_property), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.person_property, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.person_property, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.person_property, 'Dynamic')), 'Tuple')), 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)), 9, '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 ASC
diff --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.ambr
index c98f498f2962..c06874ca8dd3 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 BY
raw_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), 9, %(hogql_val_10)s)))
GROUP BY
s.session_id
LIMIT 50000
@@ -194,10 +194,10 @@
FROM
events
WHERE
- and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, today()))
+ and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, toDateTime64(today(), 9, %(hogql_val_0)s)))
LIMIT 50000) AS events
LEFT 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_v7
FROM
raw_sessions
diff --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.ambr
index e30609511fd4..bf9891fe5e5a 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 @@
FROM
events_json AS events
WHERE
- and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, today()))
+ and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, toDateTime64(today(), 9, %(hogql_val_0)s)))
LIMIT 50000) AS events
LEFT 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_v7
FROM
raw_sessions
diff --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.ambr
index 817e5586e371..2384dd74b005 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 BY
raw_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), 9, %(hogql_val_8)s)))
GROUP BY
s.session_id
LIMIT 50000
@@ -209,10 +209,10 @@
FROM
events
WHERE
- and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, today()))
+ and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, toDateTime64(today(), 9, %(hogql_val_0)s)))
LIMIT 50000) AS events
LEFT 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_v7
FROM
raw_sessions_v3
diff --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.ambr
index e996bdc55dbe..e58012ef05b7 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 @@
FROM
events_json AS events
WHERE
- and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, today()))
+ and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, toDateTime64(today(), 9, %(hogql_val_0)s)))
LIMIT 50000) AS events
LEFT 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_v7
FROM
raw_sessions_v3
diff --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.ambr
index dd1c0d2fbeb7..ae15eee57b74 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 @@
FROM
sessions
WHERE
- 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)), 9, %(hogql_val_1)s)))
GROUP BY
sessions.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 BY
sessions.session_id
LIMIT 50000
@@ -33,12 +33,12 @@
FROM
sessions
WHERE
- 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)), 9, %(hogql_val_2)s)))
GROUP BY
sessions.session_id,
sessions.session_id) AS sessions
WHERE
- greater(sessions.`$start_timestamp`, %(hogql_val_2)s)
+ greater(sessions.`$start_timestamp`, %(hogql_val_3)s)
LIMIT 50000
'''
# ---
@@ -46,8 +46,8 @@
'''
SELECT
count(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_value
FROM
events AS e
LEFT OUTER JOIN (SELECT
@@ -68,12 +68,12 @@
FROM
sessions
WHERE
- 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)), 9, %(hogql_val_5)s)), lessOrEquals(sessions.min_timestamp, toDateTime64(plus(assumeNotNull(toDateTime(%(hogql_val_6)s, %(hogql_val_7)s)), toIntervalDay(3)), 9, %(hogql_val_8)s)))
GROUP BY
sessions.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), (SELECT
cohortpeople.person_id AS person_id
FROM
cohortpeople
@@ -89,7 +89,7 @@
'''
SELECT
s.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_time
FROM
session_replay_events AS s
LEFT JOIN (SELECT
@@ -98,12 +98,12 @@
FROM
sessions
WHERE
- 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)), 9, %(hogql_val_3)s)), lessOrEquals(sessions.min_timestamp, toDateTime64(plus(now64(6, %(hogql_val_4)s), toIntervalDay(3)), 9, %(hogql_val_5)s)))
GROUP BY
sessions.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), 9, %(hogql_val_11)s)))
GROUP BY
s.session_id
LIMIT 50000
@@ -123,15 +123,15 @@
FROM
events
WHERE
- and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, today()))
+ and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, toDateTime64(today(), 9, %(hogql_val_0)s)))
LIMIT 50000) AS events
LEFT 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_id
FROM
sessions
WHERE
- 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)), 9, %(hogql_val_4)s)))
GROUP BY
sessions.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.ambr
index f64bd55ba7cf..f3740ce1e3c2 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 @@
FROM
sessions
WHERE
- 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)), 9, %(hogql_val_1)s)))
GROUP BY
sessions.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 BY
sessions.session_id
LIMIT 50000
@@ -26,8 +26,8 @@
'''
SELECT
count(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_value
FROM
events_json AS e
LEFT OUTER JOIN (SELECT
@@ -48,12 +48,12 @@
FROM
sessions
WHERE
- 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)), 9, %(hogql_val_5)s)), lessOrEquals(sessions.min_timestamp, toDateTime64(plus(assumeNotNull(toDateTime(%(hogql_val_6)s, %(hogql_val_7)s)), toIntervalDay(3)), 9, %(hogql_val_8)s)))
GROUP BY
sessions.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), (SELECT
cohortpeople.person_id AS person_id
FROM
cohortpeople
@@ -79,15 +79,15 @@
FROM
events_json AS events
WHERE
- and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, today()))
+ and(equals(events.team_id, <TEAM_ID>), less(events.timestamp, toDateTime64(today(), 9, %(hogql_val_0)s)))
LIMIT 50000) AS events
LEFT 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_id
FROM
sessions
WHERE
- 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)), 9, %(hogql_val_4)s)))
GROUP BY
sessions.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.ambr
index 6eaebc0a8db5..9f3bbee40503 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_version
FROM 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)), 9, %(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_version
FROM latest_events)
SELECT major_versions.major_version AS major_version, count() AS user_count, round(divide(multiply(100, count()), sum(count()) OVER ()), 2) AS percentage
FROM 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_version
ORDER BY major_versions.major_version ASC
LIMIT 100
diff --git a/posthog/hogql/test/__snapshots__/test_query.new_events_schema.ambr b/posthog/hogql/test/__snapshots__/test_query.new_events_schema.ambr
index 9c3f5ed7120d..06b833d59e47 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(startsWith(dynamicType(accurateCast(events.properties.`$os_version`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$os_version`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$os_version`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$os_version`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$os_version`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$os_version`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$os_version`), '[]'), '{}'), toString(events.properties.`$os_version`))))), toTimeZone(events.timestamp, %(hogql_val_0)s)) AS latest_os_version
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$os`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$os`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$os`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$os`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$os`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$os`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$os`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$os`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$os`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$os`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$os`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$os`, 'Dynamic')), 'Tuple')), 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)), 9, %(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_version
FROM latest_events)
SELECT major_versions.major_version AS major_version, count() AS user_count, round(divide(multiply(100, count()), sum(count()) OVER ()), 2) AS percentage
FROM 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_version
ORDER BY major_versions.major_version ASC
LIMIT 100
diff --git a/posthog/hogql/transforms/property_types.py b/posthog/hogql/transforms/property_types.py
index d7fd91f605a4..c733cbbc5714 100644
--- a/posthog/hogql/transforms/property_types.py
+++ b/posthog/hogql/transforms/property_types.py
@@ -133,7 +133,7 @@ class PropertyFinder(TraversingVisitor):
class ToTimeZoneParts:
bare_field: ast.Expr
timezone: str
- constant: ast.Expr
+ other_side: ast.Expr
swapped: bool
@@ -566,7 +566,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)
@@ -575,7 +575,7 @@ class PropertySwapper(CloningVisitor):
@staticmethod
def _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 comparison
where one side is toTimeZone(field, tz).
Returns None if the pattern doesn't match.
@@ -583,7 +583,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.left
inner = tz_side
if isinstance(inner, ast.Alias):
@@ -594,41 +594,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 = expr
if 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).
@@ -639,17 +629,34 @@ class PropertySwapper(CloningVisitor):
if (zoned := parse_zoned_datetime_string(inner.value)) is not None:
inner.value = zoned
return 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
+ precision = 6 if isinstance(inner, ast.Constant) else 9
+ new_call = ast.Call(
+ name="toDateTime64",
+ args=[inner, ast.Constant(value=precision), 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 True
def 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.ambr
index 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_pageviews
FROM 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 ALL
SELECT countMerge(total_pageviews) AS total_pageviews
FROM (
SELECT countState() AS total_pageviews
FROM 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_pageviews
FROM 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 ALL
SELECT countMerge(total_pageviews) AS total_pageviews
FROM (
SELECT countState() AS total_pageviews
FROM 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.ambr
index cbfd2498207e..93fb0ce08fff 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_pageviews
FROM 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)), 9, %(hogql_val_1)s))))
LIMIT 50000 UNION ALL
SELECT countMerge(total_pageviews) AS total_pageviews
FROM (
SELECT countState() AS total_pageviews
FROM 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)), 9, %(hogql_val_3)s))))
LIMIT 50000
'''
# ---
@@ -480,13 +480,13 @@
FROM (
SELECT countState() AS total_pageviews
FROM 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)), 9, %(hogql_val_1)s))))
LIMIT 50000 UNION ALL
SELECT countMerge(total_pageviews) AS total_pageviews
FROM (
SELECT countState() AS total_pageviews
FROM 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)), 9, %(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.py
index b05b231c54ad..6dcbabf447c7 100644
--- a/posthog/hogql/transforms/test/test_property_types.py
+++ b/posthog/hogql/transforms/test/test_property_types.py
@@ -1769,12 +1769,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")
@@ -1798,6 +1801,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(
@@ -1886,6 +1903,41 @@ 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):
+ for timestamp in (
+ datetime(2024, 2, 29, 14, 30, 0),
+ datetime(2024, 2, 29, 15, 30, 0),
+ datetime(2024, 3, 1, 14, 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)
+
+ @parameterized.expand(
+ [
+ ("constructor", "toDateTime64('2024-03-01 12:00:00.000000500', 9)"),
+ ("computed", "toDateTime64('2024-03-01 11:59:59.000000500', 9) + toIntervalSecond(1)"),
+ ]
+ )
+ def test_nanosecond_bound_keeps_its_precision(self, _name, bound):
+ 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 = f"SELECT count() FROM events WHERE event = 'nano_test' AND timestamp >= {bound}"
+ 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(
@@ -1980,7 +2032,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"
@@ -1995,7 +2047,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.ambr
index 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 timestamp
FROM 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') DESC
LIMIT 100) ARRAY
JOIN (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 timestamp
FROM 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'), ''))) ARRAY
JOIN (kv).1 AS key,
(kv).2 AS value
WHERE and(isNotNull(value), ifNull(notEquals(value, ''), 1))
@@ -94,7 +94,7 @@
(SELECT JSONExtractKeysAndValues(events.properties, 'String') AS kv,
toTimeZone(events.timestamp, 'UTC') AS timestamp
FROM 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') DESC
LIMIT 100) ARRAY
JOIN (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.ambr
index f8d013dbdea7..50821709d336 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 timestamp
FROM 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)), 9, 'UTC')), equals(events.event, 'event1'))
ORDER BY toTimeZone(events.timestamp, 'UTC') DESC
LIMIT 100) ARRAY
JOIN (kv).1 AS key,
@@ -55,7 +55,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, if(startsWith(dynamicType(accurateCast(events.properties.zero_duration_recording_count_in_period, 'Dynamic')), 'DateTime'), concat('"', ifNull(toString(concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.zero_duration_recording_count_in_period, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.zero_duration_recording_count_in_period), 20, 10)), ''), 'Z')), ''), '"'), nullIf(nullIf(toJSONString(events.properties.zero_duration_recording_count_in_period), '[]'), '{}')))), '')))] AS kv,
toTimeZone(events.timestamp, 'UTC') AS timestamp
FROM 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, if(startsWith(dynamicType(accurateCast(events.properties.zero_duration_recording_count_in_period, 'Dynamic')), 'DateTime'), concat('"', ifNull(toString(concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.zero_duration_recording_count_in_period, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.zero_duration_recording_count_in_period), 20, 10)), ''), 'Z')), ''), '"'), 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)), 9, '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, if(startsWith(dynamicType(accurateCast(events.properties.zero_duration_recording_count_in_period, 'Dynamic')), 'DateTime'), concat('"', ifNull(toString(concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.zero_duration_recording_count_in_period, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.zero_duration_recording_count_in_period), 20, 10)), ''), 'Z')), ''), '"'), nullIf(nullIf(toJSONString(events.properties.zero_duration_recording_count_in_period), '[]'), '{}')))), '')), ''))) ARRAY
JOIN (kv).1 AS key,
(kv).2 AS value
WHERE and(isNotNull(value), ifNull(notEquals(value, ''), 1))
@@ -94,7 +94,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 timestamp
FROM 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)), 9, 'UTC')), equals(events.event, '$pageview'))
ORDER BY toTimeZone(events.timestamp, 'UTC') DESC
LIMIT 100) ARRAY
JOIN (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.ambr
index 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 count
FROM 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.event
ORDER BY count DESC, events.event ASC
LIMIT 501
diff --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.ambr
index 08224ce7b031..efb4b9875b24 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 count
FROM 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)), 9, '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.event
ORDER BY count DESC, events.event ASC
LIMIT 501
diff --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.ambr
index 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 count
FROM 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.event
ORDER BY count DESC, events.event ASC
LIMIT 501
diff --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.ambr
index bc2b39f48011..747be75ff029 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 count
FROM 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)), 9, '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.event
ORDER BY count DESC, events.event ASC
LIMIT 501
diff --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.ambr
index 3b93e78101dd..d2d894f54f4f 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_id
FROM 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'), 9, '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_id
FROM 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'), 9, '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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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_id
FROM 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'), 9, '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_id
FROM 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'), 9, '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_id
FROM 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'), 9, '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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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_id
FROM 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'), 9, '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
diff --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.ambr
index 9baf2460aa70..0b5eeffb6e1a 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.something, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.something, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.something), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.something, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.something, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.something, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.something, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.something, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.something), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.something, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.something, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.something, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
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 if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$host`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$host`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$host`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$host`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
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 if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 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 if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 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 if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 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 if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
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 if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`probe-one`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`probe-one`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`probe-one`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`probe-one`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`probe-one`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`probe-one`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`probe-two`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`probe-two`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`probe-two`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`probe-two`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`probe-two`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`probe-two`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`probe-one`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`probe-one`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`probe-one`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`probe-one`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`probe-one`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`probe-one`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`probe-two`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`probe-two`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`probe-two`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`probe-two`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`probe-two`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`probe-two`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
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 if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.something, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.something, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.something), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.something, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.something, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.something, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.something, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.something, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.something), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.something, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.something, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.something, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
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 if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$host`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$host`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$host`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$host`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
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 if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 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 if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 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 if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 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 if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
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 if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`probe-one`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`probe-one`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`probe-one`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`probe-one`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`probe-one`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`probe-one`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`probe-two`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`probe-two`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`probe-two`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`probe-two`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`probe-two`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`probe-two`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`probe-one`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`probe-one`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`probe-one`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`probe-one`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`probe-one`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`probe-one`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`probe-two`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`probe-two`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`probe-two`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`probe-two`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`probe-two`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`probe-two`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
LIMIT 1000000)))
GROUP BY s.session_id
diff --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.ambr
index 90bfff6b4040..ec2a63b1476b 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_id
FROM 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), 9, %(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 1
LIMIT 1000000)))
@@ -76,7 +76,7 @@
WHERE equals(person.team_id, 99999)
GROUP BY person.id
HAVING 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), 9, %(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 1
LIMIT 1000000)))
@@ -126,7 +126,7 @@
WHERE equals(person.team_id, 99999)
GROUP BY person.id
HAVING 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), 9, %(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 1
LIMIT 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_id
FROM 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), 9, %(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 1
LIMIT 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_id
FROM 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), 9, %(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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -666,7 +666,7 @@
WHERE equals(person.team_id, 99999)
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))))))) 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'), 9, '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 1
LIMIT 1000000)))
@@ -773,7 +773,7 @@
WHERE equals(person.team_id, 99999)
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))))))) 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'), 9, '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 1
LIMIT 1000000)))
@@ -880,7 +880,7 @@
WHERE equals(person.team_id, 99999)
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))))))) 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'), 9, '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 1
LIMIT 1000000)))
@@ -987,7 +987,7 @@
WHERE equals(person.team_id, 99999)
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))))))) 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))
GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')
HAVING 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -3527,7 +3527,7 @@
FROM groups
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), 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'), 9, '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 1
LIMIT 1000000)))
@@ -3581,7 +3581,7 @@
FROM groups
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), 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'), 9, '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 1
LIMIT 1000000)))
@@ -3635,7 +3635,7 @@
FROM groups
WHERE 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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_id
FROM 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'), 9, '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_id
FROM 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'), 9, '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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000))))
@@ -5816,7 +5816,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -5865,7 +5865,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_id
FROM 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'), 9, '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
@@ -5956,13 +5956,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000))))
@@ -6011,13 +6011,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000))))
@@ -6066,13 +6066,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000))))
@@ -6121,13 +6121,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000))))
@@ -6176,13 +6176,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000))))
@@ -6231,13 +6231,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000))))
@@ -6286,13 +6286,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000))))
@@ -6341,13 +6341,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000))))
@@ -6650,7 +6650,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_id
FROM 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'), 9, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))
GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')
HAVING 1
LIMIT 1000000)))
@@ -6708,7 +6708,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_id
FROM 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'), 9, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))
GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')
HAVING 1
LIMIT 1000000)))
@@ -6757,7 +6757,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -6806,7 +6806,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -6855,13 +6855,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000))))
@@ -6910,13 +6910,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000))))
@@ -7241,7 +7241,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -7290,13 +7290,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalNotIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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
@@ -7344,7 +7344,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -7393,7 +7393,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -7442,7 +7442,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -7491,7 +7491,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -7540,7 +7540,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -7589,7 +7589,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -7638,7 +7638,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -7687,7 +7687,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -7736,7 +7736,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -7785,7 +7785,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -7834,7 +7834,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -7883,7 +7883,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -7932,7 +7932,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -7981,7 +7981,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -8039,13 +8039,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000))))
@@ -8094,7 +8094,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_id
FROM 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'), 9, 'UTC')), greaterOrEquals(events.timestamp, toDateTime64('2021-01-17 00:00:00.000000', 6, 'UTC')))
GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')
HAVING 1
LIMIT 1000000)))
@@ -8143,7 +8143,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -8192,7 +8192,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -9064,7 +9064,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -9113,7 +9113,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -9162,7 +9162,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -9254,7 +9254,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -9303,7 +9303,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -9357,7 +9357,7 @@
FROM groups
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), 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'), 9, '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 1
LIMIT 1000000)))
@@ -9411,7 +9411,7 @@
FROM groups
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), 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'), 9, '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 1
LIMIT 1000000)))
@@ -9465,7 +9465,7 @@
FROM groups
WHERE 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'), 9, '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 1
LIMIT 1000000)))
@@ -9514,7 +9514,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -9563,13 +9563,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -9618,13 +9618,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -9673,7 +9673,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -9722,7 +9722,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -9771,7 +9771,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -9820,7 +9820,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -9869,7 +9869,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -9918,7 +9918,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -9967,7 +9967,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -10016,7 +10016,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -10065,7 +10065,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -10114,7 +10114,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -10163,25 +10163,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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_id
FROM 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'), 9, '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_id
FROM 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'), 9, '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
@@ -10229,7 +10229,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -10278,13 +10278,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000))))
@@ -11646,7 +11646,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -11695,7 +11695,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_id
FROM 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'), 9, '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
@@ -11786,13 +11786,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000))))
@@ -11841,13 +11841,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000))))
@@ -11896,13 +11896,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000))))
@@ -11951,13 +11951,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000))))
@@ -12006,13 +12006,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000))))
@@ -12061,13 +12061,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000))))
@@ -12116,13 +12116,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000))))
@@ -12171,13 +12171,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000))))
@@ -12480,7 +12480,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_id
FROM 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'), 9, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))
GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')
HAVING 1
LIMIT 1000000)))
@@ -12538,7 +12538,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_id
FROM 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'), 9, 'UTC')), equals(events.event, '$pageview'), greaterOrEquals(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')))
GROUP BY nullIf(nullIf(events.`$session_id`, ''), 'null')
HAVING 1
LIMIT 1000000)))
@@ -12587,7 +12587,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -12636,7 +12636,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -12685,13 +12685,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000))))
@@ -12740,13 +12740,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 1000000))))
@@ -13071,7 +13071,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -13120,13 +13120,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalNotIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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
@@ -13174,7 +13174,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -13223,7 +13223,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -13272,7 +13272,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -13321,7 +13321,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -13370,7 +13370,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -13419,7 +13419,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -13468,7 +13468,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -13517,7 +13517,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -13566,7 +13566,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_id
FROM 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'), 9, '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 1
LIMIT 1000000)))
@@ -13615,7 +13615,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_id
FROM 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'), 9, '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 1
LIMIT 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.ambr
index 59142584247b..927c613db8fb 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.rgInternal, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.rgInternal), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, %(hogql_val_7)s), 9, %(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(startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.rgInternal, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.rgInternal), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -76,7 +76,7 @@
WHERE equals(person.team_id, 99999)
GROUP BY person.id
HAVING 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, %(hogql_val_10)s), 9, %(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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -126,7 +126,7 @@
WHERE equals(person.team_id, 99999)
GROUP BY person.id
HAVING 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, %(hogql_val_10)s), 9, %(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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.rgInternal, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.rgInternal), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, %(hogql_val_7)s), 9, %(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(startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.rgInternal, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.rgInternal), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.rgInternal, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.rgInternal), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, %(hogql_val_7)s), 9, %(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(startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.rgInternal, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.rgInternal), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.rgInternal, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -289,7 +289,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -338,7 +338,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -387,7 +387,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -451,7 +451,7 @@
WHERE equals(person.team_id, 99999)
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))))))) 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -515,7 +515,7 @@
WHERE equals(person.team_id, 99999)
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))))))) 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -579,7 +579,7 @@
WHERE equals(person.team_id, 99999)
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))))))) 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -643,7 +643,7 @@
WHERE equals(person.team_id, 99999)
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))))))) 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -692,7 +692,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -741,7 +741,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -790,7 +790,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -839,7 +839,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -1488,7 +1488,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$window_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$window_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$window_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$window_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -1537,7 +1537,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$window_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$window_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$window_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$window_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -1586,7 +1586,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$window_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$window_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$window_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$window_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -1635,7 +1635,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$window_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$window_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$window_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$window_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -1693,13 +1693,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -1748,7 +1748,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), if(isNull(nullIf(toString(events.properties.`$browser`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -1797,7 +1797,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), if(isNull(nullIf(toString(events.properties.`$browser`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -1846,7 +1846,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -1895,7 +1895,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -1944,7 +1944,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -1993,7 +1993,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -2042,7 +2042,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -2091,7 +2091,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -2145,7 +2145,7 @@
FROM groups
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), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -2199,7 +2199,7 @@
FROM groups
WHERE 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -2253,7 +2253,7 @@
FROM groups
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), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -2302,13 +2302,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -2357,13 +2357,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), if(isNull(nullIf(toString(events.properties.`$browser`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -2412,7 +2412,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -2461,7 +2461,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -2510,7 +2510,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -2559,7 +2559,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -2608,7 +2608,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -2657,7 +2657,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -2706,7 +2706,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -2755,7 +2755,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -2853,7 +2853,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -2902,7 +2902,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -2951,7 +2951,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -3000,25 +3000,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.is_internal_user, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.is_internal_user), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.is_internal_user, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.is_internal_user), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), if(isNull(nullIf(toString(events.properties.`$browser`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
LIMIT 1000000)))
GROUP BY s.session_id
@@ -3066,13 +3066,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -3121,7 +3121,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -3170,7 +3170,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
LIMIT 1000000)))
GROUP BY s.session_id
@@ -3218,13 +3218,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -3273,13 +3273,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -3328,13 +3328,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.foo, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.foo), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.foo, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.foo), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.bar, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.bar, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.bar), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.bar, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.bar, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.bar, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.bar, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.bar, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.bar), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.bar, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.bar, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.bar, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -3383,13 +3383,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.foo, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.foo), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.foo, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.foo), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.foo, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.foo), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.foo, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.foo), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -3438,13 +3438,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.foo, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.foo), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.foo, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.foo), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.foo, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.foo), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.foo, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.foo), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -3493,13 +3493,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -3548,13 +3548,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -3603,13 +3603,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -3667,7 +3667,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -3716,7 +3716,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -3765,7 +3765,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -3823,7 +3823,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -3872,13 +3872,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -3927,13 +3927,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -4086,13 +4086,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$host`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$host`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$host`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$host`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
LIMIT 1000000)))
GROUP BY s.session_id
@@ -4140,7 +4140,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -4189,7 +4189,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.is_internal_user, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.is_internal_user), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.is_internal_user, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.is_internal_user), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -4238,7 +4238,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -4287,7 +4287,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.is_internal_user, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.is_internal_user), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.is_internal_user, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.is_internal_user), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -4336,7 +4336,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -4385,7 +4385,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.is_internal_user, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.is_internal_user), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.is_internal_user, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.is_internal_user), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -4434,7 +4434,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -4483,7 +4483,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -4532,7 +4532,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -4581,7 +4581,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -4630,7 +4630,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -4679,7 +4679,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$window_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$window_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$window_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$window_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -4728,7 +4728,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$window_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$window_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$window_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$window_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -4777,7 +4777,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$window_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$window_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$window_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$window_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -4826,7 +4826,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$window_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$window_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$window_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$window_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$window_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -4884,13 +4884,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -4939,7 +4939,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), if(isNull(nullIf(toString(events.properties.`$browser`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -4988,7 +4988,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), if(isNull(nullIf(toString(events.properties.`$browser`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -5037,7 +5037,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -5086,7 +5086,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -5135,7 +5135,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -5184,7 +5184,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -5233,7 +5233,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -5282,7 +5282,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -5336,7 +5336,7 @@
FROM groups
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), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -5390,7 +5390,7 @@
FROM groups
WHERE 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -5444,7 +5444,7 @@
FROM groups
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), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -5493,13 +5493,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -5548,13 +5548,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), if(isNull(nullIf(toString(events.properties.`$browser`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -5603,7 +5603,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -5652,7 +5652,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -5701,7 +5701,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -5750,7 +5750,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -5799,7 +5799,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -5848,7 +5848,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -5897,7 +5897,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -5946,7 +5946,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -5995,7 +5995,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -6044,7 +6044,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -6093,7 +6093,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -6142,7 +6142,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -6191,25 +6191,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.is_internal_user, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.is_internal_user), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.is_internal_user, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.is_internal_user), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, 'UTC')), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$browser`)), if(isNull(nullIf(toString(events.properties.`$browser`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
LIMIT 1000000)))
GROUP BY s.session_id
@@ -6257,13 +6257,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -6312,7 +6312,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -6361,7 +6361,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
LIMIT 1000000)))
GROUP BY s.session_id
@@ -6409,13 +6409,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -6464,13 +6464,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -6519,13 +6519,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.foo, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.foo), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.foo, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.foo), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.bar, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.bar, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.bar), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.bar, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.bar, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.bar, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.bar, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.bar, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.bar), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.bar, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.bar, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.bar, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -6574,13 +6574,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.foo, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.foo), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.foo, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.foo), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.foo, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.foo), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.foo, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.foo), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -6629,13 +6629,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.foo, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.foo), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.foo, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.foo), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.foo, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.foo), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.foo, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.foo), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.foo, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -6684,13 +6684,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -6739,13 +6739,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -6794,13 +6794,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -6858,7 +6858,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -6907,7 +6907,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -6956,7 +6956,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -7014,7 +7014,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -7063,13 +7063,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -7118,13 +7118,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000))))
@@ -7277,13 +7277,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$host`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$host`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$host`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$host`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
LIMIT 1000000)))
GROUP BY s.session_id
@@ -7331,7 +7331,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -7380,7 +7380,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.is_internal_user, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.is_internal_user), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.is_internal_user, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.is_internal_user), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -7429,7 +7429,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -7478,7 +7478,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.is_internal_user, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.is_internal_user), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.is_internal_user, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.is_internal_user), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -7527,7 +7527,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -7576,7 +7576,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.is_internal_user, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.is_internal_user), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.is_internal_user, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.is_internal_user), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.is_internal_user, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -7625,7 +7625,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -7674,7 +7674,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -7723,7 +7723,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -7772,7 +7772,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -7821,7 +7821,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 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.ambr
index a580ba2997ed..4c4686488f2f 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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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_id
FROM 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'), 9, '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_id
FROM 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'), 9, '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_id
FROM 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'), 9, '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 1
LIMIT 1000000)), globalIn(s.session_id,
(SELECT nullIf(nullIf(events.`$session_id`, ''), 'null') AS session_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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_id
FROM 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'), 9, '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_id
FROM 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'), 9, '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.ambr
index 2e31c50d4772..7a542fb2cd14 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.vip, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.vip), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.vip, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.vip), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$pathname`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$pathname`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$pathname`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$pathname`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 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 if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.vip, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.vip), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.vip, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.vip), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$pathname`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$pathname`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$pathname`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$pathname`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 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 if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$pathname`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$pathname`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$pathname`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$pathname`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.vip, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.vip), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.vip, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.vip), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$pathname`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$pathname`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$pathname`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$pathname`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$pathname`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$pathname`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$pathname`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$pathname`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$pathname`), '[]'), '{}'), toString(events.properties.`$pathname`)))))), '%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 if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.vip, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.vip), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.vip, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.vip), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$pathname`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$pathname`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$pathname`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$pathname`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 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 if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.vip, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.vip), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$pathname`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$pathname`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.vip, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.vip), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$pathname`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$pathname`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.vip, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.vip), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.vip, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.vip), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.vip, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.vip), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$pathname`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$pathname`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$pathname`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$pathname`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$pathname`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$pathname`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.vip, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.vip), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.vip, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$pathname`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$pathname`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$pathname`, 'Dynamic')), 'Tuple')), 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.ambr
index abcb956c7d7c..67ab83d46ca0 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
FROM 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'), 9, '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 1
LIMIT 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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'), 9, '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_id
diff --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.ambr
index b892f7442b38..22063f0a5fb4 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)), in(s.distinct_id,
@@ -87,7 +87,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)), in(s.distinct_id,
@@ -148,7 +148,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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`))))) AS session_id
FROM 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.plan, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.plan, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.plan), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.plan, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.plan, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.plan, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.plan, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.plan, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.plan), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.plan, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.plan, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.plan, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)), in(s.distinct_id,
@@ -215,19 +215,19 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
LIMIT 1000000)))
GROUP BY s.session_id
diff --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.ambr
index 42424fcd2f47..6deb14fc52c6 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 groups
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), 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'), 9, '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 1
LIMIT 1000000)))
@@ -85,7 +85,7 @@
FROM groups
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), 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'), 9, '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 1
LIMIT 1000000)))
@@ -139,7 +139,7 @@
FROM groups
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), 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'), 9, '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 1
LIMIT 1000000)))
@@ -193,7 +193,7 @@
FROM groups
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), 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'), 9, '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 1
LIMIT 1000000)))
@@ -247,7 +247,7 @@
FROM groups
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), 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'), 9, '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 1
LIMIT 1000000)))
@@ -301,7 +301,7 @@
FROM groups
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), 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'), 9, '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 1
LIMIT 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.ambr
index 68e393fb3c1f..5feb49b4d9d8 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 groups
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), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -85,7 +85,7 @@
FROM groups
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), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -139,7 +139,7 @@
FROM groups
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), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -193,7 +193,7 @@
FROM groups
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), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -247,7 +247,7 @@
FROM groups
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), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 1000000)))
@@ -301,7 +301,7 @@
FROM groups
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), notEmpty(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$session_id`)), if(isNull(nullIf(toString(events.properties.`$session_id`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))), lessOrEquals(events.timestamp, toDateTime64(now64(6, 'UTC'), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$session_id`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$session_id`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$session_id`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.`$session_id`), '[]'), '{}'), toString(events.properties.`$session_id`)))))
HAVING 1
LIMIT 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.ambr
index 4ea12f7ea807..4651619c0ad0 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_hash
HAVING 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)), 9, '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_hash
HAVING 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)), 9, 'UTC')), notEmpty(events.`$session_id`))
GROUP BY events.`$session_id`) ARRAY
JOIN 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.ambr
index d504531b5c89..e67827a5c8b9 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_hash
HAVING 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(startsWith(dynamicType(accurateCast(events.properties.`$exception_fingerprint`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$exception_fingerprint`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$exception_fingerprint`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$exception_fingerprint`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$exception_fingerprint`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$exception_fingerprint`, 'Dynamic')), 'Tuple')), 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)), 9, '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_hash
HAVING 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(startsWith(dynamicType(accurateCast(events.properties.`$exception_fingerprint`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$exception_fingerprint`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$exception_fingerprint`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$exception_fingerprint`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$exception_fingerprint`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$exception_fingerprint`, 'Dynamic')), 'Tuple')), 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)), 9, 'UTC')), notEmpty(events.properties.`$session_id`))
GROUP BY events.properties.`$session_id`) ARRAY
JOIN 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.ambr
index ebe7b7f5d20b..06cbe5ddb3dc 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, 9, '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, 9, '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, 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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.ambr
index 0a9adcc1bf17..899d553401db 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(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$feature_flag`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$feature_flag`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$feature_flag_response`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$feature_flag_response`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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, 9, '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(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), if(isNull(nullIf(toString(events.properties.`$feature_flag`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$feature_flag`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$feature_flag`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$feature_flag_response`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$feature_flag_response`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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, 9, '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(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), if(isNull(nullIf(toString(events.properties.`$feature_flag`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$feature_flag`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$feature_flag`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$feature_flag_response`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$feature_flag_response`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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, 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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.ambr
index 290c4cd4b9f6..25226b1991b4 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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 value
FROM 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)), 9, '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 value
FROM 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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 value
FROM 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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 value
FROM 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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.ambr
index 60549b9722a3..1ae253e7b5c4 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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 value
FROM 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)), 9, '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(events.properties.amount, 'Float64'), 0) AS value
FROM 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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(startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.plan, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.plan), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.plan, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.plan), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'Tuple')), 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,
@@ -374,7 +374,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, '$pageview'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -1614,7 +1614,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, '$pageview'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -1679,7 +1679,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, '$pageview'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -1741,7 +1741,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, '$pageview'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -1806,7 +1806,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, '$pageview'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -1868,7 +1868,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, '$pageview'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -1938,7 +1938,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, '$pageview'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -2000,7 +2000,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, '$pageview'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -2062,7 +2062,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, '$pageview'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -2124,7 +2124,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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(startsWith(dynamicType(accurateCast(events.properties.test_property, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.test_property, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.test_property), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.test_property, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.test_property, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.test_property, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(events.properties.test_property, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.test_property, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.test_property), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.test_property, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.test_property, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.test_property, 'Dynamic')), 'Tuple')), 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,
@@ -2186,7 +2186,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, 'purchase'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -2248,7 +2248,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, 'purchase'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -2310,7 +2310,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, 'purchase'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -2372,7 +2372,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, 'purchase'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -2420,7 +2420,7 @@
toTimeZone(events.timestamp, 'UTC') AS timestamp,
1 AS value
FROM 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)), 9, 'UTC')), equals(events.event, 'purchase'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -2482,7 +2482,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, 'purchase'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -2544,7 +2544,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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.ambr
index 824de407ac50..dc0e64bb6c5a 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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 value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, '$pageview'))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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 value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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.ambr
index 66de13b0c1e5..5cd819d390fd 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
@@ -69,7 +69,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), or(and(greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-01 12:00:00', 'UTC'))), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2020-01-15 12:00:00', 'UTC'))), and(equals(events.event, '$feature_flag_called'), ifNull(equals(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(events.properties.^`$feature_flag`)), if(isNull(nullIf(toString(events.properties.`$feature_flag`), '')), NULL, if(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$feature_flag`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$feature_flag`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$feature_flag_response`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$feature_flag_response`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$feature_flag`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$feature_flag`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$feature_flag_response`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$feature_flag_response`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Tuple')), 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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 value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, '$pageview'))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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 value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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.ambr
index 7ea641b50073..36df46008b05 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_id
FROM 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)), 9, 'UTC')))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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, 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
FROM 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)), 9, '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_id
FROM 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)), 9, 'UTC')))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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, 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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.ambr
index 98ae3b0cb10a..1e218666ce8b 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
@@ -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_id
FROM 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)), 9, 'UTC')))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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, 9, '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 value
FROM denominator_events
JOIN 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'), 9, 'UTC'))
GROUP BY exposures.entity_id),
entity_metrics AS
(SELECT exposures.variant AS variant,
@@ -1435,7 +1435,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_id
FROM 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)), 9, 'UTC')))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -1505,20 +1505,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_id
FROM 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)), 9, 'UTC')))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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, 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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.ambr
index b6f53ce5a0a5..add4d784a02f 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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.ambr
index f341a33d6387..d4d1cab98c3c 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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.ambr
index 8b542139d8f4..7dfb202c5b8a 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 value
FROM base_events
INNER 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'), 9, '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 value
FROM base_events
INNER 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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 value
FROM base_events
INNER 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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.ambr
index ad4c78df371c..43cf06a650b1 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
@@ -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 value
FROM base_events
INNER 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'), 9, 'UTC'))
GROUP BY base_events.entity_id)
SELECT entity_metrics.variant AS variant,
count(entity_metrics.entity_id) AS num_users,
@@ -228,7 +228,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 value
FROM base_events
INNER 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$feature_flag`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$feature_flag`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$feature_flag_response`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$feature_flag_response`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$feature_flag`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$feature_flag`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$feature_flag_response`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$feature_flag_response`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Tuple')), 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)), 9, '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 value
FROM base_events
INNER 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$feature_flag`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$feature_flag`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$feature_flag_response`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$feature_flag_response`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$feature_flag`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$feature_flag`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$feature_flag_response`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$feature_flag_response`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Tuple')), 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$feature_flag`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$feature_flag`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$feature_flag_response`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$feature_flag_response`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$feature_flag`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$feature_flag`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$feature_flag_response`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$feature_flag_response`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$feature_flag_response`, 'Dynamic')), 'Tuple')), 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)), 9, '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.ambr
index e1ce65af49ea..0854e70f080e 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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 value
FROM 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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.ambr
index 0ef19df0ceaa..f692ae0a3640 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, 'purchase'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -753,7 +753,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, 'purchase'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -815,7 +815,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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.ambr
index ab782ea912cb..a7ddcb007d93 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, 'purchase'))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, 'purchase'))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, 'purchase'))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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'), 9, 'UTC')), less(numerator_events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(604800)), 9, '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 value
FROM denominator_events
JOIN 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'), 9, 'UTC')), less(denominator_events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(604800)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, 'UTC')), equals(events.event, 'pageview'))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, 'UTC')), equals(events.event, 'pageview'))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, 'UTC')), equals(events.event, 'pageview'))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, 'UTC')), equals(events.event, 'pageview'))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, 'UTC')), equals(events.event, 'pageview'))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
coalesce(avg(accurateCastOrNull(numerator_events.value, 'Float64')), 0) AS value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, 'UTC')), equals(events.event, 'purchase'))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, 'UTC')), equals(events.event, 'pageview'))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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'), 9, 'UTC')), less(numerator_events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(3600)), 9, '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 value
FROM denominator_events
JOIN 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'), 9, 'UTC')), less(denominator_events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(3600)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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 value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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 value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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.ambr
index 06b016bebd5b..34c76918ab5e 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, 'purchase'))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, 'purchase'))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, 'purchase'))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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'), 9, 'UTC')), less(numerator_events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(604800)), 9, '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 value
FROM denominator_events
JOIN 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'), 9, 'UTC')), less(denominator_events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(604800)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, 'UTC')), equals(events.event, 'pageview'))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, 'UTC')), equals(events.event, 'pageview'))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, 'UTC')), equals(events.event, 'pageview'))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, 'UTC')), equals(events.event, 'pageview'))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, 'UTC')), equals(events.event, 'pageview'))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
coalesce(avg(accurateCastOrNull(numerator_events.value, 'Float64')), 0) AS value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, 'UTC')), equals(events.event, 'purchase'))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, 'UTC')), equals(events.event, 'pageview'))),
numerator_agg AS
(SELECT exposures.entity_id AS entity_id,
sum(coalesce(accurateCastOrNull(numerator_events.value, 'Float64'), 0)) AS value
FROM numerator_events
JOIN 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'), 9, 'UTC')), less(numerator_events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(3600)), 9, '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 value
FROM denominator_events
JOIN 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'), 9, 'UTC')), less(denominator_events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(3600)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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 value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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 value
FROM numerator_events
JOIN 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'), 9, '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 value
FROM denominator_events
JOIN 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'), 9, '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.ambr
index 68193426f9fe..c36c216be0f3 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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 uuid
FROM 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)), 9, 'UTC')))) AS events
INNER JOIN exposures ON equals(events.entity_id, exposures.entity_id)
- WHERE greaterOrEquals(events.timestamp, exposures.first_exposure_time)
+ WHERE ifNull(greaterOrEquals(toDateTime64(events.timestamp, 9, '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_timestamp
FROM 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), and(greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, 'UTC')), lessOrEquals(events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(259200)), 9, 'UTC'))))
GROUP BY exposures.entity_id
HAVING 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, 'UTC')))
GROUP BY exposures.entity_id
HAVING 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, 'UTC')))
GROUP BY exposures.entity_id
HAVING 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'session_start')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'app_open')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'action_performed')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), and(greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, 'UTC')), lessOrEquals(events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(7200)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, '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.ambr
index 287b153b9d37..1fb6407d949b 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, 'login'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -111,7 +111,7 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), and(greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, 'UTC')), lessOrEquals(events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(259200)), 9, 'UTC'))))
GROUP BY exposures.entity_id
HAVING lessOrEquals(plus(min(toTimeZone(events.timestamp, 'UTC')), toIntervalSecond(604800)), parseDateTime64BestEffortOrNull('2020-01-25 12:00:00', 6, 'UTC'))),
completion_events AS
@@ -126,7 +126,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, 'login'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -192,7 +192,7 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, 'UTC')))
GROUP BY exposures.entity_id
HAVING lessOrEquals(plus(min(toTimeZone(events.timestamp, 'UTC')), toIntervalSecond(604800)), parseDateTime64BestEffortOrNull('2020-01-25 12:00:00', 6, 'UTC'))),
completion_events AS
@@ -207,7 +207,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, 'login'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -278,7 +278,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, 'return_visit'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -344,7 +344,7 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, 'UTC')))
GROUP BY exposures.entity_id
HAVING lessOrEquals(plus(min(toTimeZone(events.timestamp, 'UTC')), toIntervalSecond(604800)), parseDateTime64BestEffortOrNull('2020-01-25 12:00:00', 6, 'UTC'))),
completion_events AS
@@ -359,7 +359,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, 'login'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -430,7 +430,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), 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)), 9, 'UTC')), equals(events.event, 'return_visit'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -496,7 +496,7 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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,
@@ -510,7 +510,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, 'UTC')), equals(events.event, 'first_action'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -581,7 +581,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, 'entered_experiment'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -647,7 +647,7 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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,
@@ -661,7 +661,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, 'UTC')), equals(events.event, 'purchase'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -727,7 +727,7 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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,
@@ -741,7 +741,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, 'UTC')), equals(events.event, 'purchase'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -807,7 +807,7 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'session_start')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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,
@@ -821,7 +821,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, 'UTC')), equals(events.event, 'key_action'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -887,7 +887,7 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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,
@@ -901,7 +901,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, 'UTC')), equals(events.event, 'purchase'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -967,7 +967,7 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'app_open')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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,
@@ -981,7 +981,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, 'UTC')), equals(events.event, 'feature_used'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -1047,7 +1047,7 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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,
@@ -1061,7 +1061,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, 'UTC')), equals(events.event, 'purchase'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -1127,7 +1127,7 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'action_performed')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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,
@@ -1141,7 +1141,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override 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)), 9, 'UTC')), equals(events.event, 'action_performed'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -1207,7 +1207,7 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, '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,
@@ -1221,7 +1221,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) 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)), 9, 'UTC')), equals(events.event, 'return_visit'))),
entity_metrics AS
(SELECT exposures.entity_id AS entity_id,
exposures.variant AS variant,
@@ -1287,7 +1287,7 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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)), 9, 'UTC')), equals(events.event, 'signup')), and(greaterOrEquals(events.timestamp, toDateTime64(toTimeZone(exposures.first_exposure_time, 'UTC'), 9, 'UTC')), lessOrEquals(events.timestamp, toDateTime64(plus(toTimeZone(exposures.first_exposure_time, 'UTC'), toIntervalSecond(7200)), 9, '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,
@@ -1301,7 +1301,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, assumeNotNull(toDateTime('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)), 9, '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.ambr
index fdfc9b1ae069..b7dd01ed14ab 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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 AS
diff --git a/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_session_properties.new_events_schema.ambr b/products/experiments/backend/hogql_queries/test/experiment_query_runner/__snapshots__/test_session_properties.new_events_schema.ambr
index 0cac876f322b..6b7caac811b5 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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 AS
diff --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.ambr
index 0abad9a9913e..bbf8f0ddb139 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)), 9, %(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)), 9, %(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)), 9, %(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 ALL
SELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priority
FROM (
- 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_priority
FROM (
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_v7
FROM raw_sessions
WHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (
SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7
FROM 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)), 9, %(hogql_val_19)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 9, %(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_v7
HAVING 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 d
GROUP 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_count
FROM events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -159,11 +159,11 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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_at
FROM 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_conversion
FROM events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -171,7 +171,7 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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 touchpoints
FROM (
@@ -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 touchpoints
FROM (
- 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_bound
FROM 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_conversion
FROM 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 ALL
SELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priority
FROM (
- 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_priority
FROM (
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_v7
FROM raw_sessions
WHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (
SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7
FROM 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)), 9, %(hogql_val_18)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 9, %(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_v7
HAVING 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 d
GROUP 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_count
FROM events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -234,11 +234,11 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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_at
FROM 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_conversion
FROM events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -246,7 +246,7 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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 touchpoints
FROM (
@@ -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 touchpoints
FROM (
- 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_bound
FROM 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_conversion
FROM 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 ALL
SELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priority
FROM (
- 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_priority
FROM (
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_v7
FROM raw_sessions
WHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (
SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7
FROM 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)), 9, %(hogql_val_135)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 9, %(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_v7
HAVING 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 d
GROUP 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_count
FROM events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -309,11 +309,11 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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_at
FROM 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_conversion
FROM events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -321,7 +321,7 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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 touchpoints
FROM (
@@ -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 touchpoints
FROM (
- 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_bound
FROM 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_conversion
FROM 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.ambr
index 50f061f38411..b2029686bbd3 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)), 9, %(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)), 9, %(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)), 9, %(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 ALL
SELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priority
FROM (
- 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_priority
FROM (
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_v7
FROM raw_sessions
WHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (
SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7
FROM 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)), 9, %(hogql_val_19)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 9, %(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_v7
HAVING 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 d
GROUP 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_count
FROM events_json AS events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -159,11 +159,11 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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_at
FROM 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_conversion
FROM events_json AS events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -171,7 +171,7 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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 touchpoints
FROM (
@@ -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 touchpoints
FROM (
- 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_bound
FROM 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_conversion
FROM 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 ALL
SELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priority
FROM (
- 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_priority
FROM (
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_v7
FROM raw_sessions
WHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (
SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7
FROM 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)), 9, %(hogql_val_18)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 9, %(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_v7
HAVING 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 d
GROUP 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_count
FROM events_json AS events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -234,11 +234,11 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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_at
FROM 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_conversion
FROM events_json AS events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -246,7 +246,7 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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 touchpoints
FROM (
@@ -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 touchpoints
FROM (
- 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_bound
FROM 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_conversion
FROM 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 ALL
SELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priority
FROM (
- 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_priority
FROM (
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_v7
FROM raw_sessions
WHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (
SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7
FROM 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)), 9, %(hogql_val_135)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 9, %(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_v7
HAVING 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 d
GROUP 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_count
FROM events_json AS events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -309,11 +309,11 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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_at
FROM 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_conversion
FROM events_json AS events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -321,7 +321,7 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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 touchpoints
FROM (
@@ -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 touchpoints
FROM (
- 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_bound
FROM 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_conversion
FROM 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.ambr
index 76cd5a584a11..104f7aaa11de 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_sessions
WHERE 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)), 9, %(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 touchpoints
FROM 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_v7
FROM 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_id
FROM person_distinct_id_overrides
WHERE equals(person_distinct_id_overrides.team_id, 420)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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_conversion
FROM events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -36,12 +36,12 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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)), 9, %(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_position
FROM 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_position
FROM 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_value
FROM per_conversion_dim
GROUP 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_key
FROM 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_key
FROM per_conversion)
@@ -77,21 +77,21 @@
FROM raw_sessions
WHERE 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)), 9, %(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 touchpoints
FROM 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_v7
FROM 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_id
FROM person_distinct_id_overrides
WHERE equals(person_distinct_id_overrides.team_id, 420)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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_conversion
FROM events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -99,12 +99,12 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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)), 9, %(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_position
FROM 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_position
FROM 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_value
FROM per_conversion_dim
GROUP 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_key
FROM 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_key
FROM per_conversion)
@@ -140,21 +140,21 @@
FROM raw_sessions
WHERE 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)), 9, %(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 touchpoints
FROM 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_v7
FROM 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_id
FROM person_distinct_id_overrides
WHERE equals(person_distinct_id_overrides.team_id, 420)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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_conversion
FROM events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -162,12 +162,12 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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)), 9, %(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_position
FROM 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_position
FROM 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_value
FROM per_conversion_dim
GROUP 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_key
FROM 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_key
FROM 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 ALL
SELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priority
FROM (
- 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_priority
FROM (
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_v7
FROM raw_sessions
WHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (
SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7
FROM 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)), 9, %(hogql_val_19)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 9, %(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_v7
HAVING 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 d
GROUP 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_count
FROM events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -219,11 +219,11 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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_at
FROM 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_conversion
FROM events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -231,11 +231,11 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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 visitors
FROM (
- 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_value
FROM resolved_cached_sessions AS cached_sessions
WHERE 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 s
GROUP 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 touchpoints
FROM (
- 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_bound
FROM 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_conversion
FROM 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_position
FROM 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_position
FROM 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_value
FROM per_conversion_dim
GROUP 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_key
FROM 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_key
FROM 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 ALL
SELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priority
FROM (
- 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_priority
FROM (
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_v7
FROM raw_sessions
WHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (
SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7
FROM 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)), 9, %(hogql_val_18)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 9, %(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_v7
HAVING 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 d
GROUP 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_count
FROM events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -306,11 +306,11 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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_at
FROM 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_conversion
FROM events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -318,11 +318,11 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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 visitors
FROM (
- 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_value
FROM resolved_cached_sessions AS cached_sessions
WHERE 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 s
GROUP 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 touchpoints
FROM (
- 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_bound
FROM 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_conversion
FROM 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_position
FROM 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_position
FROM 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_value
FROM per_conversion_dim
GROUP 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_key
FROM 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_key
FROM 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 ALL
SELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priority
FROM (
- 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_priority
FROM (
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_v7
FROM raw_sessions
WHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (
SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7
FROM 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)), 9, %(hogql_val_135)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 9, %(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_v7
HAVING 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 d
GROUP 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_count
FROM events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -393,11 +393,11 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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_at
FROM 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_conversion
FROM events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -405,11 +405,11 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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 visitors
FROM (
- 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_value
FROM resolved_cached_sessions AS cached_sessions
WHERE 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 s
GROUP 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 touchpoints
FROM (
- 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_bound
FROM 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_conversion
FROM 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_position
FROM 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_position
FROM 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_value
FROM per_conversion_dim
GROUP 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_key
FROM 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_key
FROM 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.ambr
index 610a2df85408..0f41f3b3abbc 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_sessions
WHERE 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)), 9, %(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 touchpoints
FROM 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_v7
FROM 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_id
FROM person_distinct_id_overrides
WHERE equals(person_distinct_id_overrides.team_id, 420)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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_conversion
FROM events_json AS events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -36,12 +36,12 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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)), 9, %(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_position
FROM 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_position
FROM 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_value
FROM per_conversion_dim
GROUP 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_key
FROM 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_key
FROM per_conversion)
@@ -77,21 +77,21 @@
FROM raw_sessions
WHERE 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)), 9, %(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 touchpoints
FROM 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_v7
FROM 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_id
FROM person_distinct_id_overrides
WHERE equals(person_distinct_id_overrides.team_id, 420)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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_conversion
FROM events_json AS events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -99,12 +99,12 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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)), 9, %(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_position
FROM 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_position
FROM 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_value
FROM per_conversion_dim
GROUP 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_key
FROM 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_key
FROM per_conversion)
@@ -140,21 +140,21 @@
FROM raw_sessions
WHERE 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)), 9, %(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 touchpoints
FROM 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_v7
FROM 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_id
FROM person_distinct_id_overrides
WHERE equals(person_distinct_id_overrides.team_id, 420)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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_conversion
FROM events_json AS events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -162,12 +162,12 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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)), 9, %(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_position
FROM 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_position
FROM 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_value
FROM per_conversion_dim
GROUP 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_key
FROM 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_key
FROM 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 ALL
SELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priority
FROM (
- 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_priority
FROM (
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_v7
FROM raw_sessions
WHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (
SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7
FROM 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)), 9, %(hogql_val_19)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 9, %(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_v7
HAVING 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 d
GROUP 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_count
FROM events_json AS events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -219,11 +219,11 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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_at
FROM 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_conversion
FROM events_json AS events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -231,11 +231,11 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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 visitors
FROM (
- 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_value
FROM resolved_cached_sessions AS cached_sessions
WHERE 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 s
GROUP 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 touchpoints
FROM (
- 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_bound
FROM 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_conversion
FROM 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_position
FROM 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_position
FROM 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_value
FROM per_conversion_dim
GROUP 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_key
FROM 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_key
FROM 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 ALL
SELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priority
FROM (
- 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_priority
FROM (
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_v7
FROM raw_sessions
WHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (
SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7
FROM 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)), 9, %(hogql_val_18)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 9, %(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_v7
HAVING 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 d
GROUP 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_count
FROM events_json AS events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -306,11 +306,11 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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_at
FROM 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_conversion
FROM events_json AS events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -318,11 +318,11 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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 visitors
FROM (
- 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_value
FROM resolved_cached_sessions AS cached_sessions
WHERE 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 s
GROUP 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 touchpoints
FROM (
- 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_bound
FROM 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_conversion
FROM 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_position
FROM 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_position
FROM 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_value
FROM per_conversion_dim
GROUP 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_key
FROM 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_key
FROM 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 ALL
SELECT session_id_v7 AS session_id_v7, dimensions AS dimensions, computed_at AS computed_at, source_priority AS source_priority
FROM (
- 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_priority
FROM (
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_v7
FROM raw_sessions
WHERE and(equals(raw_sessions.team_id, 420), globalIn(raw_sessions.session_id_v7, (
SELECT DISTINCT raw_sessions.session_id_v7 AS session_id_v7
FROM 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)), 9, %(hogql_val_135)s)), greater(raw_sessions.max_timestamp, toDateTime64(plus(fromUnixTimestamp(intDiv(toUInt64(bitShiftRight(raw_sessions.session_id_v7, 80)), 1000)), toIntervalSecond(172800)), 9, %(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_v7
HAVING 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 d
GROUP 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_count
FROM events_json AS events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -393,11 +393,11 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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_at
FROM 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_conversion
FROM events_json AS events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -405,11 +405,11 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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 visitors
FROM (
- 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_value
FROM resolved_cached_sessions AS cached_sessions
WHERE 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 s
GROUP 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 touchpoints
FROM (
- 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_bound
FROM 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_conversion
FROM 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_position
FROM 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_position
FROM 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_value
FROM per_conversion_dim
GROUP 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_key
FROM 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_key
FROM 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.ambr
index ad8f8dc3dada..900a50007e08 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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)), 9, %(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_index
FROM events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -158,14 +158,14 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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_id
FROM 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_size
FROM acquisition
GROUP 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 count
FROM acquisition INNER JOIN activity ON equals(activity.actor_id, acquisition.actor_id)
GROUP BY acquisition.breakdown_value, cohort_index, intervals_from_base
HAVING and(ifNull(greaterOrEquals(intervals_from_base, 0), 0), ifNull(less(intervals_from_base, 4), 0))), folded_sizes AS (
@@ -174,7 +174,7 @@
FROM cohort_sizes
GROUP BY cohort_sizes.breakdown_value
ORDER 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_size
FROM cohort_sizes
GROUP BY breakdown_value, cohort_sizes.cohort_index), folded_matrix AS (
SELECT if(globalIn(matrix.breakdown_value, (
@@ -182,7 +182,7 @@
FROM cohort_sizes
GROUP BY cohort_sizes.breakdown_value
ORDER 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 count
FROM matrix
GROUP 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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)), 9, %(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_index
FROM events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -227,14 +227,14 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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_id
FROM 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_size
FROM acquisition
GROUP 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 count
FROM acquisition INNER JOIN activity ON equals(activity.actor_id, acquisition.actor_id)
GROUP BY acquisition.breakdown_value, cohort_index, intervals_from_base
HAVING and(ifNull(greaterOrEquals(intervals_from_base, 0), 0), ifNull(less(intervals_from_base, 4), 0))), folded_sizes AS (
@@ -243,7 +243,7 @@
FROM cohort_sizes
GROUP BY cohort_sizes.breakdown_value
ORDER 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_size
FROM cohort_sizes
GROUP BY breakdown_value, cohort_sizes.cohort_index), folded_matrix AS (
SELECT if(globalIn(matrix.breakdown_value, (
@@ -251,7 +251,7 @@
FROM cohort_sizes
GROUP BY cohort_sizes.breakdown_value
ORDER 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 count
FROM matrix
GROUP 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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)), 9, %(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_index
FROM events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -296,14 +296,14 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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_id
FROM 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_size
FROM acquisition
GROUP 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 count
FROM acquisition INNER JOIN activity ON equals(activity.actor_id, acquisition.actor_id)
GROUP BY acquisition.breakdown_value, cohort_index, intervals_from_base
HAVING and(ifNull(greaterOrEquals(intervals_from_base, 0), 0), ifNull(less(intervals_from_base, 4), 0))), folded_sizes AS (
@@ -312,7 +312,7 @@
FROM cohort_sizes
GROUP BY cohort_sizes.breakdown_value
ORDER 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_size
FROM cohort_sizes
GROUP BY breakdown_value, cohort_sizes.cohort_index), folded_matrix AS (
SELECT if(globalIn(matrix.breakdown_value, (
@@ -320,7 +320,7 @@
FROM cohort_sizes
GROUP BY cohort_sizes.breakdown_value
ORDER 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 count
FROM matrix
GROUP 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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)), 9, %(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_id
FROM 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_v7
FROM 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_id
FROM person_distinct_id_overrides
WHERE equals(person_distinct_id_overrides.team_id, 420)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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_id
FROM events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
@@ -438,23 +438,23 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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)), 9, %(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_at
FROM 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_v7
FROM 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_id
FROM person_distinct_id_overrides
WHERE equals(person_distinct_id_overrides.team_id, 420)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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_at
FROM 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_value
diff --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.ambr
index 155bcbb9af7e..3464b65e3c1e 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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)), 9, %(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_index
FROM events_json AS events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -33,14 +33,14 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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_id
FROM 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_size
FROM acquisition
GROUP 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 count
FROM acquisition INNER JOIN activity ON equals(activity.actor_id, acquisition.actor_id)
GROUP BY acquisition.breakdown_value, cohort_index, intervals_from_base
HAVING and(ifNull(greaterOrEquals(intervals_from_base, 0), 0), ifNull(less(intervals_from_base, 4), 0))), folded_sizes AS (
@@ -49,7 +49,7 @@
FROM cohort_sizes
GROUP BY cohort_sizes.breakdown_value
ORDER 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_size
FROM cohort_sizes
GROUP BY breakdown_value, cohort_sizes.cohort_index), folded_matrix AS (
SELECT if(globalIn(matrix.breakdown_value, (
@@ -57,7 +57,7 @@
FROM cohort_sizes
GROUP BY cohort_sizes.breakdown_value
ORDER 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 count
FROM matrix
GROUP 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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)), 9, %(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_index
FROM events_json AS events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -102,14 +102,14 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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_id
FROM 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_size
FROM acquisition
GROUP 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 count
FROM acquisition INNER JOIN activity ON equals(activity.actor_id, acquisition.actor_id)
GROUP BY acquisition.breakdown_value, cohort_index, intervals_from_base
HAVING and(ifNull(greaterOrEquals(intervals_from_base, 0), 0), ifNull(less(intervals_from_base, 4), 0))), folded_sizes AS (
@@ -118,7 +118,7 @@
FROM cohort_sizes
GROUP BY cohort_sizes.breakdown_value
ORDER 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_size
FROM cohort_sizes
GROUP BY breakdown_value, cohort_sizes.cohort_index), folded_matrix AS (
SELECT if(globalIn(matrix.breakdown_value, (
@@ -126,7 +126,7 @@
FROM cohort_sizes
GROUP BY cohort_sizes.breakdown_value
ORDER 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 count
FROM matrix
GROUP 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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)), 9, %(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_index
FROM events_json AS events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
FROM person_distinct_id_overrides
@@ -171,14 +171,14 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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_id
FROM 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_size
FROM acquisition
GROUP 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 count
FROM acquisition INNER JOIN activity ON equals(activity.actor_id, acquisition.actor_id)
GROUP BY acquisition.breakdown_value, cohort_index, intervals_from_base
HAVING and(ifNull(greaterOrEquals(intervals_from_base, 0), 0), ifNull(less(intervals_from_base, 4), 0))), folded_sizes AS (
@@ -187,7 +187,7 @@
FROM cohort_sizes
GROUP BY cohort_sizes.breakdown_value
ORDER 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_size
FROM cohort_sizes
GROUP BY breakdown_value, cohort_sizes.cohort_index), folded_matrix AS (
SELECT if(globalIn(matrix.breakdown_value, (
@@ -195,7 +195,7 @@
FROM cohort_sizes
GROUP BY cohort_sizes.breakdown_value
ORDER 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 count
FROM matrix
GROUP 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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)), 9, %(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_id
FROM 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_v7
FROM 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_id
FROM person_distinct_id_overrides
WHERE equals(person_distinct_id_overrides.team_id, 420)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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_id
FROM events_json AS events LEFT OUTER JOIN (
SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id
@@ -313,23 +313,23 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0)
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)), 9, %(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_at
FROM 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_v7
FROM 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_id
FROM person_distinct_id_overrides
WHERE equals(person_distinct_id_overrides.team_id, 420)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, 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_at
FROM 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_value
diff --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.ambr
index 84ce45af67f7..7ea416db0d59 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_id
HAVING 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, 9, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 9, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 9, '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), 9, 'UTC')), notIn(event.event, funnel_step_names), notIn(event.event, []))
GROUP BY name
LIMIT 100
UNION ALL
@@ -663,7 +663,7 @@
or isNotNull(target_step))) AS failure_count
FROM events AS event
JOIN 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, 9, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 9, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 9, '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), 9, 'UTC')), notIn(event.event, funnel_step_names), notIn(event.event, []))
GROUP BY name
LIMIT 100
UNION ALL
@@ -734,8 +734,8 @@
actor_id AS key
FROM events AS event
JOIN 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, 9, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 9, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 9, '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), 9, '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_id
ORDER BY actor_id ASC) AS source
ORDER BY source.actor_id ASC
@@ -803,8 +803,8 @@
actor_id AS key
FROM events AS event
JOIN 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, 9, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 9, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 9, '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), 9, '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_id
ORDER BY actor_id ASC) AS source
ORDER BY source.actor_id ASC
@@ -872,8 +872,8 @@
actor_id AS key
FROM events AS event
JOIN 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, 9, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 9, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 9, '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), 9, '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_id
ORDER BY actor_id ASC) AS source
ORDER BY source.actor_id ASC
@@ -941,8 +941,8 @@
actor_id AS key
FROM events AS event
JOIN 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, 9, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 9, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 9, '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), 9, '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_id
ORDER BY actor_id ASC) AS source
ORDER BY source.actor_id ASC
@@ -993,7 +993,7 @@
or isNotNull(target_step))) AS failure_count
FROM events AS event
JOIN 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, 9, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 9, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 9, '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), 9, 'UTC')), notIn(event.event, funnel_step_names), notIn(event.event, []))
GROUP BY name
LIMIT 100
UNION ALL
@@ -1064,8 +1064,8 @@
actor_id AS key
FROM events AS event
JOIN 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, 9, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 9, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 9, '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), 9, '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_id
ORDER BY actor_id ASC) AS source
ORDER BY source.actor_id ASC
@@ -1133,8 +1133,8 @@
actor_id AS key
FROM events AS event
JOIN 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, 9, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 9, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 9, '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), 9, '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_id
ORDER BY actor_id ASC) AS source
ORDER BY source.actor_id ASC
diff --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.ambr
index fa116734ee45..12b347ff4df9 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_id
HAVING 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, 9, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 9, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 9, '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), 9, 'UTC')), notIn(event.event, funnel_step_names), notIn(event.event, []))
GROUP BY name
LIMIT 100
UNION ALL
@@ -589,8 +589,8 @@
actor_id AS key
FROM events_json AS event
JOIN 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, 9, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 9, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 9, '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), 9, '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_id
ORDER BY actor_id ASC) AS source
ORDER BY source.actor_id ASC
@@ -658,8 +658,8 @@
actor_id AS key
FROM events_json AS event
JOIN 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, 9, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 9, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 9, '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), 9, '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_id
ORDER BY actor_id ASC) AS source
ORDER BY source.actor_id ASC
@@ -727,8 +727,8 @@
actor_id AS key
FROM events_json AS event
JOIN 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, 9, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 9, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 9, '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), 9, '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_id
ORDER BY actor_id ASC) AS source
ORDER BY source.actor_id ASC
@@ -796,8 +796,8 @@
actor_id AS key
FROM events_json AS event
JOIN 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, 9, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 9, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 9, '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), 9, '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_id
ORDER BY actor_id ASC) AS source
ORDER BY source.actor_id ASC
@@ -848,7 +848,7 @@
or isNotNull(target_step))) AS failure_count
FROM events_json AS event
JOIN 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, 9, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 9, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 9, '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), 9, 'UTC')), notIn(event.event, funnel_step_names), notIn(event.event, []))
GROUP BY name
LIMIT 100
UNION ALL
@@ -919,8 +919,8 @@
actor_id AS key
FROM events_json AS event
JOIN 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, 9, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 9, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 9, '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), 9, '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_id
ORDER BY actor_id ASC) AS source
ORDER BY source.actor_id ASC
@@ -988,8 +988,8 @@
actor_id AS key
FROM events_json AS event
JOIN 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, 9, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 9, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 9, '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), 9, '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_id
ORDER BY actor_id ASC) AS source
ORDER BY source.actor_id ASC
@@ -1035,7 +1035,7 @@
or isNotNull(target_step))) AS failure_count
FROM events_json AS event
JOIN 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, 9, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 9, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 9, '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), 9, 'UTC')), notIn(event.event, funnel_step_names), notIn(event.event, []))
GROUP BY name
LIMIT 100
UNION ALL
diff --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.ambr
index db86cc71386c..6e9e0720fcca 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_id
HAVING 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, 9, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 9, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 9, '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), 9, '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_id
ORDER BY actor_id ASC) AS source
ORDER BY source.id ASC
@@ -172,8 +172,8 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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, 9, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 9, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 9, '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), 9, '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_id
ORDER BY actor_id ASC) AS source
ORDER BY source.id ASC
diff --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.ambr
index faf0dbca2aff..c20fc66139bc 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_id
HAVING 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, 9, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 9, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 9, '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), 9, '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_id
ORDER BY actor_id ASC) AS source
ORDER BY source.id ASC
@@ -148,8 +148,8 @@
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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, 9, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 9, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 9, '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), 9, '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_id
ORDER BY actor_id ASC) AS source
ORDER BY source.id ASC
diff --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.ambr
index b5f658e8c512..ae4c0a4b9b81 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, 'US/Pacific')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, 'US/Pacific')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1)), 9, '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.ambr
index c500ce51679b..758ad9b9ac16 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$process_person_profile`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$process_person_profile`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$process_person_profile`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$process_person_profile`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Tuple')), 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)), 9, 'US/Pacific')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$process_person_profile`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$process_person_profile`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$process_person_profile`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$process_person_profile`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Tuple')), 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)), 9, 'US/Pacific')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1)), 9, '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.ambr
index 267d1024559a..90d58aab1764 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, 'UTC')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'UTC')), toIntervalDay(1)), toIntervalDay(1)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, 'UTC')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'UTC')), toIntervalDay(1)), toIntervalDay(1)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, 'UTC')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'UTC')), toIntervalDay(1)), toIntervalDay(1)), 9, '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, 'US/Pacific')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1)), 9, '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.ambr
index c4f84b85749e..3f8bf097b33c 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$process_person_profile`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$process_person_profile`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$process_person_profile`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$process_person_profile`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Tuple')), 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)), 9, 'UTC')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'UTC')), toIntervalDay(1)), toIntervalDay(1)), 9, '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)
@@ -127,7 +127,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), 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(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$process_person_profile`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$process_person_profile`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$process_person_profile`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$process_person_profile`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Tuple')), 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)), 9, 'UTC')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'UTC')), toIntervalDay(1)), toIntervalDay(1)), 9, 'UTC')), equals(events.event, '$pageview'))
GROUP BY actor_id)
GROUP BY start_of_period,
status)
@@ -201,7 +201,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$process_person_profile`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$process_person_profile`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$process_person_profile`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$process_person_profile`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Tuple')), 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)), 9, 'US/Pacific')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'US/Pacific')), toIntervalDay(1)), toIntervalDay(1)), 9, 'US/Pacific')), equals(events.event, '$pageview'))
GROUP BY actor_id)
GROUP BY start_of_period,
status)
@@ -275,7 +275,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), 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(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$process_person_profile`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$process_person_profile`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$process_person_profile`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$process_person_profile`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$process_person_profile`, 'Dynamic')), 'Tuple')), 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)), 9, 'UTC')), less(events.timestamp, toDateTime64(plus(toStartOfInterval(assumeNotNull(toDateTime('2020-01-19 23:59:59', 'UTC')), toIntervalDay(1)), toIntervalDay(1)), 9, '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.ambr
index 9e672fb96380..feedd34979bc 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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)), 9, '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) ARRAY
JOIN 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)), 9, '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) ARRAY
JOIN 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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)), 9,
+ '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)), 9,
+ '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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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.ambr
index 1119a049a9d8..1615118d2cdb 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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.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)), 9, '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) ARRAY
JOIN session_paths AS path_time_tuple,
@@ -947,7 +947,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)), 9, '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) ARRAY
JOIN session_paths AS path_time_tuple,
@@ -1042,7 +1042,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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN session_paths AS path_time_tuple,
@@ -2218,7 +2218,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN session_paths AS path_time_tuple,
@@ -2447,11 +2447,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)), 9,
+ '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)
@@ -2666,11 +2667,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)), 9,
+ '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)
@@ -2908,11 +2910,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)), 9,
+ '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)
@@ -3128,11 +3131,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)), 9,
+ '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)
@@ -3371,11 +3375,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)), 9,
+ '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)
@@ -3591,11 +3596,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)), 9,
+ '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)
@@ -3834,11 +3840,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)), 9,
+ '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)
@@ -4053,11 +4060,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)), 9,
+ '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)
@@ -4358,11 +4366,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)), 9,
+ '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)
@@ -4642,11 +4651,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)), 9,
+ '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)
@@ -4744,7 +4754,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN session_paths AS path_time_tuple,
@@ -4873,7 +4883,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN session_paths AS path_time_tuple,
@@ -4965,7 +4975,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN session_paths AS path_time_tuple,
@@ -5095,7 +5105,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN session_paths AS path_time_tuple,
@@ -5187,7 +5197,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN session_paths AS path_time_tuple,
@@ -5275,7 +5285,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN session_paths AS path_time_tuple,
@@ -5363,7 +5373,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN session_paths AS path_time_tuple,
@@ -5484,7 +5494,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN session_paths AS path_time_tuple,
@@ -5605,7 +5615,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN session_paths AS path_time_tuple,
@@ -5692,7 +5702,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN session_paths AS path_time_tuple,
@@ -5813,7 +5823,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN session_paths AS path_time_tuple,
@@ -5900,7 +5910,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN session_paths AS path_time_tuple,
@@ -6021,7 +6031,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN session_paths AS path_time_tuple,
@@ -6142,7 +6152,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN session_paths AS path_time_tuple,
@@ -6263,7 +6273,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN session_paths AS path_time_tuple,
@@ -6350,7 +6360,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN session_paths AS path_time_tuple,
@@ -6437,7 +6447,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN session_paths AS path_time_tuple,
@@ -6529,7 +6539,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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) ARRAY
JOIN 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.ambr
index 68c567873914..722b75879336 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_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)), 9, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-03-31 23:59:59', 'UTC'))), in(events.event, ['$pageview'])))
GROUP BY actor_id) ARRAY
JOIN elements AS element
GROUP BY kind,
@@ -115,7 +115,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), greaterOrEquals(events.timestamp, 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)), 9, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-03-31 23:59:59', 'UTC'))), in(events.event, ['$pageview'])))
GROUP BY actor_id) ARRAY
JOIN arrayFilter(pair -> in(pair, tuple(tuple(tuple('$pageview', '/'), tuple('$pageview', '/pricing')))), arrayDistinct(arrayFlatten(arrayMap(journey -> arrayZip(arrayPopBack(journey), arrayPopFront(journey)), collapsed_journeys)))) AS pair
GROUP BY pair
diff --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.ambr
index 375ed6922d37..a979bfb6db0d 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_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)), 9, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-03-31 23:59:59', 'UTC'))), in(events.event, ['$pageview'])))
GROUP BY actor_id) ARRAY
JOIN arrayFilter(pair -> in(pair, tuple(tuple(tuple('$pageview', '/'), tuple('$pageview', '/pricing')))), arrayDistinct(arrayFlatten(arrayMap(journey -> arrayZip(arrayPopBack(journey), arrayPopFront(journey)), collapsed_journeys)))) AS pair
GROUP BY pair
@@ -103,7 +103,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_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)), 9, 'UTC')), lessOrEquals(events.timestamp, assumeNotNull(toDateTime('2023-03-31 23:59:59', 'UTC'))), in(events.event, ['$pageview'])))
GROUP BY actor_id) ARRAY
JOIN elements AS element
GROUP 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.ambr
index 1e047db0d2c5..2abfec21d8ab 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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_events
GROUP BY actor_id
HAVING 1) AS actor_activity
@@ -80,7 +80,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), 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)), 9, '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_events
GROUP BY actor_id
HAVING 1) AS actor_activity
diff --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.ambr
index 7d5faf1af181..76b773201551 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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_events
GROUP BY actor_id
HAVING 1) AS actor_activity
@@ -80,7 +80,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), 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)), 9, '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_events
GROUP BY actor_id
HAVING 1) AS actor_activity
diff --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.ambr
index b0a7fff23aad..f224a41a7ae5 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 timestamp
FROM 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)), 9, '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_activity
GROUP 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_0
FROM 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)), 9, '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_t0
LEFT JOIN
(SELECT toString(posthog_test_warehouse_activity.person_id) AS actor_id,
toTimeZone(posthog_test_warehouse_activity.occurred_at, 'UTC') AS timestamp
FROM 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)), 9, '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_activity
GROUP 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.ambr
index 35c006f69837..012e61c446fd 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 timestamp
FROM 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)), 9, '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_activity
GROUP 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.ambr
index 4f6f776dd8c4..1565cd7d00b5 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_base
FROM 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), 9, '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_id
HAVING 1) AS actor_activity
GROUP 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_base
FROM 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), 9, '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_id
HAVING equals(start_interval_index, 0)) AS actor_activity
GROUP 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_base
FROM 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), 9, '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_id
HAVING 1) AS actor_activity
GROUP 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_base
FROM 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), 9, '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_id
HAVING 1) AS actor_activity
GROUP 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_base
FROM 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), 9, '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_id
HAVING equals(start_interval_index, 0)) AS actor_activity
GROUP 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_base
FROM 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), 9, '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_id
HAVING 1) AS actor_activity
GROUP 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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_id
HAVING 1) AS actor_activity
GROUP 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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_id
HAVING 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)), 9, '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, 9, 'UTC')))
GROUP BY actors_with_t0.actor_id,
actors_with_t0.t_0) AS actor_activity
GROUP 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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_id
HAVING 1) AS actor_activity
GROUP 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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_id
HAVING 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)), 9, '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, 9, 'UTC')))
GROUP BY actors_with_t0.actor_id,
actors_with_t0.t_0) AS actor_activity
GROUP 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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_id
HAVING 1) AS actor_activity
GROUP 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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_id
HAVING 1) AS actor_activity
GROUP 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('signed_up')), equals(events.event, 'signed_up'))
GROUP BY actor_id
UNION 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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_events
GROUP BY actor_id
HAVING 1) AS actor_activity
@@ -609,7 +609,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), equals(events.event, '$pageview'))
GROUP BY actor_id
UNION 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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_events
GROUP BY actor_id
HAVING 1) AS actor_activity
@@ -666,7 +666,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), 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)), 9, '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_id
HAVING 1) AS actor_activity
GROUP 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))))))
GROUP BY actor_id
HAVING 1) AS actor_activity
GROUP 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), equals(events.event, 'returning_event'))) AS events
GROUP BY actor_id
HAVING 1) AS actor_activity
GROUP 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), equals(events.event, 'returning_event'))) AS events
GROUP BY actor_id
HAVING 1) AS actor_activity
GROUP 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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_id
HAVING 1) AS actor_activity
GROUP 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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_id
HAVING 1) AS actor_activity
GROUP 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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_id
HAVING 1) AS actor_activity
GROUP 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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), 9, '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_id
HAVING 1) AS actor_activity
GROUP 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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), 9, '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_id
HAVING 1) AS actor_activity
GROUP 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.ambr
index 1d6a41e7afb6..bc8b98a461bd 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_base
FROM 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), 9, '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_id
HAVING equals(start_interval_index, 0)) AS actor_activity
GROUP BY actor_activity.actor_id) AS source
@@ -58,7 +58,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_base
FROM 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), 9, '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_id
HAVING 1) AS actor_activity
GROUP BY start_event_matching_interval,
@@ -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_base
FROM 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), 9, '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_id
HAVING 1) AS actor_activity
GROUP BY start_event_matching_interval,
@@ -137,7 +137,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_base
FROM 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), 9, '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_id
HAVING equals(start_interval_index, 0)) AS actor_activity
GROUP BY actor_activity.actor_id) AS source
@@ -172,7 +172,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_base
FROM 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), 9, '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_id
HAVING 1) AS actor_activity
GROUP BY start_event_matching_interval,
@@ -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_base
FROM 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), 9, '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_id
HAVING 1) AS actor_activity
GROUP BY start_event_matching_interval,
@@ -255,10 +255,10 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), 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)), 9, '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_id
HAVING 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)), 9, '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, 9, 'UTC')))
GROUP BY actors_with_t0.actor_id,
actors_with_t0.t_0) AS actor_activity
GROUP BY start_event_matching_interval,
@@ -299,7 +299,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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_id
HAVING 1) AS actor_activity
GROUP BY start_event_matching_interval,
@@ -348,10 +348,10 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), 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)), 9, '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_id
HAVING 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)), 9, '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, 9, 'UTC')))
GROUP BY actors_with_t0.actor_id,
actors_with_t0.t_0) AS actor_activity
GROUP BY start_event_matching_interval,
@@ -392,7 +392,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), 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)), 9, '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_id
HAVING 1) AS actor_activity
GROUP 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_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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_id
HAVING 1) AS actor_activity
GROUP BY start_event_matching_interval,
@@ -474,7 +474,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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_id
HAVING 1) AS actor_activity
GROUP BY start_event_matching_interval,
@@ -531,7 +531,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('signed_up')), equals(events.event, 'signed_up'))
GROUP BY actor_id
UNION ALL SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS actor_id,
[] AS start_event_timestamps,
@@ -546,7 +546,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), 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)), 9, '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_events
GROUP BY actor_id
HAVING 1) AS actor_activity
@@ -600,7 +600,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(events.event, tuple('$pageview')), equals(events.event, '$pageview'))
GROUP BY actor_id
UNION ALL SELECT if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS actor_id,
[] AS start_event_timestamps,
@@ -615,7 +615,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), 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)), 9, '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_events
GROUP BY actor_id
HAVING 1) AS actor_activity
@@ -657,7 +657,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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_id
HAVING 1) AS actor_activity
GROUP BY start_event_matching_interval,
@@ -702,7 +702,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), 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)), 9, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))))))
GROUP BY actor_id
HAVING 1) AS actor_activity
GROUP BY start_event_matching_interval,
@@ -810,7 +810,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)
- WHERE and(equals(events.team_id, 99999), 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)), 9, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), equals(events.event, 'returning_event'))) AS events
GROUP BY actor_id
HAVING 1) AS actor_activity
GROUP BY start_event_matching_interval,
@@ -873,7 +873,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, 'UTC')), less(events.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), equals(events.event, 'returning_event'))) AS events
GROUP BY actor_id
HAVING 1) AS actor_activity
GROUP BY start_event_matching_interval,
@@ -914,7 +914,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.person_properties.email, 'Dynamic')), 'Tuple')), 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_id
HAVING 1) AS actor_activity
GROUP BY start_event_matching_interval,
@@ -955,7 +955,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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_id
HAVING 1) AS actor_activity
GROUP BY start_event_matching_interval,
@@ -996,7 +996,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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)), 9, '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_id
HAVING 1) AS actor_activity
GROUP BY start_event_matching_interval,
@@ -1037,7 +1037,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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), 9, '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_id
HAVING 1) AS actor_activity
GROUP BY start_event_matching_interval,
@@ -1078,7 +1078,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS 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), 9, '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_id
HAVING 1) AS actor_activity
GROUP 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.ambr
index 073ae2e73cd1..e0494d5bb9c2 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_interval
FROM 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)), 9, '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_interval
HAVING greater(count(), 0))
@@ -64,7 +64,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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_interval
HAVING greater(count(), 0))
@@ -92,7 +92,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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_interval
HAVING 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.ambr
index b79949a4a974..29a540b98417 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_interval
FROM 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)), 9, '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_interval
HAVING greater(count(), 0))
@@ -64,7 +64,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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_interval
HAVING greater(count(), 0))
@@ -92,7 +92,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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_interval
HAVING 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.ambr
index 32bc4269e898..3e157c76c311 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_id
HAVING 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))
GROUP BY aggregation_target,
start_of_interval
HAVING greater(count(), 0))
@@ -53,7 +53,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))
GROUP BY aggregation_target,
start_of_interval
HAVING greater(count(), 0))
@@ -90,7 +90,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))
GROUP BY aggregation_target,
start_of_interval
HAVING greater(count(), 0))
@@ -127,7 +127,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))
GROUP BY aggregation_target,
start_of_interval
HAVING greater(count(), 0))
@@ -164,7 +164,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))
GROUP BY aggregation_target,
start_of_interval
HAVING greater(count(), 0))
@@ -201,7 +201,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))
GROUP BY aggregation_target,
start_of_interval
HAVING greater(count(), 0))
@@ -248,7 +248,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))
GROUP BY aggregation_target,
start_of_interval
HAVING greater(count(), 0))
@@ -342,7 +342,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-20 23:59:59', 'UTC'))), equals(e.event, '$pageview'))
GROUP BY aggregation_target,
start_of_interval
HAVING 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.ambr
index 1267fc3e9fed..a08a40cdd66e 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_id
HAVING 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))
GROUP BY aggregation_target,
start_of_interval
HAVING greater(count(), 0))
@@ -53,7 +53,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))
GROUP BY aggregation_target,
start_of_interval
HAVING greater(count(), 0))
@@ -90,7 +90,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))
GROUP BY aggregation_target,
start_of_interval
HAVING greater(count(), 0))
@@ -127,7 +127,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))
GROUP BY aggregation_target,
start_of_interval
HAVING greater(count(), 0))
@@ -164,7 +164,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))
GROUP BY aggregation_target,
start_of_interval
HAVING greater(count(), 0))
@@ -201,7 +201,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))
GROUP BY aggregation_target,
start_of_interval
HAVING greater(count(), 0))
@@ -248,7 +248,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-13 23:59:59', 'UTC'))), equals(e.event, '$pageview'))
GROUP BY aggregation_target,
start_of_interval
HAVING greater(count(), 0))
@@ -298,7 +298,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-20 23:59:59', 'UTC'))), equals(e.event, '$pageview'))
GROUP BY aggregation_target,
start_of_interval
HAVING 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.ambr
index 28101faa4bde..df486166e62a 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), equals(e.event, 'purchase'))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 12:00:00', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 10:05:00', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-10 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-31 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-03 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, '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_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-03 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), equals(e.event, 'other_event'))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-10 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, '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_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, '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_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-05 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -558,7 +558,7 @@
FROM raw_sessions
WHERE 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)), 9, '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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-07 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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.ambr
index 656b7905e258..71b5eec1fa52 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), equals(e.event, 'purchase'))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -36,7 +36,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -63,7 +63,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 12:00:00', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -90,7 +90,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 10:05:00', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -117,7 +117,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-10 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -144,7 +144,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-31 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -171,7 +171,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-03 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -198,7 +198,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -225,7 +225,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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(startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.person_properties.email), '[]'), '{}'), toString(e.person_properties.email)))))), '%@posthog.com%'), 1))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -252,7 +252,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-03 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -279,7 +279,7 @@
max(accurateCastOrNull(e.properties.other_prop, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.other_prop, 'Float64')) AS mean_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), equals(e.event, 'other_event'))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -306,7 +306,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -333,7 +333,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -360,7 +360,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-10 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -387,7 +387,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -414,7 +414,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -441,7 +441,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.properties.`$browser`), '[]'), '{}'), toString(e.properties.`$browser`))))), 'Chrome'), 0))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -468,7 +468,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.properties.`$browser`), '[]'), '{}'), toString(e.properties.`$browser`))))), 'Firefox'), 0))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -495,7 +495,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -522,7 +522,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-05 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -558,7 +558,7 @@
FROM raw_sessions
WHERE 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)), 9, '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
@@ -587,7 +587,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-07 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -614,7 +614,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -641,7 +641,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -668,7 +668,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -695,7 +695,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -722,7 +722,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 100 SETTINGS readonly=2,
@@ -749,7 +749,7 @@
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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_val
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
ORDER BY day_start ASC
LIMIT 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.ambr
index c8f47a8aff7e..e4abfb86eb67 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 total
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))
ORDER BY 1 DESC
LIMIT 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 total
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session error'))
ORDER BY 1 DESC
LIMIT 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_value
FROM 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)), 9, '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_value
FROM 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)), 9, '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_value
FROM 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)), 9, '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_value
ORDER 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_value
FROM 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)), 9, '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_value
ORDER BY breakdown_value ASC)
@@ -241,7 +241,7 @@
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,
toString(0) AS breakdown_value
FROM 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)), 9, '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_value
FROM 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)), 9, '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_id
HAVING 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)), 9, '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_id
HAVING 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)), 9, '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_value
FROM 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)), 9, '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_value
FROM 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)), 9, '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_value
FROM 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)), 9, '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_value
FROM 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)), 9, '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_value
FROM 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)), 9, '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_value
FROM 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)), 9, '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 total
FROM 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)), 9, '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 DESC
LIMIT 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 total
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))
ORDER BY 1 DESC
LIMIT 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_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -791,7 +791,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -955,7 +955,7 @@
FROM raw_sessions
WHERE 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)), 9, '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_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1026,7 +1026,7 @@
FROM raw_sessions
WHERE 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1057,7 +1057,7 @@
(SELECT count(DISTINCT e.`$session_id`) AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1094,7 +1094,7 @@
FROM raw_sessions
WHERE 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1131,7 +1131,7 @@
FROM raw_sessions
WHERE 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)), 9, '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_start
ORDER 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.ambr
index 1b3189e6990c..25e5b48986cc 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 total
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session error'))
ORDER BY 1 DESC
LIMIT 50000 SETTINGS readonly=2,
max_execution_time=60,
@@ -23,7 +23,7 @@
'''
SELECT ifNull(sum(accurateCastOrNull(e.properties.xyz, 'Float64')), 0) AS total
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))
ORDER BY 1 DESC
LIMIT 50000 SETTINGS readonly=2,
max_execution_time=60,
@@ -59,7 +59,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(startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.location, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.location), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.properties.location), '[]'), '{}'), toString(e.properties.location)))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value
FROM 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)), 9, '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(if(notEquals(JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^location)), '{}'), JSONStripEmptyStringsAndNulls(toJSONString(e.properties.^location)), if(isNull(nullIf(toString(e.properties.location), '')), NULL, if(startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.location, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.location), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.properties.location), '[]'), '{}'), toString(e.properties.location)))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value
FROM 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)), 9, '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(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(startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.location, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.location), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.properties.location), '[]'), '{}'), toString(e.properties.location)))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value
FROM 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)), 9, '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_value
ORDER BY breakdown_value ASC)
@@ -187,7 +187,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(startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.location, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.location), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.properties.location), '[]'), '{}'), toString(e.properties.location)))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value
FROM 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)), 9, '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_value
ORDER BY breakdown_value ASC)
@@ -231,7 +231,7 @@
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,
toString(0) AS breakdown_value
FROM 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)), 9, '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,
@@ -284,10 +284,10 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS 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)), 9, '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,
@@ -340,10 +340,10 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS 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)), 9, '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,
@@ -389,7 +389,7 @@
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,
toString(0) AS breakdown_value
FROM 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)), 9, '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,
@@ -435,7 +435,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(startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.`$some_prop`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.`$some_prop`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.location, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.location), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.properties.location), '[]'), '{}'), toString(e.properties.location)))))), ''))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value
FROM 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)), 9, '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,
@@ -481,7 +481,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(startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.`$some_prop`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.`$some_prop`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.location, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.location), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.properties.location), '[]'), '{}'), toString(e.properties.location)))))), ''))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value
FROM 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)), 9, '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,
@@ -527,7 +527,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(startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.location, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.location), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.properties.location), '[]'), '{}'), toString(e.properties.location)))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value
FROM 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)), 9, '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,
@@ -573,7 +573,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(startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.location, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.location), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.properties.location), '[]'), '{}'), toString(e.properties.location)))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value
FROM 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)), 9, '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,
@@ -619,7 +619,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(startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.location, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.location), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.properties.location), '[]'), '{}'), toString(e.properties.location)))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value
FROM 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)), 9, '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,
@@ -665,7 +665,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(startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.location, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.location), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.location, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.properties.location), '[]'), '{}'), toString(e.properties.location)))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value
FROM 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)), 9, '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,
@@ -695,7 +695,7 @@
'''
SELECT ifNull(sum(accurateCastOrNull(e.properties.xyz, 'Float64')), 0) AS total
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))), equals(e.event, 'session start'))
ORDER BY 1 DESC
LIMIT 50000 SETTINGS readonly=2,
max_execution_time=60,
@@ -715,7 +715,7 @@
'''
SELECT ifNull(accurateCastOrNull(sum(accurateCastOrNull(e.properties.xyz, 'Float64')), 'Float64'), 0) AS total
FROM 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)), 9, '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 DESC
LIMIT 50000 SETTINGS readonly=2,
max_execution_time=60,
@@ -750,7 +750,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -781,7 +781,7 @@
(SELECT count(DISTINCT e.properties.`$session_id`) AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -936,7 +936,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -976,7 +976,7 @@
FROM raw_sessions
WHERE 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)), 9, '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)
@@ -1010,7 +1010,7 @@
(SELECT count(DISTINCT e.properties.`$session_id`) AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1047,7 +1047,7 @@
FROM raw_sessions
WHERE 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1084,7 +1084,7 @@
FROM raw_sessions
WHERE 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1121,7 +1121,7 @@
FROM raw_sessions
WHERE 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)), 9, '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_start
ORDER 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.ambr
index ca1c43081a0b..dd00abe15c56 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_value
FROM 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)), 9, '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_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -139,7 +139,7 @@
(SELECT count() AS total,
toStartOfMonth(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -170,7 +170,7 @@
(SELECT count() AS total,
toStartOfHour(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -201,7 +201,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -232,7 +232,7 @@
(SELECT count() AS total,
toStartOfMonth(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -314,7 +314,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -345,7 +345,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'US/Pacific')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -376,7 +376,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -407,7 +407,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -438,7 +438,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -469,7 +469,7 @@
(SELECT count() AS total,
toStartOfMonth(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -500,7 +500,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -538,7 +538,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -569,7 +569,7 @@
(SELECT count() AS total,
toStartOfWeek(toTimeZone(e.timestamp, 'UTC'), 0) AS day_start
FROM 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)), 9, '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_start
ORDER 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.ambr
index cf2481bca35b..629953ba5c41 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
@@ -70,7 +70,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(startsWith(dynamicType(accurateCast(e.properties.plan, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.plan, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.plan), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.plan, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.plan, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.plan, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.properties.plan), '[]'), '{}'), toString(e.properties.plan)))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value
FROM 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)), 9, '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_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -139,7 +139,7 @@
(SELECT count() AS total,
toStartOfMonth(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -170,7 +170,7 @@
(SELECT count() AS total,
toStartOfHour(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -201,7 +201,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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(startsWith(dynamicType(accurateCast(e.properties.plan, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.plan, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.plan), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.plan, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.plan, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.plan, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(e.properties.plan, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.plan, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.plan), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.plan, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.plan, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.plan, 'Dynamic')), 'Tuple')), 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_start
ORDER BY day_start ASC)
@@ -232,7 +232,7 @@
(SELECT count() AS total,
toStartOfMonth(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -314,7 +314,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -345,7 +345,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'US/Pacific')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -376,7 +376,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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(startsWith(dynamicType(accurateCast(e.properties.plan, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.plan, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.plan), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.plan, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.plan, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.plan, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(e.properties.plan, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.plan, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.plan), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.plan, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.plan, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.plan, 'Dynamic')), 'Tuple')), 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_start
ORDER BY day_start ASC)
@@ -407,7 +407,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -438,7 +438,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -469,7 +469,7 @@
(SELECT count() AS total,
toStartOfMonth(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -500,7 +500,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -538,7 +538,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -569,7 +569,7 @@
(SELECT count() AS total,
toStartOfWeek(toTimeZone(e.timestamp, 'UTC'), 0) AS day_start
FROM 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)), 9, '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_start
ORDER 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.ambr
index e98d91d5bed3..a88a6e74afea 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_id
HAVING 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)), 9, '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_start
ORDER 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)), 9, '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)), 9, '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_value
FROM 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)), 9, '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_value
FROM 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)), 9, '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_1
FROM 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)), 9, '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_1
FROM 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)), 9, '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)), 9, '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)), 9, '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_id
HAVING 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)), 9, '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_id
HAVING 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)), 9, '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_id
HAVING 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)), 9, '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_id
HAVING 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)), 9, '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_id
HAVING 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)), 9, '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_start
ORDER 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)), 9, '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_start
ORDER 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1358,7 +1358,7 @@
(SELECT count() AS total,
toStartOfWeek(toTimeZone(e.timestamp, 'US/Pacific'), 0) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1414,10 +1414,10 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS 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)), 9, '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_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1486,7 +1486,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1517,7 +1517,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1557,7 +1557,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1595,7 +1595,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1642,7 +1642,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1689,7 +1689,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1736,7 +1736,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1767,7 +1767,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1805,7 +1805,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1887,7 +1887,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1933,7 +1933,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -2071,7 +2071,7 @@
(SELECT count() AS total,
toStartOfWeek(toTimeZone(e.timestamp, 'UTC'), 3) AS day_start
FROM 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)), 9, '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_start
ORDER 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_value
FROM 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)), 9, '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_value
FROM 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)), 9, '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_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -2225,7 +2225,7 @@
(SELECT count(DISTINCT e.distinct_id) AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER 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_value
FROM 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)), 9, '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_1
FROM 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)), 9, '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_value
FROM 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)), 9, '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_start
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))))
GROUP BY day_start)
GROUP BY day_start
ORDER BY day_start ASC)
@@ -2513,7 +2513,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -2564,7 +2564,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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_id
HAVING 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)), 9, '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_sessions
WHERE 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)), 9, '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_sessions
WHERE 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)), 9, '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_sessions
WHERE 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)), 9, '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_sessions
WHERE 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)), 9, '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_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -2899,7 +2899,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -2930,7 +2930,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -2964,7 +2964,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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_id
HAVING 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)), 9, '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_id
HAVING 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)), 9, '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_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -3128,7 +3128,7 @@
(SELECT count(DISTINCT e.`$group_0`) AS total,
min(toStartOfDay(toTimeZone(e.timestamp, 'UTC'))) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -3164,7 +3164,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -3207,7 +3207,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -3252,7 +3252,7 @@
FROM raw_sessions
WHERE 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)), 9, '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_sessions
WHERE 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)), 9, '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_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -3372,7 +3372,7 @@
FROM raw_sessions
WHERE 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)), 9, '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_sessions
WHERE 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)), 9, '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_sessions
WHERE 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)), 9, '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_sessions
WHERE 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)), 9, '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_sessions
WHERE 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)), 9, '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_sessions
WHERE 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)), 9, '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_sessions
WHERE 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)), 9, '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_sessions
WHERE 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)), 9, '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_id
HAVING 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-18 23:59:59', 'UTC'))), equals(e.event, '$pageview'))
GROUP BY day_start)
GROUP BY day_start
ORDER 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.ambr
index ddc447951db9..d59d437f431c 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_id
HAVING 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(startsWith(dynamicType(accurateCast(e.person_properties.`$bool_prop`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.`$bool_prop`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.`$bool_prop`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.`$bool_prop`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.`$bool_prop`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.`$bool_prop`, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(e.person_properties.`$bool_prop`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.`$bool_prop`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.`$bool_prop`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.`$bool_prop`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.`$bool_prop`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.`$bool_prop`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.person_properties.`$bool_prop`), '[]'), '{}'), toString(e.person_properties.`$bool_prop`))))), 'x'), 0))
GROUP BY day_start)
GROUP BY day_start
ORDER BY day_start ASC)
@@ -150,7 +150,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)), 9, '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,
@@ -204,7 +204,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(startsWith(dynamicType(accurateCast(e.person_properties.key, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.key, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.key), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.key, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.key, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.key, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(e.person_properties.key, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.key, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.key), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.key, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.key, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.key, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.person_properties.key), '[]'), '{}'), toString(e.person_properties.key))))), 'value'), 0))
GROUP BY day_start,
breakdown_value)
GROUP BY day_start,
@@ -250,7 +250,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(startsWith(dynamicType(accurateCast(e.properties.`$current_url`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$current_url`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$current_url`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$current_url`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$current_url`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$current_url`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.properties.`$current_url`), '[]'), '{}'), toString(e.properties.`$current_url`)))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value
FROM 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(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$os`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$os`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$os`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$os`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$os`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$os`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$os`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$os`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.properties.`$os`), '[]'), '{}'), toString(e.properties.`$os`))))), 'Mac'), 0))
GROUP BY day_start,
breakdown_value)
GROUP BY day_start,
@@ -296,7 +296,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(startsWith(dynamicType(accurateCast(e.properties.`$current_url`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$current_url`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$current_url`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$current_url`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$current_url`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$current_url`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.properties.`$current_url`), '[]'), '{}'), toString(e.properties.`$current_url`)))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value_1
FROM 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(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$os`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$os`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$os`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$os`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$os`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$os`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$os`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$os`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.properties.`$os`), '[]'), '{}'), toString(e.properties.`$os`))))), 'Mac'), 0))
GROUP BY day_start,
breakdown_value_1)
GROUP BY day_start,
@@ -342,7 +342,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(startsWith(dynamicType(accurateCast(e.properties.`$current_url`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$current_url`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$current_url`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$current_url`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$current_url`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$current_url`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.properties.`$current_url`), '[]'), '{}'), toString(e.properties.`$current_url`)))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value_1
FROM 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(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$os`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$os`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$os`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$os`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$os`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$os`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$os`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$os`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.properties.`$os`), '[]'), '{}'), toString(e.properties.`$os`))))), 'Mac'), 0))
GROUP BY day_start,
breakdown_value_1)
GROUP BY day_start,
@@ -388,7 +388,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(startsWith(dynamicType(accurateCast(e.properties.`$current_url`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$current_url`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$current_url`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$current_url`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$current_url`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$current_url`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.properties.`$current_url`), '[]'), '{}'), toString(e.properties.`$current_url`)))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value
FROM 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(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$os`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$os`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$os`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$os`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$os`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$os`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$os`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$os`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$os`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.properties.`$os`), '[]'), '{}'), toString(e.properties.`$os`))))), 'Mac'), 0))
GROUP BY day_start,
breakdown_value)
GROUP BY day_start,
@@ -580,7 +580,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)), 9, '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,
@@ -641,7 +641,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)), 9, '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,
@@ -694,7 +694,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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,
@@ -747,7 +747,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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,
@@ -800,7 +800,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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,
@@ -853,7 +853,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS 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)), 9, '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,
@@ -898,10 +898,10 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1043,7 +1043,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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1082,7 +1082,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(startsWith(dynamicType(accurateCast(e.person_properties.key, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.key, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.key), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.key, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.key, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.key, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(e.person_properties.key, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.key, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.key), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.key, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.key, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.key, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.person_properties.key), '[]'), '{}'), toString(e.person_properties.key))))), 'value'), 0)))
GROUP BY day_start)
GROUP BY day_start
ORDER BY day_start ASC)
@@ -1251,7 +1251,7 @@
(SELECT count() AS total,
toStartOfWeek(toTimeZone(e.timestamp, 'US/Pacific'), 0) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1297,10 +1297,10 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS 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)), 9, '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,
@@ -1338,7 +1338,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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(startsWith(dynamicType(accurateCast(e.person_properties.name, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.name, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.name), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.name, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.name, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.name, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(e.person_properties.name, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.name, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.name), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.name, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.name, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.name, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.person_properties.name), '[]'), '{}'), toString(e.person_properties.name))))), 'person1'), 0))
GROUP BY day_start)
GROUP BY day_start
ORDER BY day_start ASC)
@@ -1369,7 +1369,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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(startsWith(dynamicType(accurateCast(e.properties.name, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.name, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.name), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.name, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.name, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.name, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(e.properties.name, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.name, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.name), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.name, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.name, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.name, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.properties.name), '[]'), '{}'), toString(e.properties.name))))), '1'), 0))
GROUP BY day_start)
GROUP BY day_start
ORDER BY day_start ASC)
@@ -1400,7 +1400,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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(startsWith(dynamicType(accurateCast(e.person_properties.name, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.name, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.name), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.name, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.name, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.name, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(e.person_properties.name, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.name, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.name), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.name, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.name, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.name, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.person_properties.name), '[]'), '{}'), toString(e.person_properties.name))))), 'person1'), 0))
GROUP BY day_start)
GROUP BY day_start
ORDER BY day_start ASC)
@@ -1438,7 +1438,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1469,7 +1469,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1507,7 +1507,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1545,7 +1545,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1583,7 +1583,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1621,7 +1621,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1703,7 +1703,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1749,7 +1749,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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,
@@ -1787,7 +1787,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1887,7 +1887,7 @@
(SELECT count() AS total,
toStartOfWeek(toTimeZone(e.timestamp, 'UTC'), 3) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1918,7 +1918,7 @@
(SELECT count() AS total,
toStartOfWeek(toTimeZone(e.timestamp, 'UTC'), 0) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -1957,7 +1957,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(startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.person_properties.email), '[]'), '{}'), toString(e.person_properties.email)))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value
FROM 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(startsWith(dynamicType(accurateCast(e.person_properties.`$os`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.`$os`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.`$os`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.`$os`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.`$os`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.`$os`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.person_properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.properties.key, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.key, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.key), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.key, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.key, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.key, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(e.person_properties.`$os`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.`$os`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.`$os`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.`$os`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.`$os`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.`$os`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.person_properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.`$browser`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.properties.key, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.key, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.key), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.key, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.key, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.key, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Tuple')), 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,
@@ -2003,7 +2003,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(startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.person_properties.email), '[]'), '{}'), toString(e.person_properties.email)))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value
FROM 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(startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.properties.key, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.key, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.key), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.key, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.key, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.key, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.person_properties.`$os`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.`$os`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.`$os`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.`$os`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.`$os`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.`$os`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.person_properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.`$browser`, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.properties.key, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.key, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.key), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.key, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.key, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.key, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.person_properties.`$os`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.`$os`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.`$os`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.`$os`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.`$os`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.`$os`, 'Dynamic')), 'Tuple')), 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(startsWith(dynamicType(accurateCast(e.person_properties.`$browser`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.`$browser`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.`$browser`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.`$browser`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.`$browser`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.`$browser`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.person_properties.`$browser`), '[]'), '{}'), toString(e.person_properties.`$browser`))))), 'safari'), 0))))
GROUP BY day_start,
breakdown_value)
GROUP BY day_start,
@@ -2041,7 +2041,7 @@
(SELECT count(DISTINCT e.distinct_id) AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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(startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.`$some_prop`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.`$some_prop`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.`$some_prop`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.`$some_prop`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.person_properties.`$some_prop`), '[]'), '{}'), toString(e.person_properties.`$some_prop`))))), 'some_val'), 0))
GROUP BY day_start)
GROUP BY day_start
ORDER BY day_start ASC)
@@ -2080,7 +2080,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(startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.`$some_prop`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.`$some_prop`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.person_properties.`$some_prop`), '[]'), '{}'), toString(e.person_properties.`$some_prop`)))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value
FROM 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)), 9, '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,
@@ -2126,7 +2126,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(startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.`$some_prop`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.`$some_prop`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.`$some_prop`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.person_properties.`$some_prop`), '[]'), '{}'), toString(e.person_properties.`$some_prop`)))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value_1
FROM 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)), 9, '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,
@@ -2260,7 +2260,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(startsWith(dynamicType(accurateCast(e.properties.`$some_prop`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.properties.`$some_prop`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.properties.`$some_prop`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.properties.`$some_prop`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.properties.`$some_prop`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.properties.`$some_prop`, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(e.properties.`$some_prop`), '[]'), '{}'), toString(e.properties.`$some_prop`)))))), 400), ''), '$$_posthog_breakdown_null_$$') AS breakdown_value
FROM 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)), 9, '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,
@@ -2298,7 +2298,7 @@
(SELECT count(DISTINCT e.distinct_id) AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -2329,7 +2329,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -2360,7 +2360,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-04 23:59:59', 'UTC'))))
GROUP BY day_start)
GROUP BY day_start
ORDER BY day_start ASC)
@@ -2411,7 +2411,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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,
@@ -2472,7 +2472,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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,
@@ -2524,7 +2524,7 @@
FROM raw_sessions
WHERE 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)), 9, '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)
@@ -2575,7 +2575,7 @@
FROM raw_sessions
WHERE 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)), 9, '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)
@@ -2626,7 +2626,7 @@
FROM raw_sessions
WHERE 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)), 9, '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)
@@ -2677,7 +2677,7 @@
FROM raw_sessions
WHERE 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)), 9, '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)
@@ -2715,7 +2715,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -2746,7 +2746,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -2777,7 +2777,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -2811,7 +2811,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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,
@@ -2856,7 +2856,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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))
@@ -2907,7 +2907,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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))
@@ -2940,7 +2940,7 @@
(SELECT count(DISTINCT e.properties.`$group_0`) AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -2975,7 +2975,7 @@
(SELECT count(DISTINCT e.properties.`$group_0`) AS total,
min(toStartOfDay(toTimeZone(e.timestamp, 'UTC'))) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -3011,7 +3011,7 @@
(SELECT count() AS total,
toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -3054,7 +3054,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -3099,7 +3099,7 @@
FROM raw_sessions
WHERE 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)), 9, '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)
@@ -3150,7 +3150,7 @@
FROM raw_sessions
WHERE 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)), 9, '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)
@@ -3188,7 +3188,7 @@
(SELECT ifNull(accurateCastOrNull(plus(avg(accurateCastOrNull(e.properties.x, 'Float64')), 1000), 'Float64'), 0) AS total,
toStartOfWeek(toTimeZone(e.timestamp, 'UTC'), 0) AS day_start
FROM 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)), 9, '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_start
ORDER BY day_start ASC)
@@ -3219,7 +3219,7 @@
FROM raw_sessions
WHERE 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)), 9, '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,
@@ -3248,7 +3248,7 @@
FROM raw_sessions
WHERE 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)), 9, '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,
@@ -3286,7 +3286,7 @@
FROM raw_sessions
WHERE 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)), 9, '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)
@@ -3329,7 +3329,7 @@
FROM raw_sessions
WHERE 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)), 9, '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)
@@ -3381,7 +3381,7 @@
FROM raw_sessions
WHERE 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)), 9, '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,
@@ -3441,7 +3441,7 @@
FROM raw_sessions
WHERE 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)), 9, '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,
@@ -3501,7 +3501,7 @@
FROM raw_sessions
WHERE 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)), 9, '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,
@@ -3561,7 +3561,7 @@
FROM raw_sessions
WHERE 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)), 9, '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,
@@ -3930,7 +3930,7 @@
WHERE equals(person_distinct_id_overrides.team_id, 99999)
GROUP BY person_distinct_id_overrides.distinct_id
HAVING 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2020-01-18 23:59:59', 'UTC'))), equals(e.event, '$pageview'))
GROUP BY day_start)
GROUP BY day_start
ORDER 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.ambr
index b4f77b6a05b8..8dff4d188cb1 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_start
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-01-07 23:59:59', 'UTC'))), equals(e.event, '$pageview'))
GROUP BY day_start)
GROUP BY day_start
ORDER 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_1
FROM 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)), 9, '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_start
ORDER 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.ambr
index 26164eb5019b..a79455c84b23 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_start
FROM 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)), 9, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-01-07 23:59:59', 'UTC'))), equals(e.event, '$pageview'))
GROUP BY day_start)
GROUP BY day_start
ORDER BY day_start ASC)
@@ -66,7 +66,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_1
FROM 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(startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(e.person_properties.email, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(e.person_properties.email), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(e.person_properties.email, 'Dynamic')), 'Tuple')), 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)), 9, '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_start
ORDER 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.ambr
index 44b17a4d6818..af1ed821b689 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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
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))), 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)), 9, '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_height
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))), 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)), 9, '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_y
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))), 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)), 9, '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_height
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))), 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
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))), 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)), 9, '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_height
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))), 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)), 9, '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_y
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))), 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)), 9, '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_height
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))), 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)), 9, '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_y
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))), 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)), 9, '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_height
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))), 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
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))), 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)), 9, '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_height
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))), 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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
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))), 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)), 9, '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_height
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))), 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)), 9, '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_y
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(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)), 9, '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_height
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(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)), 9, '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_y
FROM 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)), 9, '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_height
FROM 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)), 9, '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_y
FROM 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)), 9, 'UTC'))))
GROUP BY bucket)
ORDER BY bucket ASC
LIMIT 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_y
FROM 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)), 9, 'UTC'))))
GROUP BY bucket)
ORDER BY bucket ASC
LIMIT 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)), 9, '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 type
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)), 9, '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') DESC
LIMIT 50
OFFSET 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_y
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))), 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)), 9, '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_height
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))), 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)), 9, '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_y
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))), 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)), 9, '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_height
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))), 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)), 9, '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_y
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))), 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)), 9, '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_height
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))), 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)), 9, '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_y
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))), 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)), 9, '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_height
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))), 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)), 9, '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.ambr
index 1eaa2084fb2d..17f6b866a7d9 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_height
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))), 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(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$host`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$host`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$host`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$host`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Tuple')), 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,
@@ -37,10 +37,10 @@
round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,
multiply(heatmaps.y, heatmaps.scale_factor) AS client_y
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))), 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(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$host`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$host`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.`$host`, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.`$host`), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.`$host`, 'Dynamic')), 'Tuple')), 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
@@ -71,10 +71,10 @@
heatmaps.current_url AS current_url,
heatmaps.type AS type
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)), 9, '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') DESC
LIMIT 50
OFFSET 0 SETTINGS readonly=2,
@@ -96,10 +96,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)), 9, '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,
@@ -121,10 +121,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_height
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))), 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(startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.plan, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.plan), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.plan, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.plan), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'Tuple')), 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,
@@ -152,10 +152,10 @@
round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,
multiply(heatmaps.y, heatmaps.scale_factor) AS client_y
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))), 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(startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.plan, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.plan), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'Tuple')), 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)), 9, '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(startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'DateTime'), concat(ifNull(toString(replaceOne(substring(toString(accurateCastOrNull(events.properties.plan, 'DateTime64(9, \'UTC\')')), 1, 19), ' ', 'T')), ''), ifNull(toString(substring(toString(events.properties.plan), 20, 10)), ''), 'Z'), if(or(startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'Array'), startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'Map'), startsWith(dynamicType(accurateCast(events.properties.plan, 'Dynamic')), 'Tuple')), nullIf(nullIf(toJSONString(events.properties.plan), '[]'), '{}'), toString(events.properties.plan))))), 'pro'), 0)))))))
GROUP BY pointer_target_fixed,
pointer_relative_x,
client_y
@@ -182,10 +182,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_height
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))), 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)), 9, '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,
@@ -213,10 +213,10 @@
round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,
multiply(heatmaps.y, heatmaps.scale_factor) AS client_y
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))), 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)), 9, '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
@@ -243,10 +243,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_height
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))), 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)), 9, '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,
@@ -274,13 +274,13 @@
round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,
multiply(heatmaps.y, heatmaps.scale_factor) AS client_y
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))), 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)), 9, '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
@@ -307,13 +307,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_height
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))), 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)), 9, '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,
@@ -341,10 +341,10 @@
round(divide(heatmaps.x, heatmaps.viewport_width), 2) AS pointer_relative_x,
multiply(heatmaps.y, heatmaps.scale_factor) AS client_y
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))), 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)), 9, '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