From 9eea1c9bca738c975f08a9bac64cac174acd88b5 Mon Sep 17 00:00:00 2001 From: Marius Andra Date: Thu, 14 Dec 2023 21:29:25 +0100 Subject: [PATCH 01/63] feat(hogql): always provide an alias when printing out clickhouse --- posthog/hogql/database/test/test_database.py | 11 +- posthog/hogql/database/test/test_s3_table.py | 16 +- .../hogql/database/test/test_saved_query.py | 4 +- posthog/hogql/database/test/test_view.py | 9 +- .../test/__snapshots__/test_cohort.ambr | 76 +++ posthog/hogql/functions/test/test_cohort.py | 34 +- posthog/hogql/printer.py | 31 +- .../hogql/test/__snapshots__/test_query.ambr | 604 ++++++++++++++++-- posthog/hogql/test/test_modifiers.py | 22 +- posthog/hogql/test/test_printer.py | 74 +-- posthog/hogql/test/test_query.py | 191 ++---- posthog/hogql/test/utils.py | 18 + .../test/__snapshots__/test_in_cohort.ambr | 76 +++ .../test/__snapshots__/test_lazy_tables.ambr | 16 +- .../hogql/transforms/test/test_in_cohort.py | 35 +- 15 files changed, 886 insertions(+), 331 deletions(-) create mode 100644 posthog/hogql/functions/test/__snapshots__/test_cohort.ambr create mode 100644 posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr diff --git a/posthog/hogql/database/test/test_database.py b/posthog/hogql/database/test/test_database.py index 0657779b15b87..c0817ee2c9861 100644 --- a/posthog/hogql/database/test/test_database.py +++ b/posthog/hogql/database/test/test_database.py @@ -70,7 +70,7 @@ def test_database_with_warehouse_tables(self, patch_execute): self.assertEqual( response.clickhouse, - f"SELECT whatever.id FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_3_sensitive)s, %(hogql_val_4_sensitive)s, %(hogql_val_1)s, %(hogql_val_2)s) AS whatever LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1", + f"SELECT whatever.id AS id FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_3_sensitive)s, %(hogql_val_4_sensitive)s, %(hogql_val_1)s, %(hogql_val_2)s) AS whatever LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1", ) def test_database_group_type_mappings(self): @@ -100,17 +100,20 @@ def test_database_expression_fields(self): query = print_ast(parse_select(sql), context, dialect="clickhouse") assert ( query - == "SELECT numbers.number, multiply(numbers.number, 2) AS double, plus(plus(1, 1), numbers.number) FROM numbers(2) AS numbers LIMIT 10000" + == "SELECT numbers.number AS number, multiply(numbers.number, 2) AS double, plus(plus(1, 1), numbers.number) FROM numbers(2) AS numbers LIMIT 10000" ), query sql = "select double from (select double from numbers(2))" query = print_ast(parse_select(sql), context, dialect="clickhouse") assert ( query - == "SELECT double FROM (SELECT multiply(numbers.number, 2) AS double FROM numbers(2) AS numbers) LIMIT 10000" + == "SELECT double AS double FROM (SELECT multiply(numbers.number, 2) AS double FROM numbers(2) AS numbers) LIMIT 10000" ), query # expression fields are not included in select * sql = "select * from (select * from numbers(2))" query = print_ast(parse_select(sql), context, dialect="clickhouse") - assert query == "SELECT number FROM (SELECT numbers.number FROM numbers(2) AS numbers) LIMIT 10000", query + assert ( + query + == "SELECT number AS number FROM (SELECT numbers.number AS number FROM numbers(2) AS numbers) LIMIT 10000" + ), query diff --git a/posthog/hogql/database/test/test_s3_table.py b/posthog/hogql/database/test/test_s3_table.py index 72b5dfa6cf3c0..dae4b7aec90be 100644 --- a/posthog/hogql/database/test/test_s3_table.py +++ b/posthog/hogql/database/test/test_s3_table.py @@ -36,7 +36,7 @@ def test_s3_table_select(self): self.assertEqual( clickhouse, - "SELECT aapl_stock.Date, aapl_stock.Open, aapl_stock.High, aapl_stock.Low, aapl_stock.Close, aapl_stock.Volume, aapl_stock.OpenInt FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s) AS aapl_stock LIMIT 10", + "SELECT aapl_stock.Date AS Date, aapl_stock.Open AS Open, aapl_stock.High AS High, aapl_stock.Low AS Low, aapl_stock.Close AS Close, aapl_stock.Volume AS Volume, aapl_stock.OpenInt AS OpenInt FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s) AS aapl_stock LIMIT 10", ) def test_s3_table_select_with_alias(self): @@ -50,7 +50,7 @@ def test_s3_table_select_with_alias(self): # Alias will completely override table name to prevent ambiguous table names that can be shared if the same table is joinedfrom multiple times self.assertEqual( clickhouse, - "SELECT a.High, a.Low FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s) AS a LIMIT 10", + "SELECT a.High AS High, a.Low AS Low FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s) AS a LIMIT 10", ) def test_s3_table_select_join(self): @@ -72,7 +72,7 @@ def test_s3_table_select_join(self): self.assertEqual( clickhouse, - "SELECT aapl_stock.High, aapl_stock.Low FROM (SELECT * FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s)) AS aapl_stock JOIN (SELECT * FROM s3Cluster('posthog', %(hogql_val_3_sensitive)s, %(hogql_val_4)s)) AS aapl_stock_2 ON equals(aapl_stock.High, aapl_stock_2.High) LIMIT 10", + "SELECT aapl_stock.High AS High, aapl_stock.Low AS Low FROM (SELECT * FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s)) AS aapl_stock JOIN (SELECT * FROM s3Cluster('posthog', %(hogql_val_3_sensitive)s, %(hogql_val_4)s)) AS aapl_stock_2 ON equals(aapl_stock.High, aapl_stock_2.High) LIMIT 10", ) def test_s3_table_select_join_with_alias(self): @@ -95,7 +95,7 @@ def test_s3_table_select_join_with_alias(self): # Alias will completely override table name to prevent ambiguous table names that can be shared if the same table is joinedfrom multiple times self.assertEqual( clickhouse, - "SELECT a.High, a.Low FROM (SELECT * FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s)) AS a JOIN (SELECT * FROM s3Cluster('posthog', %(hogql_val_3_sensitive)s, %(hogql_val_4)s)) AS b ON equals(a.High, b.High) LIMIT 10", + "SELECT a.High AS High, a.Low AS Low FROM (SELECT * FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s)) AS a JOIN (SELECT * FROM s3Cluster('posthog', %(hogql_val_3_sensitive)s, %(hogql_val_4)s)) AS b ON equals(a.High, b.High) LIMIT 10", ) def test_s3_table_select_and_non_s3_join(self): @@ -117,7 +117,7 @@ def test_s3_table_select_and_non_s3_join(self): self.assertEqual( clickhouse, - f"SELECT aapl_stock.High, aapl_stock.Low FROM (SELECT * FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s)) AS aapl_stock JOIN events ON equals(aapl_stock.High, events.event) WHERE equals(events.team_id, {self.team.pk}) LIMIT 10", + f"SELECT aapl_stock.High AS High, aapl_stock.Low AS Low FROM (SELECT * FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s)) AS aapl_stock JOIN events ON equals(aapl_stock.High, events.event) WHERE equals(events.team_id, {self.team.pk}) LIMIT 10", ) def test_s3_table_select_and_non_s3_join_first(self): @@ -139,7 +139,7 @@ def test_s3_table_select_and_non_s3_join_first(self): self.assertEqual( clickhouse, - f"SELECT aapl_stock.High, aapl_stock.Low FROM events GLOBAL JOIN (SELECT * FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s)) AS aapl_stock ON equals(aapl_stock.High, events.event) WHERE equals(events.team_id, {self.team.pk}) LIMIT 10", + f"SELECT aapl_stock.High AS High, aapl_stock.Low AS Low FROM events GLOBAL JOIN (SELECT * FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s)) AS aapl_stock ON equals(aapl_stock.High, events.event) WHERE equals(events.team_id, {self.team.pk}) LIMIT 10", ) def test_s3_table_select_alias_escaped(self): @@ -167,7 +167,7 @@ def test_s3_table_select_alias_escaped(self): # table name is escaped self.assertEqual( clickhouse, - f"SELECT `random as (SELECT * FROM events), SELECT * FROM events --`.High, `random as (SELECT * FROM events), SELECT * FROM events --`.Low FROM (SELECT * FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s)) AS `random as (SELECT * FROM events), SELECT * FROM events --` JOIN events ON equals(`random as (SELECT * FROM events), SELECT * FROM events --`.High, events.event) WHERE equals(events.team_id, {self.team.pk}) LIMIT 10", + f"SELECT `random as (SELECT * FROM events), SELECT * FROM events --`.High AS High, `random as (SELECT * FROM events), SELECT * FROM events --`.Low AS Low FROM (SELECT * FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s)) AS `random as (SELECT * FROM events), SELECT * FROM events --` JOIN events ON equals(`random as (SELECT * FROM events), SELECT * FROM events --`.High, events.event) WHERE equals(events.team_id, {self.team.pk}) LIMIT 10", ) def test_s3_table_select_table_name_bad_character(self): @@ -199,5 +199,5 @@ def test_s3_table_select_in(self): self.assertEqual( clickhouse, - f"SELECT events.uuid, events.event FROM events WHERE and(equals(events.team_id, {self.team.pk}), ifNull(globalIn(events.event, (SELECT aapl_stock.Date FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s) AS aapl_stock)), 0)) LIMIT 10000", + f"SELECT events.uuid AS uuid, events.event AS event FROM events WHERE and(equals(events.team_id, {self.team.pk}), ifNull(globalIn(events.event, (SELECT aapl_stock.Date AS Date FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s) AS aapl_stock)), 0)) LIMIT 10000", ) diff --git a/posthog/hogql/database/test/test_saved_query.py b/posthog/hogql/database/test/test_saved_query.py index 7c7f534c66f21..7369c50a29181 100644 --- a/posthog/hogql/database/test/test_saved_query.py +++ b/posthog/hogql/database/test/test_saved_query.py @@ -44,7 +44,7 @@ def test_saved_query_table_select(self): self.assertEqual( clickhouse, - "SELECT aapl_stock_view.Date, aapl_stock_view.Open, aapl_stock_view.High, aapl_stock_view.Low, aapl_stock_view.Close, aapl_stock_view.Volume, aapl_stock_view.OpenInt FROM (SELECT aapl_stock.Date, aapl_stock.Open, aapl_stock.High, aapl_stock.Low, aapl_stock.Close, aapl_stock.Volume, aapl_stock.OpenInt FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s) AS aapl_stock) AS aapl_stock_view LIMIT 10", + "SELECT aapl_stock_view.Date AS Date, aapl_stock_view.Open AS Open, aapl_stock_view.High AS High, aapl_stock_view.Low AS Low, aapl_stock_view.Close AS Close, aapl_stock_view.Volume AS Volume, aapl_stock_view.OpenInt AS OpenInt FROM (SELECT aapl_stock.Date AS Date, aapl_stock.Open AS Open, aapl_stock.High AS High, aapl_stock.Low AS Low, aapl_stock.Close AS Close, aapl_stock.Volume AS Volume, aapl_stock.OpenInt AS OpenInt FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s) AS aapl_stock) AS aapl_stock_view LIMIT 10", ) def test_saved_query_with_alias(self): @@ -63,5 +63,5 @@ def test_saved_query_with_alias(self): self.assertEqual( clickhouse, - "SELECT some_alias.Date, some_alias.Open, some_alias.High, some_alias.Low, some_alias.Close, some_alias.Volume, some_alias.OpenInt FROM (SELECT aapl_stock.Date, aapl_stock.Open, aapl_stock.High, aapl_stock.Low, aapl_stock.Close, aapl_stock.Volume, aapl_stock.OpenInt FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s) AS aapl_stock) AS some_alias LIMIT 10", + "SELECT some_alias.Date AS Date, some_alias.Open AS Open, some_alias.High AS High, some_alias.Low AS Low, some_alias.Close AS Close, some_alias.Volume AS Volume, some_alias.OpenInt AS OpenInt FROM (SELECT aapl_stock.Date AS Date, aapl_stock.Open AS Open, aapl_stock.High AS High, aapl_stock.Low AS Low, aapl_stock.Close AS Close, aapl_stock.Volume AS Volume, aapl_stock.OpenInt AS OpenInt FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s) AS aapl_stock) AS some_alias LIMIT 10", ) diff --git a/posthog/hogql/database/test/test_view.py b/posthog/hogql/database/test/test_view.py index 26ce89e10653c..e6700d4bbc0f0 100644 --- a/posthog/hogql/database/test/test_view.py +++ b/posthog/hogql/database/test/test_view.py @@ -44,7 +44,12 @@ def test_view_table_select(self): self.assertEqual( clickhouse, - "SELECT aapl_stock_view.Date, aapl_stock_view.Open, aapl_stock_view.High, aapl_stock_view.Low, aapl_stock_view.Close, aapl_stock_view.Volume, aapl_stock_view.OpenInt FROM (SELECT aapl_stock.Date, aapl_stock.Open, aapl_stock.High, aapl_stock.Low, aapl_stock.Close, aapl_stock.Volume, aapl_stock.OpenInt FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s) AS aapl_stock) AS aapl_stock_view LIMIT 10", + "SELECT aapl_stock_view.Date AS Date, aapl_stock_view.Open AS Open, aapl_stock_view.High AS High, " + "aapl_stock_view.Low AS Low, aapl_stock_view.Close AS Close, aapl_stock_view.Volume AS Volume, " + "aapl_stock_view.OpenInt AS OpenInt FROM (SELECT aapl_stock.Date AS Date, aapl_stock.Open AS Open, " + "aapl_stock.High AS High, aapl_stock.Low AS Low, aapl_stock.Close AS Close, aapl_stock.Volume AS Volume, " + "aapl_stock.OpenInt AS OpenInt FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s) AS aapl_stock) " + "AS aapl_stock_view LIMIT 10", ) def test_view_with_alias(self): @@ -63,5 +68,5 @@ def test_view_with_alias(self): self.assertEqual( clickhouse, - "SELECT some_alias.Date, some_alias.Open, some_alias.High, some_alias.Low, some_alias.Close, some_alias.Volume, some_alias.OpenInt FROM (SELECT aapl_stock.Date, aapl_stock.Open, aapl_stock.High, aapl_stock.Low, aapl_stock.Close, aapl_stock.Volume, aapl_stock.OpenInt FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s) AS aapl_stock) AS some_alias LIMIT 10", + "SELECT some_alias.Date AS Date, some_alias.Open AS Open, some_alias.High AS High, some_alias.Low AS Low, some_alias.Close AS Close, some_alias.Volume AS Volume, some_alias.OpenInt AS OpenInt FROM (SELECT aapl_stock.Date AS Date, aapl_stock.Open AS Open, aapl_stock.High AS High, aapl_stock.Low AS Low, aapl_stock.Close AS Close, aapl_stock.Volume AS Volume, aapl_stock.OpenInt AS OpenInt FROM s3Cluster('posthog', %(hogql_val_0_sensitive)s, %(hogql_val_1)s) AS aapl_stock) AS some_alias LIMIT 10", ) diff --git a/posthog/hogql/functions/test/__snapshots__/test_cohort.ambr b/posthog/hogql/functions/test/__snapshots__/test_cohort.ambr new file mode 100644 index 0000000000000..d415946aa75fd --- /dev/null +++ b/posthog/hogql/functions/test/__snapshots__/test_cohort.ambr @@ -0,0 +1,76 @@ +# name: TestCohort.test_in_cohort_dynamic + ' + -- ClickHouse + + SELECT events.event AS event + FROM events + WHERE and(equals(events.team_id, 420), in(events.person_id, ( + SELECT cohortpeople.person_id AS person_id + FROM cohortpeople + WHERE and(equals(cohortpeople.team_id, 420), equals(cohortpeople.cohort_id, 1)) + GROUP BY cohortpeople.person_id, cohortpeople.cohort_id, cohortpeople.version + HAVING ifNull(greater(sum(cohortpeople.sign), 0), 0))), equals(events.event, %(hogql_val_0)s)) + LIMIT 100 + SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event + FROM events + WHERE and(in(person_id, ( + SELECT person_id + FROM raw_cohort_people + WHERE equals(cohort_id, 1) + GROUP BY person_id, cohort_id, version + HAVING greater(sum(sign), 0))), equals(event, '018c6a03-51e8-0000-f395-a489e01f6d20')) + LIMIT 100 + ' +--- +# name: TestCohort.test_in_cohort_static + ' + -- ClickHouse + + SELECT events.event AS event + FROM events + WHERE and(equals(events.team_id, 420), in(events.person_id, ( + SELECT person_static_cohort.person_id AS person_id + FROM person_static_cohort + WHERE and(equals(person_static_cohort.team_id, 420), equals(person_static_cohort.cohort_id, 2))))) + LIMIT 100 + SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event + FROM events + WHERE in(person_id, ( + SELECT person_id + FROM static_cohort_people + WHERE equals(cohort_id, 2))) + LIMIT 100 + ' +--- +# name: TestCohort.test_in_cohort_strings + ' + -- ClickHouse + + SELECT events.event AS event + FROM events + WHERE and(equals(events.team_id, 420), in(events.person_id, ( + SELECT person_static_cohort.person_id AS person_id + FROM person_static_cohort + WHERE and(equals(person_static_cohort.team_id, 420), equals(person_static_cohort.cohort_id, 3))))) + LIMIT 100 + SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event + FROM events + WHERE in(person_id, ( + SELECT person_id + FROM static_cohort_people + WHERE equals(cohort_id, 3))) + LIMIT 100 + ' +--- diff --git a/posthog/hogql/functions/test/test_cohort.py b/posthog/hogql/functions/test/test_cohort.py index 0f03d28fcd6e5..7ba4a19ff2815 100644 --- a/posthog/hogql/functions/test/test_cohort.py +++ b/posthog/hogql/functions/test/test_cohort.py @@ -1,9 +1,11 @@ +import pytest from django.test import override_settings from posthog.hogql import ast from posthog.hogql.errors import HogQLException from posthog.hogql.parser import parse_expr from posthog.hogql.query import execute_hogql_query +from posthog.hogql.test.utils import pretty_print_response_in_tests from posthog.models import Cohort from posthog.models.cohort.util import recalculate_cohortpeople from posthog.models.utils import UUIDT @@ -34,6 +36,7 @@ def _create_random_events(self) -> str: flush_persons_and_events() return random_uuid + @pytest.mark.usefixtures("unittest_snapshot") @override_settings(PERSON_ON_EVENTS_OVERRIDE=True, PERSON_ON_EVENTS_V2_OVERRIDE=False) def test_in_cohort_dynamic(self): random_uuid = self._create_random_events() @@ -47,17 +50,11 @@ def test_in_cohort_dynamic(self): self.team, modifiers=HogQLQueryModifiers(inCohortVia="subquery"), ) - self.assertEqual( - response.clickhouse, - f"SELECT events.event FROM events WHERE and(equals(events.team_id, {self.team.pk}), in(events.person_id, (SELECT cohortpeople.person_id FROM cohortpeople WHERE and(equals(cohortpeople.team_id, {self.team.pk}), equals(cohortpeople.cohort_id, {cohort.pk})) GROUP BY cohortpeople.person_id, cohortpeople.cohort_id, cohortpeople.version HAVING ifNull(greater(sum(cohortpeople.sign), 0), 0))), equals(events.event, %(hogql_val_0)s)) LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1", - ) - self.assertEqual( - response.hogql, - f"SELECT event FROM events WHERE and(in(person_id, (SELECT person_id FROM raw_cohort_people WHERE equals(cohort_id, {cohort.pk}) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0))), equals(event, '{random_uuid}')) LIMIT 100", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertEqual(len(response.results), 1) self.assertEqual(response.results[0][0], random_uuid) + @pytest.mark.usefixtures("unittest_snapshot") @override_settings(PERSON_ON_EVENTS_OVERRIDE=True, PERSON_ON_EVENTS_V2_OVERRIDE=False) def test_in_cohort_static(self): cohort = Cohort.objects.create( @@ -69,18 +66,12 @@ def test_in_cohort_static(self): self.team, modifiers=HogQLQueryModifiers(inCohortVia="subquery"), ) - self.assertEqual( - response.clickhouse, - f"SELECT events.event FROM events WHERE and(equals(events.team_id, {self.team.pk}), in(events.person_id, (SELECT person_static_cohort.person_id FROM person_static_cohort WHERE and(equals(person_static_cohort.team_id, {self.team.pk}), equals(person_static_cohort.cohort_id, {cohort.pk}))))) LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1", - ) - self.assertEqual( - response.hogql, - f"SELECT event FROM events WHERE in(person_id, (SELECT person_id FROM static_cohort_people WHERE equals(cohort_id, {cohort.pk}))) LIMIT 100", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot + @pytest.mark.usefixtures("unittest_snapshot") @override_settings(PERSON_ON_EVENTS_OVERRIDE=True, PERSON_ON_EVENTS_V2_OVERRIDE=False) def test_in_cohort_strings(self): - cohort = Cohort.objects.create( + Cohort.objects.create( team=self.team, name="my cohort", is_static=True, @@ -90,14 +81,7 @@ def test_in_cohort_strings(self): self.team, modifiers=HogQLQueryModifiers(inCohortVia="subquery"), ) - self.assertEqual( - response.clickhouse, - f"SELECT events.event FROM events WHERE and(equals(events.team_id, {self.team.pk}), in(events.person_id, (SELECT person_static_cohort.person_id FROM person_static_cohort WHERE and(equals(person_static_cohort.team_id, {self.team.pk}), equals(person_static_cohort.cohort_id, {cohort.pk}))))) LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1", - ) - self.assertEqual( - response.hogql, - f"SELECT event FROM events WHERE in(person_id, (SELECT person_id FROM static_cohort_people WHERE equals(cohort_id, {cohort.pk}))) LIMIT 100", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot @override_settings(PERSON_ON_EVENTS_OVERRIDE=True, PERSON_ON_EVENTS_V2_OVERRIDE=True) def test_in_cohort_error(self): diff --git a/posthog/hogql/printer.py b/posthog/hogql/printer.py index 8d7883c77c059..b530295fb6a7d 100644 --- a/posthog/hogql/printer.py +++ b/posthog/hogql/printer.py @@ -236,39 +236,28 @@ def visit_select_query(self, node: ast.SelectQuery): next_join = next_join.next_join if node.select: - # Only for ClickHouse: Gather all visible aliases, and/or the last hidden alias for - # each unique alias name. Then make the last hidden aliases visible. if self.dialect == "clickhouse": - visible_aliases = {} + # Gather all visible aliases, and/or the last hidden alias for each unique alias name. + found_aliases = {} for alias in reversed(node.select): if isinstance(alias, ast.Alias): - if not visible_aliases.get(alias.alias, None) or not alias.hidden: - visible_aliases[alias.alias] = alias + if not found_aliases.get(alias.alias, None) or not alias.hidden: + found_aliases[alias.alias] = alias columns = [] for column in node.select: if isinstance(column, ast.Alias): - # It's either a visible alias, or the last hidden alias for this name. - if visible_aliases.get(column.alias) == column: + # It's either a visible alias, or the last hidden alias with this name. + if found_aliases.get(column.alias) == column: if column.hidden: - if ( - isinstance(column.expr, ast.Field) - and isinstance(column.expr.type, ast.FieldType) - and column.expr.type.name == column.alias - ): - # Hide the hidden alias only if it's a simple field, - # and we're using the same name for the field and the alias - # E.g. events.event AS event --> events.evnet. - column = column.expr - else: - # Make the hidden alias visible - column = cast(ast.Alias, clone_expr(column)) - column.hidden = False + # Make the hidden alias visible + column = cast(ast.Alias, clone_expr(column)) + column.hidden = False else: # Always print visible aliases. pass else: - # This is not the alias for this unique alias name. Skip it. + # Non-unique hidden alias. Skip. column = column.expr columns.append(self.visit(column)) else: diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index d656bc1eec6b2..ecd983e738882 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -1,63 +1,387 @@ # name: TestQuery.test_hogql_arrays ' + -- ClickHouse SELECT [1, 2, 3], [10, 11, 12][1] LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT [1, 2, 3], [10, 11, 12][1] + LIMIT 100 ' --- # name: TestQuery.test_hogql_lambdas ' + -- ClickHouse SELECT arrayMap(x -> multiply(x, 2), [1, 2, 3]), 1 LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT arrayMap(x -> multiply(x, 2), [1, 2, 3]), 1 + LIMIT 100 + ' +--- +# name: TestQuery.test_hogql_query_filters + ' + -- ClickHouse + + SELECT events.event AS event, events.distinct_id AS distinct_id + FROM events + WHERE and(equals(events.team_id, 420), equals(events.distinct_id, %(hogql_val_0)s), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_1)s), ''), 'null'), '^"|"$', ''), %(hogql_val_2)s), 0)) + LIMIT 100 + SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event, distinct_id + FROM events + WHERE and(equals(distinct_id, '016f8cc0-2400-0000-b4fa-0b49fb31d6d3'), equals(properties.index, '4')) + LIMIT 100 + ' +--- +# name: TestQuery.test_hogql_query_filters.1 + ' + + SELECT event, distinct_id + FROM events + WHERE and(equals(distinct_id, '016f8cc0-2400-0000-b4fa-0b49fb31d6d3'), equals(properties.index, '4')) + LIMIT 100 + ' +--- +# name: TestQuery.test_hogql_query_filters.2 + ' + -- ClickHouse + + SELECT events.event AS event, events.distinct_id AS distinct_id + FROM events + WHERE and(equals(events.team_id, 420), equals(events.distinct_id, %(hogql_val_0)s), and(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_1)s), ''), 'null'), '^"|"$', ''), %(hogql_val_2)s), 0), less(toTimeZone(events.timestamp, %(hogql_val_3)s), toDateTime64('2020-01-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_4)s), toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')))) + LIMIT 100 + SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event, distinct_id + FROM events + WHERE and(equals(distinct_id, '016f8cc0-2400-0000-b4fa-0b49fb31d6d3'), and(equals(properties.index, '4'), less(timestamp, toDateTime('2020-01-02 00:00:00.000000')), greaterOrEquals(timestamp, toDateTime('2020-01-01 00:00:00.000000')))) + LIMIT 100 + ' +--- +# name: TestQuery.test_hogql_query_filters.3 + ' + + SELECT event, distinct_id + FROM events + WHERE and(equals(distinct_id, '016f8cc0-2400-0000-b4fa-0b49fb31d6d3'), and(equals(properties.index, '4'), less(timestamp, toDateTime('2020-01-02 00:00:00.000000')), greaterOrEquals(timestamp, toDateTime('2020-01-01 00:00:00.000000')))) + LIMIT 100 ' --- # name: TestQuery.test_hogql_query_filters_alias ' + -- ClickHouse - SELECT e.event, e.distinct_id + SELECT e.event AS event, e.distinct_id AS distinct_id FROM events AS e WHERE and(equals(e.team_id, 420), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', ''), %(hogql_val_1)s), 0)) LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event, distinct_id + FROM events AS e + WHERE equals(properties.random_uuid, '016f8cc0-2400-0001-c0f1-69ca93151ff2') + LIMIT 100 ' --- # name: TestQuery.test_hogql_union_all_limits ' + -- ClickHouse - SELECT events.event + SELECT events.event AS event FROM events WHERE equals(events.team_id, 420) LIMIT 100 UNION ALL - SELECT events.event + SELECT events.event AS event FROM events WHERE equals(events.team_id, 420) LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event + FROM events + LIMIT 100 UNION ALL + SELECT event + FROM events + LIMIT 100 + ' +--- +# name: TestQuery.test_join_with_property_materialized_session_id + ' + -- ClickHouse + + SELECT e.event AS event, s.session_id AS session_id + FROM events AS e LEFT JOIN session_replay_events AS s ON equals(s.session_id, nullIf(nullIf(e.`$session_id`, ''), 'null')) + WHERE and(equals(s.team_id, 420), equals(e.team_id, 420), isNotNull(nullIf(nullIf(e.`$session_id`, ''), 'null'))) + LIMIT 10 + SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT e.event, s.session_id + FROM events AS e LEFT JOIN session_replay_events AS s ON equals(s.session_id, e.properties.$session_id) + WHERE notEquals(e.properties.$session_id, NULL) + LIMIT 10 + ' +--- +# name: TestQuery.test_join_with_property_materialized_session_id.1 + ' + + SELECT e.event, s.session_id + FROM events AS e LEFT JOIN session_replay_events AS s ON equals(s.session_id, e.properties.$session_id) + WHERE notEquals(e.properties.$session_id, NULL) + LIMIT 10 + ' +--- +# name: TestQuery.test_join_with_property_materialized_session_id.2 + ' + -- ClickHouse + + SELECT e.event AS event, s.session_id AS session_id + FROM session_replay_events AS s LEFT JOIN events AS e ON equals(nullIf(nullIf(e.`$session_id`, ''), 'null'), s.session_id) + WHERE and(equals(e.team_id, 420), equals(s.team_id, 420), isNotNull(nullIf(nullIf(e.`$session_id`, ''), 'null'))) + LIMIT 10 + SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT e.event, s.session_id + FROM session_replay_events AS s LEFT JOIN events AS e ON equals(e.properties.$session_id, s.session_id) + WHERE notEquals(e.properties.$session_id, NULL) + LIMIT 10 + ' +--- +# name: TestQuery.test_join_with_property_materialized_session_id.3 + ' + + SELECT e.event, s.session_id + FROM session_replay_events AS s LEFT JOIN events AS e ON equals(e.properties.$session_id, s.session_id) + WHERE notEquals(e.properties.$session_id, NULL) + LIMIT 10 + ' +--- +# name: TestQuery.test_join_with_property_not_materialized + ' + -- ClickHouse + + SELECT e.event AS event, s.session_id AS session_id + FROM events AS e LEFT JOIN session_replay_events AS s ON equals(s.session_id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', '')) + WHERE and(equals(s.team_id, 420), equals(e.team_id, 420), isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, %(hogql_val_1)s), ''), 'null'), '^"|"$', ''))) + LIMIT 10 + SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT e.event, s.session_id + FROM events AS e LEFT JOIN session_replay_events AS s ON equals(s.session_id, e.properties.$$$session_id) + WHERE notEquals(e.properties.$$$session_id, NULL) + LIMIT 10 + ' +--- +# name: TestQuery.test_join_with_property_not_materialized.1 + ' + + SELECT e.event, s.session_id + FROM events AS e LEFT JOIN session_replay_events AS s ON equals(s.session_id, e.properties.$$$session_id) + WHERE notEquals(e.properties.$$$session_id, NULL) + LIMIT 10 + ' +--- +# name: TestQuery.test_join_with_property_not_materialized.2 + ' + -- ClickHouse + + SELECT e.event AS event, s.session_id AS session_id + FROM session_replay_events AS s LEFT JOIN events AS e ON equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', ''), s.session_id) + WHERE and(equals(e.team_id, 420), equals(s.team_id, 420), isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, %(hogql_val_1)s), ''), 'null'), '^"|"$', ''))) + LIMIT 10 + SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT e.event, s.session_id + FROM session_replay_events AS s LEFT JOIN events AS e ON equals(e.properties.$$$session_id, s.session_id) + WHERE notEquals(e.properties.$$$session_id, NULL) + LIMIT 10 + ' +--- +# name: TestQuery.test_join_with_property_not_materialized.3 + ' + + SELECT e.event, s.session_id + FROM session_replay_events AS s LEFT JOIN events AS e ON equals(e.properties.$$$session_id, s.session_id) + WHERE notEquals(e.properties.$$$session_id, NULL) + LIMIT 10 + ' +--- +# name: TestQuery.test_prop_cohort_basic + ' + -- ClickHouse + + SELECT events.event AS event, count() + FROM events INNER JOIN ( + SELECT argMax(person_distinct_id2.person_id, person_distinct_id2.version) AS person_id, person_distinct_id2.distinct_id AS distinct_id + FROM person_distinct_id2 + WHERE equals(person_distinct_id2.team_id, 420) + GROUP BY person_distinct_id2.distinct_id + HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS events__pdi ON equals(events.distinct_id, events__pdi.distinct_id) + WHERE and(equals(events.team_id, 420), ifNull(in(events__pdi.person_id, ( + SELECT cohortpeople.person_id AS person_id + FROM cohortpeople + WHERE and(equals(cohortpeople.team_id, 420), equals(cohortpeople.cohort_id, 8)) + GROUP BY cohortpeople.person_id, cohortpeople.cohort_id, cohortpeople.version + HAVING ifNull(greater(sum(cohortpeople.sign), 0), 0))), 0)) + GROUP BY events.event + LIMIT 100 + SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event, count() + FROM events + WHERE in(person_id, ( + SELECT person_id + FROM raw_cohort_people + WHERE equals(cohort_id, 8) + GROUP BY person_id, cohort_id, version + HAVING greater(sum(sign), 0))) + GROUP BY event + LIMIT 100 + ' +--- +# name: TestQuery.test_prop_cohort_basic.1 + ' + -- ClickHouse + + SELECT events.event AS event, count(*) + FROM events + WHERE and(equals(events.team_id, 420), in(events.person_id, ( + SELECT cohortpeople.person_id AS person_id + FROM cohortpeople + WHERE and(equals(cohortpeople.team_id, 420), equals(cohortpeople.cohort_id, 8)) + GROUP BY cohortpeople.person_id, cohortpeople.cohort_id, cohortpeople.version + HAVING ifNull(greater(sum(cohortpeople.sign), 0), 0)))) + GROUP BY events.event + LIMIT 100 + SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event, count(*) + FROM events + WHERE in(person_id, ( + SELECT person_id + FROM raw_cohort_people + WHERE equals(cohort_id, 8) + GROUP BY person_id, cohort_id, version + HAVING greater(sum(sign), 0))) + GROUP BY event + LIMIT 100 + ' +--- +# name: TestQuery.test_prop_cohort_static + ' + -- ClickHouse + + SELECT events.event AS event, count() + FROM events INNER JOIN ( + SELECT argMax(person_distinct_id2.person_id, person_distinct_id2.version) AS person_id, person_distinct_id2.distinct_id AS distinct_id + FROM person_distinct_id2 + WHERE equals(person_distinct_id2.team_id, 420) + GROUP BY person_distinct_id2.distinct_id + HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS events__pdi ON equals(events.distinct_id, events__pdi.distinct_id) + WHERE and(equals(events.team_id, 420), ifNull(in(events__pdi.person_id, ( + SELECT person_static_cohort.person_id AS person_id + FROM person_static_cohort + WHERE and(equals(person_static_cohort.team_id, 420), equals(person_static_cohort.cohort_id, 9)))), 0)) + GROUP BY events.event + LIMIT 100 + SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event, count() + FROM events + WHERE in(person_id, ( + SELECT person_id + FROM static_cohort_people + WHERE equals(cohort_id, 9))) + GROUP BY event + LIMIT 100 + ' +--- +# name: TestQuery.test_prop_cohort_static.1 + ' + -- ClickHouse + + SELECT events.event AS event, count(*) + FROM events + WHERE and(equals(events.team_id, 420), in(events.person_id, ( + SELECT person_static_cohort.person_id AS person_id + FROM person_static_cohort + WHERE and(equals(person_static_cohort.team_id, 420), equals(person_static_cohort.cohort_id, 9))))) + GROUP BY events.event + LIMIT 100 + SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event, count(*) + FROM events + WHERE in(person_id, ( + SELECT person_id + FROM static_cohort_people + WHERE equals(cohort_id, 9))) + GROUP BY event + LIMIT 100 ' --- # name: TestQuery.test_query ' + -- ClickHouse - SELECT count(), events.event + SELECT count(), events.event AS event FROM events WHERE and(equals(events.team_id, 420), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', ''), %(hogql_val_1)s), 0)) GROUP BY events.event LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT count(), event + FROM events + WHERE equals(properties.random_uuid, '016f8cc0-2400-0004-f14f-e1c1436db92b') + GROUP BY event + LIMIT 100 ' --- # name: TestQuery.test_query_distinct ' + -- ClickHouse SELECT DISTINCT persons.properties___sneaky_mail AS sneaky_mail FROM ( - SELECT person.id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', '') AS properties___sneaky_mail, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, %(hogql_val_1)s), ''), 'null'), '^"|"$', '') AS properties___random_uuid + SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', '') AS properties___sneaky_mail, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, %(hogql_val_1)s), ''), 'null'), '^"|"$', '') AS properties___random_uuid FROM person WHERE and(equals(person.team_id, 420), ifNull(in(tuple(person.id, person.version), ( - SELECT person.id, max(person.version) AS version + SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 420) GROUP BY person.id @@ -66,12 +390,20 @@ WHERE ifNull(equals(persons.properties___random_uuid, %(hogql_val_2)s), 0) LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT DISTINCT properties.sneaky_mail + FROM persons + WHERE equals(properties.random_uuid, '016f8cc0-2400-0005-143b-3097b528d6b2') + LIMIT 100 ' --- # name: TestQuery.test_query_joins_events_e_pdi ' + -- ClickHouse - SELECT e.event, toTimeZone(e.timestamp, %(hogql_val_0)s) AS timestamp, e__pdi.distinct_id, e__pdi.person_id + SELECT e.event AS event, toTimeZone(e.timestamp, %(hogql_val_0)s) AS timestamp, e__pdi.distinct_id AS distinct_id, e__pdi.person_id AS person_id FROM events AS e INNER JOIN ( SELECT argMax(person_distinct_id2.person_id, person_distinct_id2.version) AS person_id, person_distinct_id2.distinct_id AS distinct_id FROM person_distinct_id2 @@ -81,12 +413,19 @@ WHERE equals(e.team_id, 420) LIMIT 10 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event, e.timestamp, e.pdi.distinct_id, pdi.person_id + FROM events AS e + LIMIT 10 ' --- # name: TestQuery.test_query_joins_events_pdi ' + -- ClickHouse - SELECT events.event, toTimeZone(events.timestamp, %(hogql_val_0)s) AS timestamp, events__pdi.distinct_id, events__pdi.person_id + SELECT events.event AS event, toTimeZone(events.timestamp, %(hogql_val_0)s) AS timestamp, events__pdi.distinct_id AS distinct_id, events__pdi.person_id AS person_id FROM events INNER JOIN ( SELECT argMax(person_distinct_id2.person_id, person_distinct_id2.version) AS person_id, person_distinct_id2.distinct_id AS distinct_id FROM person_distinct_id2 @@ -96,22 +435,29 @@ WHERE equals(events.team_id, 420) LIMIT 10 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event, timestamp, pdi.distinct_id, pdi.person_id + FROM events + LIMIT 10 ' --- # name: TestQuery.test_query_joins_events_pdi_e_person_properties ' + -- ClickHouse - SELECT e.event, toTimeZone(e.timestamp, %(hogql_val_1)s) AS timestamp, e__pdi.distinct_id, e__pdi__person.properties___sneaky_mail AS sneaky_mail + SELECT e.event AS event, toTimeZone(e.timestamp, %(hogql_val_1)s) AS timestamp, e__pdi.distinct_id AS distinct_id, e__pdi__person.properties___sneaky_mail AS sneaky_mail FROM events AS e INNER JOIN ( SELECT argMax(person_distinct_id2.person_id, person_distinct_id2.version) AS person_id, person_distinct_id2.distinct_id AS distinct_id FROM person_distinct_id2 WHERE equals(person_distinct_id2.team_id, 420) GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) INNER JOIN ( - SELECT person.id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', '') AS properties___sneaky_mail + SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', '') AS properties___sneaky_mail FROM person WHERE and(equals(person.team_id, 420), ifNull(in(tuple(person.id, person.version), ( - SELECT person.id, max(person.version) AS version + SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 420) GROUP BY person.id @@ -120,12 +466,19 @@ WHERE equals(e.team_id, 420) LIMIT 10 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event, e.timestamp, pdi.distinct_id, e.pdi.person.properties.sneaky_mail + FROM events AS e + LIMIT 10 ' --- # name: TestQuery.test_query_joins_events_pdi_person ' + -- ClickHouse - SELECT events.event, toTimeZone(events.timestamp, %(hogql_val_0)s) AS timestamp, events__pdi.distinct_id, events__pdi__person.id + SELECT events.event AS event, toTimeZone(events.timestamp, %(hogql_val_0)s) AS timestamp, events__pdi.distinct_id AS distinct_id, events__pdi__person.id AS id FROM events INNER JOIN ( SELECT argMax(person_distinct_id2.person_id, person_distinct_id2.version) AS person_id, person_distinct_id2.distinct_id AS distinct_id FROM person_distinct_id2 @@ -141,22 +494,29 @@ WHERE equals(events.team_id, 420) LIMIT 10 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event, timestamp, pdi.distinct_id, pdi.person.id + FROM events + LIMIT 10 ' --- # name: TestQuery.test_query_joins_events_pdi_person_properties ' + -- ClickHouse - SELECT events.event, toTimeZone(events.timestamp, %(hogql_val_1)s) AS timestamp, events__pdi.distinct_id, events__pdi__person.properties___sneaky_mail AS sneaky_mail + SELECT events.event AS event, toTimeZone(events.timestamp, %(hogql_val_1)s) AS timestamp, events__pdi.distinct_id AS distinct_id, events__pdi__person.properties___sneaky_mail AS sneaky_mail FROM events INNER JOIN ( SELECT argMax(person_distinct_id2.person_id, person_distinct_id2.version) AS person_id, person_distinct_id2.distinct_id AS distinct_id FROM person_distinct_id2 WHERE equals(person_distinct_id2.team_id, 420) GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS events__pdi ON equals(events.distinct_id, events__pdi.distinct_id) INNER JOIN ( - SELECT person.id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', '') AS properties___sneaky_mail + SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', '') AS properties___sneaky_mail FROM person WHERE and(equals(person.team_id, 420), ifNull(in(tuple(person.id, person.version), ( - SELECT person.id, max(person.version) AS version + SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 420) GROUP BY person.id @@ -165,22 +525,29 @@ WHERE equals(events.team_id, 420) LIMIT 10 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event, timestamp, pdi.distinct_id, pdi.person.properties.sneaky_mail + FROM events + LIMIT 10 ' --- # name: TestQuery.test_query_joins_events_person_properties ' + -- ClickHouse - SELECT e.event, toTimeZone(e.timestamp, %(hogql_val_1)s) AS timestamp, e__pdi__person.properties___sneaky_mail AS sneaky_mail + SELECT e.event AS event, toTimeZone(e.timestamp, %(hogql_val_1)s) AS timestamp, e__pdi__person.properties___sneaky_mail AS sneaky_mail FROM events AS e INNER JOIN ( SELECT argMax(person_distinct_id2.person_id, person_distinct_id2.version) AS person_id, person_distinct_id2.distinct_id AS distinct_id FROM person_distinct_id2 WHERE equals(person_distinct_id2.team_id, 420) GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) INNER JOIN ( - SELECT person.id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', '') AS properties___sneaky_mail + SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', '') AS properties___sneaky_mail FROM person WHERE and(equals(person.team_id, 420), ifNull(in(tuple(person.id, person.version), ( - SELECT person.id, max(person.version) AS version + SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 420) GROUP BY person.id @@ -189,10 +556,17 @@ WHERE equals(e.team_id, 420) LIMIT 10 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event, e.timestamp, e.pdi.person.properties.sneaky_mail + FROM events AS e + LIMIT 10 ' --- # name: TestQuery.test_query_joins_events_person_properties_in_aggregration ' + -- ClickHouse SELECT s__pdi__person.properties___sneaky_mail AS sneaky_mail, count() FROM events AS s INNER JOIN ( @@ -201,10 +575,10 @@ WHERE equals(person_distinct_id2.team_id, 420) GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS s__pdi ON equals(s.distinct_id, s__pdi.distinct_id) INNER JOIN ( - SELECT person.id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', '') AS properties___sneaky_mail + SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', '') AS properties___sneaky_mail FROM person WHERE and(equals(person.team_id, 420), ifNull(in(tuple(person.id, person.version), ( - SELECT person.id, max(person.version) AS version + SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 420) GROUP BY person.id @@ -214,14 +588,22 @@ GROUP BY s__pdi__person.properties___sneaky_mail LIMIT 10 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT s.pdi.person.properties.sneaky_mail, count() + FROM events AS s + GROUP BY s.pdi.person.properties.sneaky_mail + LIMIT 10 ' --- # name: TestQuery.test_query_joins_pdi ' + -- ClickHouse - SELECT e.event, toTimeZone(e.timestamp, %(hogql_val_0)s) AS timestamp, pdi.person_id + SELECT e.event AS event, toTimeZone(e.timestamp, %(hogql_val_0)s) AS timestamp, pdi.person_id AS person_id FROM events AS e INNER JOIN ( - SELECT person_distinct_id2.distinct_id, argMax(person_distinct_id2.person_id, person_distinct_id2.version) AS person_id + SELECT person_distinct_id2.distinct_id AS distinct_id, argMax(person_distinct_id2.person_id, person_distinct_id2.version) AS person_id FROM person_distinct_id2 WHERE equals(person_distinct_id2.team_id, 420) GROUP BY person_distinct_id2.distinct_id @@ -229,17 +611,28 @@ WHERE equals(e.team_id, 420) LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event, timestamp, pdi.person_id + FROM events AS e INNER JOIN ( + SELECT distinct_id, argMax(person_id, version) AS person_id + FROM raw_person_distinct_ids + GROUP BY distinct_id + HAVING equals(argMax(is_deleted, version), 0)) AS pdi ON equals(e.distinct_id, pdi.distinct_id) + LIMIT 100 ' --- # name: TestQuery.test_query_joins_pdi_person_properties ' + -- ClickHouse - SELECT pdi.distinct_id, pdi__person.properties___sneaky_mail AS sneaky_mail + SELECT pdi.distinct_id AS distinct_id, pdi__person.properties___sneaky_mail AS sneaky_mail FROM person_distinct_id2 AS pdi INNER JOIN ( - SELECT person.id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', '') AS properties___sneaky_mail + SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', '') AS properties___sneaky_mail FROM person WHERE and(equals(person.team_id, 420), ifNull(in(tuple(person.id, person.version), ( - SELECT person.id, max(person.version) AS version + SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 420) GROUP BY person.id @@ -248,12 +641,19 @@ WHERE equals(pdi.team_id, 420) LIMIT 10 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT pdi.distinct_id, pdi.person.properties.sneaky_mail + FROM person_distinct_ids AS pdi + LIMIT 10 ' --- # name: TestQuery.test_query_joins_pdi_persons ' + -- ClickHouse - SELECT pdi.distinct_id, toTimeZone(pdi__person.created_at, %(hogql_val_0)s) AS created_at + SELECT pdi.distinct_id AS distinct_id, toTimeZone(pdi__person.created_at, %(hogql_val_0)s) AS created_at FROM person_distinct_id2 AS pdi INNER JOIN ( SELECT argMax(person.created_at, person.version) AS created_at, person.id AS id FROM person @@ -264,22 +664,36 @@ WHERE equals(pdi.team_id, 420) LIMIT 10 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT pdi.distinct_id, pdi.person.created_at + FROM person_distinct_ids AS pdi + LIMIT 10 ' --- # name: TestQuery.test_query_joins_simple ' + -- ClickHouse - SELECT e.event, toTimeZone(e.timestamp, %(hogql_val_0)s) AS timestamp, pdi.distinct_id, p.id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(p.properties, %(hogql_val_1)s), ''), 'null'), '^"|"$', '') AS sneaky_mail + SELECT e.event AS event, toTimeZone(e.timestamp, %(hogql_val_0)s) AS timestamp, pdi.distinct_id AS distinct_id, p.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(p.properties, %(hogql_val_1)s), ''), 'null'), '^"|"$', '') AS sneaky_mail FROM events AS e LEFT JOIN person_distinct_id2 AS pdi ON equals(pdi.distinct_id, e.distinct_id) LEFT JOIN person AS p ON equals(p.id, pdi.person_id) WHERE and(equals(p.team_id, 420), equals(pdi.team_id, 420), equals(e.team_id, 420)) LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event, timestamp, pdi.distinct_id, p.id, p.properties.sneaky_mail + FROM events AS e LEFT JOIN person_distinct_ids AS pdi ON equals(pdi.distinct_id, e.distinct_id) LEFT JOIN persons AS p ON equals(p.id, pdi.person_id) + LIMIT 100 ' --- # name: TestQuery.test_query_person_distinct_ids ' + -- ClickHouse - SELECT DISTINCT person_distinct_ids.person_id, person_distinct_ids.distinct_id + SELECT DISTINCT person_distinct_ids.person_id AS person_id, person_distinct_ids.distinct_id AS distinct_id FROM ( SELECT argMax(person_distinct_id2.person_id, person_distinct_id2.version) AS person_id, person_distinct_id2.distinct_id AS distinct_id FROM person_distinct_id2 @@ -288,22 +702,29 @@ HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS person_distinct_ids LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT DISTINCT person_id, distinct_id + FROM person_distinct_ids + LIMIT 100 ' --- # name: TestQuery.test_query_select_person_with_joins_without_poe ' + -- ClickHouse - SELECT events.event, toTimeZone(events.timestamp, %(hogql_val_1)s) AS timestamp, events__pdi__person.id, events__pdi__person.properties___sneaky_mail AS sneaky_mail + SELECT events.event AS event, toTimeZone(events.timestamp, %(hogql_val_1)s) AS timestamp, events__pdi__person.id AS id, events__pdi__person.properties___sneaky_mail AS sneaky_mail FROM events INNER JOIN ( SELECT argMax(person_distinct_id2.person_id, person_distinct_id2.version) AS person_id, person_distinct_id2.distinct_id AS distinct_id FROM person_distinct_id2 WHERE equals(person_distinct_id2.team_id, 420) GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS events__pdi ON equals(events.distinct_id, events__pdi.distinct_id) INNER JOIN ( - SELECT person.id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', '') AS properties___sneaky_mail + SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', '') AS properties___sneaky_mail FROM person WHERE and(equals(person.team_id, 420), ifNull(in(tuple(person.id, person.version), ( - SELECT person.id, max(person.version) AS version + SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 420) GROUP BY person.id @@ -312,20 +733,34 @@ WHERE equals(events.team_id, 420) LIMIT 10 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event, timestamp, person.id, person.properties.sneaky_mail + FROM events + LIMIT 10 ' --- # name: TestQuery.test_query_select_person_with_poe_without_joins ' + -- ClickHouse - SELECT events.event, toTimeZone(events.timestamp, %(hogql_val_0)s) AS timestamp, events.person_id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, %(hogql_val_1)s), ''), 'null'), '^"|"$', '') AS sneaky_mail + SELECT events.event AS event, toTimeZone(events.timestamp, %(hogql_val_0)s) AS timestamp, events.person_id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.person_properties, %(hogql_val_1)s), ''), 'null'), '^"|"$', '') AS sneaky_mail FROM events WHERE equals(events.team_id, 420) LIMIT 10 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event, timestamp, person.id, person.properties.sneaky_mail + FROM events + LIMIT 10 ' --- # name: TestQuery.test_select_person_on_events ' + -- ClickHouse SELECT replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(s.person_properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', '') AS sneaky_mail, count() FROM events AS s @@ -333,42 +768,74 @@ GROUP BY replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(s.person_properties, %(hogql_val_1)s), ''), 'null'), '^"|"$', '') LIMIT 10 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT poe.properties.sneaky_mail, count() + FROM events AS s + GROUP BY poe.properties.sneaky_mail + LIMIT 10 ' --- # name: TestQuery.test_subquery ' + -- ClickHouse - SELECT count, event + SELECT count AS count, event AS event FROM ( - SELECT count() AS count, events.event + SELECT count() AS count, events.event AS event FROM events WHERE and(equals(events.team_id, 420), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', ''), %(hogql_val_1)s), 0)) GROUP BY events.event) GROUP BY count, event LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT count, event + FROM ( + SELECT count() AS count, event + FROM events + WHERE equals(properties.random_uuid, '016f8cc0-2400-0016-8a52-c803389c2009') + GROUP BY event) + GROUP BY count, event + LIMIT 100 ' --- # name: TestQuery.test_subquery_alias ' + -- ClickHouse - SELECT c.count, c.event + SELECT c.count AS count, c.event AS event FROM ( - SELECT count(*) AS count, events.event + SELECT count(*) AS count, events.event AS event FROM events WHERE and(equals(events.team_id, 420), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', ''), %(hogql_val_1)s), 0)) GROUP BY events.event) AS c GROUP BY c.count, c.event LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT count, event + FROM ( + SELECT count(*) AS count, event + FROM events + WHERE equals(properties.random_uuid, '016f8cc0-2400-0017-1ec4-f9ee72932a04') + GROUP BY event) AS c + GROUP BY count, event + LIMIT 100 ' --- # name: TestQuery.test_tuple_access ' + -- ClickHouse - SELECT col_a, arrayZip((sumMap((g).1, (g).2) AS x).1, x.2) AS r + SELECT col_a AS col_a, arrayZip((sumMap((g).1, (g).2) AS x).1, x.2) AS r FROM ( - SELECT col_a, groupArray(tuple(col_b, col_c)) AS g + SELECT col_a AS col_a, groupArray(tuple(col_b, col_c)) AS g FROM ( SELECT replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', '') AS col_a, events.event AS col_b, count() AS col_c FROM events @@ -378,16 +845,30 @@ GROUP BY col_a ORDER BY col_a ASC LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT col_a, arrayZip((sumMap((g).1, (g).2) AS x).1, x.2) AS r + FROM ( + SELECT col_a, groupArray(tuple(col_b, col_c)) AS g + FROM ( + SELECT properties.index AS col_a, event AS col_b, count() AS col_c + FROM events + GROUP BY properties.index, event) + GROUP BY col_a) + GROUP BY col_a ORDER BY col_a ASC + LIMIT 100 ' --- # name: TestQuery.test_with_pivot_table_1_level ' + -- ClickHouse - SELECT PIVOT_FUNCTION_2.col_a, PIVOT_FUNCTION_2.r + SELECT PIVOT_FUNCTION_2.col_a AS col_a, PIVOT_FUNCTION_2.r AS r FROM ( - SELECT PIVOT_FUNCTION_1.col_a, arrayZip((sumMap((PIVOT_FUNCTION_1.g).1, (PIVOT_FUNCTION_1.g).2) AS x).1, x.2) AS r + SELECT PIVOT_FUNCTION_1.col_a AS col_a, arrayZip((sumMap((PIVOT_FUNCTION_1.g).1, (PIVOT_FUNCTION_1.g).2) AS x).1, x.2) AS r FROM ( - SELECT PIVOT_TABLE_COL_ABC.col_a, groupArray(tuple(PIVOT_TABLE_COL_ABC.col_b, PIVOT_TABLE_COL_ABC.col_c)) AS g + SELECT PIVOT_TABLE_COL_ABC.col_a AS col_a, groupArray(tuple(PIVOT_TABLE_COL_ABC.col_b, PIVOT_TABLE_COL_ABC.col_c)) AS g FROM ( SELECT replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', '') AS col_a, events.event AS col_b, count() AS col_c FROM events @@ -397,18 +878,34 @@ GROUP BY PIVOT_FUNCTION_1.col_a) AS PIVOT_FUNCTION_2 ORDER BY PIVOT_FUNCTION_2.col_a ASC LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT col_a, r + FROM ( + SELECT col_a, arrayZip((sumMap((g).1, (g).2) AS x).1, x.2) AS r + FROM ( + SELECT col_a, groupArray(tuple(col_b, col_c)) AS g + FROM ( + SELECT properties.index AS col_a, event AS col_b, count() AS col_c + FROM events + GROUP BY properties.index, event) AS PIVOT_TABLE_COL_ABC + GROUP BY col_a) AS PIVOT_FUNCTION_1 + GROUP BY col_a) AS PIVOT_FUNCTION_2 ORDER BY col_a ASC + LIMIT 100 ' --- # name: TestQuery.test_with_pivot_table_2_levels ' + -- ClickHouse - SELECT final.col_a, final.r + SELECT final.col_a AS col_a, final.r AS r FROM ( - SELECT PIVOT_FUNCTION_2.col_a, PIVOT_FUNCTION_2.r + SELECT PIVOT_FUNCTION_2.col_a AS col_a, PIVOT_FUNCTION_2.r AS r FROM ( - SELECT PIVOT_FUNCTION_1.col_a, arrayZip((sumMap((PIVOT_FUNCTION_1.g).1, (PIVOT_FUNCTION_1.g).2) AS x).1, x.2) AS r + SELECT PIVOT_FUNCTION_1.col_a AS col_a, arrayZip((sumMap((PIVOT_FUNCTION_1.g).1, (PIVOT_FUNCTION_1.g).2) AS x).1, x.2) AS r FROM ( - SELECT PIVOT_TABLE_COL_ABC.col_a, groupArray(tuple(PIVOT_TABLE_COL_ABC.col_b, PIVOT_TABLE_COL_ABC.col_c)) AS g + SELECT PIVOT_TABLE_COL_ABC.col_a AS col_a, groupArray(tuple(PIVOT_TABLE_COL_ABC.col_b, PIVOT_TABLE_COL_ABC.col_c)) AS g FROM ( SELECT replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', '') AS col_a, events.event AS col_b, count() AS col_c FROM events @@ -418,5 +915,22 @@ GROUP BY PIVOT_FUNCTION_1.col_a) AS PIVOT_FUNCTION_2) AS final ORDER BY final.col_a ASC LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT col_a, r + FROM ( + SELECT col_a, r + FROM ( + SELECT col_a, arrayZip((sumMap((g).1, (g).2) AS x).1, x.2) AS r + FROM ( + SELECT col_a, groupArray(tuple(col_b, col_c)) AS g + FROM ( + SELECT properties.index AS col_a, event AS col_b, count() AS col_c + FROM events + GROUP BY properties.index, event) AS PIVOT_TABLE_COL_ABC + GROUP BY col_a) AS PIVOT_FUNCTION_1 + GROUP BY col_a) AS PIVOT_FUNCTION_2) AS final ORDER BY col_a ASC + LIMIT 100 ' --- diff --git a/posthog/hogql/test/test_modifiers.py b/posthog/hogql/test/test_modifiers.py index 9e253c30042af..4dab98bde188a 100644 --- a/posthog/hogql/test/test_modifiers.py +++ b/posthog/hogql/test/test_modifiers.py @@ -48,30 +48,30 @@ def test_modifiers_persons_on_events_mode_mapping(self): test_cases = [ ( PersonsOnEventsMode.disabled, - "events.event", - "events__pdi__person.id", - "events__pdi__person.properties", + "events.event AS event", + "events__pdi__person.id AS id", + "events__pdi__person.properties AS properties", "toTimeZone(events__pdi__person.created_at, %(hogql_val_0)s) AS created_at", ), ( PersonsOnEventsMode.v1_enabled, - "events.event", - "events.person_id", - "events.person_properties", + "events.event AS event", + "events.person_id AS id", + "events.person_properties AS properties", "toTimeZone(events.person_created_at, %(hogql_val_0)s) AS created_at", ), ( PersonsOnEventsMode.v1_mixed, - "events.event", - "events__pdi.person_id", - "events.person_properties", + "events.event AS event", + "events__pdi.person_id AS id", + "events.person_properties AS properties", "toTimeZone(events__pdi__person.created_at, %(hogql_val_0)s) AS created_at", ), ( PersonsOnEventsMode.v2_enabled, - "events.event", + "events.event AS event", "ifNull(nullIf(events__override.override_person_id, %(hogql_val_0)s), events.person_id) AS id", - "events.person_properties", + "events.person_properties AS properties", "toTimeZone(events.person_created_at, %(hogql_val_1)s) AS created_at", ), ] diff --git a/posthog/hogql/test/test_printer.py b/posthog/hogql/test/test_printer.py index aad813fd8b373..da921c154f498 100644 --- a/posthog/hogql/test/test_printer.py +++ b/posthog/hogql/test/test_printer.py @@ -613,93 +613,93 @@ def test_select_prewhere(self): def test_select_order_by(self): self.assertEqual( self._select("select event from events order by event"), - f"SELECT events.event FROM events WHERE equals(events.team_id, {self.team.pk}) ORDER BY events.event ASC LIMIT 10000", + f"SELECT events.event AS event FROM events WHERE equals(events.team_id, {self.team.pk}) ORDER BY events.event ASC LIMIT 10000", ) self.assertEqual( self._select("select event from events order by event desc"), - f"SELECT events.event FROM events WHERE equals(events.team_id, {self.team.pk}) ORDER BY events.event DESC LIMIT 10000", + f"SELECT events.event AS event FROM events WHERE equals(events.team_id, {self.team.pk}) ORDER BY events.event DESC LIMIT 10000", ) self.assertEqual( self._select("select event from events order by event desc, timestamp"), - f"SELECT events.event FROM events WHERE equals(events.team_id, {self.team.pk}) ORDER BY events.event DESC, toTimeZone(events.timestamp, %(hogql_val_0)s) ASC LIMIT 10000", + f"SELECT events.event AS event FROM events WHERE equals(events.team_id, {self.team.pk}) ORDER BY events.event DESC, toTimeZone(events.timestamp, %(hogql_val_0)s) ASC LIMIT 10000", ) def test_select_limit(self): self.assertEqual( self._select("select event from events limit 10"), - f"SELECT events.event FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT 10", + f"SELECT events.event AS event FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT 10", ) self.assertEqual( self._select("select event from events limit 1000000"), - f"SELECT events.event FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT 10000", + f"SELECT events.event AS event FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT 10000", ) self.assertEqual( self._select("select event from events limit (select 100000000)"), - f"SELECT events.event FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT min2(10000, (SELECT 100000000))", + f"SELECT events.event AS event FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT min2(10000, (SELECT 100000000))", ) self.assertEqual( self._select("select event from events limit (select 100000000) with ties"), - f"SELECT events.event FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT min2(10000, (SELECT 100000000)) WITH TIES", + f"SELECT events.event AS event FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT min2(10000, (SELECT 100000000)) WITH TIES", ) def test_select_offset(self): # Only the default limit if OFFSET is specified alone self.assertEqual( self._select("select event from events offset 10"), - f"SELECT events.event FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT 10000 OFFSET 10", + f"SELECT events.event AS event FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT 10000 OFFSET 10", ) self.assertEqual( self._select("select event from events limit 10 offset 10"), - f"SELECT events.event FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT 10 OFFSET 10", + f"SELECT events.event AS event FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT 10 OFFSET 10", ) self.assertEqual( self._select("select event from events limit 10 offset 0"), - f"SELECT events.event FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT 10 OFFSET 0", + f"SELECT events.event AS event FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT 10 OFFSET 0", ) self.assertEqual( self._select("select event from events limit 10 with ties offset 0"), - f"SELECT events.event FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT 10 WITH TIES OFFSET 0", + f"SELECT events.event AS event FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT 10 WITH TIES OFFSET 0", ) def test_select_limit_by(self): self.assertEqual( self._select("select event from events limit 10 offset 0 by 1,event"), - f"SELECT events.event FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT 10 OFFSET 0 BY 1, events.event", + f"SELECT events.event AS event FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT 10 OFFSET 0 BY 1, events.event", ) def test_select_group_by(self): self.assertEqual( self._select("select event from events group by event, timestamp"), - f"SELECT events.event FROM events WHERE equals(events.team_id, {self.team.pk}) GROUP BY events.event, toTimeZone(events.timestamp, %(hogql_val_0)s) LIMIT 10000", + f"SELECT events.event AS event FROM events WHERE equals(events.team_id, {self.team.pk}) GROUP BY events.event, toTimeZone(events.timestamp, %(hogql_val_0)s) LIMIT 10000", ) def test_select_distinct(self): self.assertEqual( self._select("select distinct event from events group by event, timestamp"), - f"SELECT DISTINCT events.event FROM events WHERE equals(events.team_id, {self.team.pk}) GROUP BY events.event, toTimeZone(events.timestamp, %(hogql_val_0)s) LIMIT 10000", + f"SELECT DISTINCT events.event AS event FROM events WHERE equals(events.team_id, {self.team.pk}) GROUP BY events.event, toTimeZone(events.timestamp, %(hogql_val_0)s) LIMIT 10000", ) def test_select_subquery(self): self.assertEqual( self._select("SELECT event from (select distinct event from events group by event, timestamp)"), - f"SELECT event FROM (SELECT DISTINCT events.event FROM events WHERE equals(events.team_id, {self.team.pk}) GROUP BY events.event, toTimeZone(events.timestamp, %(hogql_val_0)s)) LIMIT 10000", + f"SELECT event AS event FROM (SELECT DISTINCT events.event AS event FROM events WHERE equals(events.team_id, {self.team.pk}) GROUP BY events.event, toTimeZone(events.timestamp, %(hogql_val_0)s)) LIMIT 10000", ) self.assertEqual( self._select("SELECT event from (select distinct event from events group by event, timestamp) e"), - f"SELECT e.event FROM (SELECT DISTINCT events.event FROM events WHERE equals(events.team_id, {self.team.pk}) GROUP BY events.event, toTimeZone(events.timestamp, %(hogql_val_0)s)) AS e LIMIT 10000", + f"SELECT e.event AS event FROM (SELECT DISTINCT events.event AS event FROM events WHERE equals(events.team_id, {self.team.pk}) GROUP BY events.event, toTimeZone(events.timestamp, %(hogql_val_0)s)) AS e LIMIT 10000", ) def test_select_union_all(self): self.assertEqual( self._select("SELECT events.event FROM events UNION ALL SELECT events.event FROM events WHERE 1 = 2"), - f"SELECT events.event FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT 10000 UNION ALL SELECT events.event FROM events WHERE and(equals(events.team_id, {self.team.pk}), 0) LIMIT 10000", + f"SELECT events.event AS event FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT 10000 UNION ALL SELECT events.event AS event FROM events WHERE and(equals(events.team_id, {self.team.pk}), 0) LIMIT 10000", ) self.assertEqual( self._select( "SELECT events.event FROM events UNION ALL SELECT events.event FROM events WHERE 1 = 2 UNION ALL SELECT events.event FROM events WHERE 1 = 2" ), - f"SELECT events.event FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT 10000 UNION ALL SELECT events.event FROM events WHERE and(equals(events.team_id, {self.team.pk}), 0) LIMIT 10000 UNION ALL SELECT events.event FROM events WHERE and(equals(events.team_id, {self.team.pk}), 0) LIMIT 10000", + f"SELECT events.event AS event FROM events WHERE equals(events.team_id, {self.team.pk}) LIMIT 10000 UNION ALL SELECT events.event AS event FROM events WHERE and(equals(events.team_id, {self.team.pk}), 0) LIMIT 10000 UNION ALL SELECT events.event AS event FROM events WHERE and(equals(events.team_id, {self.team.pk}), 0) LIMIT 10000", ) self.assertEqual( self._select("SELECT 1 UNION ALL (SELECT 1 UNION ALL SELECT 1) UNION ALL SELECT 1"), @@ -717,17 +717,17 @@ def test_select_union_all(self): def test_select_sample(self): self.assertEqual( self._select("SELECT events.event FROM events SAMPLE 1"), - f"SELECT events.event FROM events SAMPLE 1 WHERE equals(events.team_id, {self.team.pk}) LIMIT 10000", + f"SELECT events.event AS event FROM events SAMPLE 1 WHERE equals(events.team_id, {self.team.pk}) LIMIT 10000", ) self.assertEqual( self._select("SELECT events.event FROM events SAMPLE 0.1 OFFSET 1/10"), - f"SELECT events.event FROM events SAMPLE 0.1 OFFSET 1/10 WHERE equals(events.team_id, {self.team.pk}) LIMIT 10000", + f"SELECT events.event AS event FROM events SAMPLE 0.1 OFFSET 1/10 WHERE equals(events.team_id, {self.team.pk}) LIMIT 10000", ) self.assertEqual( self._select("SELECT events.event FROM events SAMPLE 2/78 OFFSET 999"), - f"SELECT events.event FROM events SAMPLE 2/78 OFFSET 999 WHERE equals(events.team_id, {self.team.pk}) LIMIT 10000", + f"SELECT events.event AS event FROM events SAMPLE 2/78 OFFSET 999 WHERE equals(events.team_id, {self.team.pk}) LIMIT 10000", ) with override_settings(PERSON_ON_EVENTS_V2_OVERRIDE=False): @@ -741,13 +741,13 @@ def test_select_sample(self): "SELECT events.event FROM events SAMPLE 2/78 OFFSET 999 JOIN persons ON persons.id=events.person_id", context, ), - f"SELECT events.event FROM events SAMPLE 2/78 OFFSET 999 INNER JOIN (SELECT argMax(person_distinct_id2.person_id, " + f"SELECT events.event AS event FROM events SAMPLE 2/78 OFFSET 999 INNER JOIN (SELECT argMax(person_distinct_id2.person_id, " f"person_distinct_id2.version) AS person_id, person_distinct_id2.distinct_id AS distinct_id FROM person_distinct_id2 " f"WHERE equals(person_distinct_id2.team_id, {self.team.pk}) GROUP BY person_distinct_id2.distinct_id HAVING " f"ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS events__pdi " - f"ON equals(events.distinct_id, events__pdi.distinct_id) JOIN (SELECT person.id FROM person " + f"ON equals(events.distinct_id, events__pdi.distinct_id) JOIN (SELECT person.id AS id FROM person " f"WHERE and(equals(person.team_id, {self.team.pk}), ifNull(in(tuple(person.id, person.version), " - f"(SELECT person.id, max(person.version) AS version FROM person WHERE equals(person.team_id, {self.team.pk}) " + f"(SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, {self.team.pk}) " f"GROUP BY person.id HAVING ifNull(equals(argMax(person.is_deleted, person.version), 0), 0))), 0)) " f"SETTINGS optimize_aggregation_in_order=1) AS persons ON equals(persons.id, events__pdi.person_id) " f"WHERE equals(events.team_id, {self.team.pk}) LIMIT 10000", @@ -763,12 +763,12 @@ def test_select_sample(self): "SELECT events.event FROM events SAMPLE 2/78 OFFSET 999 JOIN persons SAMPLE 0.1 ON persons.id=events.person_id", context, ), - f"SELECT events.event FROM events SAMPLE 2/78 OFFSET 999 INNER JOIN (SELECT argMax(person_distinct_id2.person_id, " + f"SELECT events.event AS event FROM events SAMPLE 2/78 OFFSET 999 INNER JOIN (SELECT argMax(person_distinct_id2.person_id, " f"person_distinct_id2.version) AS person_id, person_distinct_id2.distinct_id AS distinct_id FROM person_distinct_id2 " f"WHERE equals(person_distinct_id2.team_id, {self.team.pk}) GROUP BY person_distinct_id2.distinct_id HAVING " f"ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS events__pdi " - f"ON equals(events.distinct_id, events__pdi.distinct_id) JOIN (SELECT person.id FROM person WHERE " - f"and(equals(person.team_id, {self.team.pk}), ifNull(in(tuple(person.id, person.version), (SELECT person.id, " + f"ON equals(events.distinct_id, events__pdi.distinct_id) JOIN (SELECT person.id AS id FROM person WHERE " + f"and(equals(person.team_id, {self.team.pk}), ifNull(in(tuple(person.id, person.version), (SELECT person.id AS id, " f"max(person.version) AS version FROM person WHERE equals(person.team_id, {self.team.pk}) GROUP BY person.id " f"HAVING ifNull(equals(argMax(person.is_deleted, person.version), 0), 0))), 0)) SETTINGS optimize_aggregation_in_order=1) " f"AS persons SAMPLE 0.1 ON equals(persons.id, events__pdi.person_id) WHERE equals(events.team_id, {self.team.pk}) LIMIT 10000", @@ -786,8 +786,8 @@ def test_select_sample(self): ) self.assertEqual( expected, - f"SELECT events.event FROM events SAMPLE 2/78 OFFSET 999 JOIN (SELECT person.id FROM person WHERE " - f"and(equals(person.team_id, {self.team.pk}), ifNull(in(tuple(person.id, person.version), (SELECT person.id, " + f"SELECT events.event AS event FROM events SAMPLE 2/78 OFFSET 999 JOIN (SELECT person.id AS id FROM person WHERE " + f"and(equals(person.team_id, {self.team.pk}), ifNull(in(tuple(person.id, person.version), (SELECT person.id AS id, " f"max(person.version) AS version FROM person WHERE equals(person.team_id, {self.team.pk}) GROUP BY person.id " f"HAVING ifNull(equals(argMax(person.is_deleted, person.version), 0), 0))), 0)) SETTINGS optimize_aggregation_in_order=1) " f"AS persons ON equals(persons.id, events.person_id) WHERE equals(events.team_id, {self.team.pk}) LIMIT 10000", @@ -804,8 +804,8 @@ def test_select_sample(self): ) self.assertEqual( expected, - f"SELECT events.event FROM events SAMPLE 2/78 OFFSET 999 JOIN (SELECT person.id FROM person WHERE " - f"and(equals(person.team_id, {self.team.pk}), ifNull(in(tuple(person.id, person.version), (SELECT person.id, " + f"SELECT events.event AS event FROM events SAMPLE 2/78 OFFSET 999 JOIN (SELECT person.id AS id FROM person WHERE " + f"and(equals(person.team_id, {self.team.pk}), ifNull(in(tuple(person.id, person.version), (SELECT person.id AS id, " f"max(person.version) AS version FROM person WHERE equals(person.team_id, {self.team.pk}) GROUP BY person.id " f"HAVING ifNull(equals(argMax(person.is_deleted, person.version), 0), 0))), 0)) SETTINGS optimize_aggregation_in_order=1) " f"AS persons SAMPLE 0.1 ON equals(persons.id, events.person_id) WHERE equals(events.team_id, {self.team.pk}) LIMIT 10000", @@ -895,7 +895,7 @@ def test_window_functions(self): self._select( "SELECT distinct_id, min(timestamp) over win1 as timestamp FROM events WINDOW win1 as (PARTITION by distinct_id ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING)" ), - f"SELECT events.distinct_id, min(toTimeZone(events.timestamp, %(hogql_val_0)s)) OVER win1 AS timestamp FROM events WHERE equals(events.team_id, {self.team.pk}) WINDOW win1 AS (PARTITION BY events.distinct_id ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) LIMIT 10000", + f"SELECT events.distinct_id AS distinct_id, min(toTimeZone(events.timestamp, %(hogql_val_0)s)) OVER win1 AS timestamp FROM events WHERE equals(events.team_id, {self.team.pk}) WINDOW win1 AS (PARTITION BY events.distinct_id ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) LIMIT 10000", ) def test_window_functions_with_window(self): @@ -903,7 +903,7 @@ def test_window_functions_with_window(self): self._select( "SELECT distinct_id, min(timestamp) over win1 as timestamp FROM events WINDOW win1 as (PARTITION by distinct_id ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING)" ), - f"SELECT events.distinct_id, min(toTimeZone(events.timestamp, %(hogql_val_0)s)) OVER win1 AS timestamp FROM events WHERE equals(events.team_id, {self.team.pk}) WINDOW win1 AS (PARTITION BY events.distinct_id ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) LIMIT 10000", + f"SELECT events.distinct_id AS distinct_id, min(toTimeZone(events.timestamp, %(hogql_val_0)s)) OVER win1 AS timestamp FROM events WHERE equals(events.team_id, {self.team.pk}) WINDOW win1 AS (PARTITION BY events.distinct_id ORDER BY timestamp DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) LIMIT 10000", ) def test_nullish_concat(self): @@ -1291,7 +1291,7 @@ def test_print_hidden_aliases_timestamp(self): ) self.assertEqual( printed, - f"SELECT timestamp FROM (SELECT toTimeZone(events.timestamp, %(hogql_val_0)s), " + f"SELECT timestamp AS timestamp FROM (SELECT toTimeZone(events.timestamp, %(hogql_val_0)s), " f"toTimeZone(events.timestamp, %(hogql_val_1)s) AS timestamp FROM events WHERE equals(events.team_id, {self.team.pk})) " f"LIMIT 10000 SETTINGS readonly=2, max_execution_time=10, allow_experimental_object_type=1", ) @@ -1306,7 +1306,7 @@ def test_print_hidden_aliases_column_override(self): ) self.assertEqual( printed, - f"SELECT event FROM (SELECT toTimeZone(events.timestamp, %(hogql_val_0)s) AS event, " + f"SELECT event AS event FROM (SELECT toTimeZone(events.timestamp, %(hogql_val_0)s) AS event, " f"event FROM events WHERE equals(events.team_id, {self.team.pk})) " f"LIMIT 10000 SETTINGS readonly=2, max_execution_time=10, allow_experimental_object_type=1", ) @@ -1329,7 +1329,7 @@ def test_print_hidden_aliases_properties(self): ) self.assertEqual( printed, - f"SELECT `$browser` FROM (SELECT nullIf(nullIf(events.`mat_$browser`, ''), 'null') AS `$browser` " + f"SELECT `$browser` AS `$browser` FROM (SELECT nullIf(nullIf(events.`mat_$browser`, ''), 'null') AS `$browser` " f"FROM events WHERE equals(events.team_id, {self.team.pk})) LIMIT 10000 " f"SETTINGS readonly=2, max_execution_time=10, allow_experimental_object_type=1", ) @@ -1352,7 +1352,7 @@ def test_print_hidden_aliases_double_property(self): ) self.assertEqual( printed, - f"SELECT `$browser` FROM (SELECT nullIf(nullIf(events.`mat_$browser`, ''), 'null'), " + f"SELECT `$browser` AS `$browser` FROM (SELECT nullIf(nullIf(events.`mat_$browser`, ''), 'null'), " f"nullIf(nullIf(events.`mat_$browser`, ''), 'null') AS `$browser` " # only the second one gets the alias f"FROM events WHERE equals(events.team_id, {self.team.pk})) LIMIT 10000 " f"SETTINGS readonly=2, max_execution_time=10, allow_experimental_object_type=1", diff --git a/posthog/hogql/test/test_query.py b/posthog/hogql/test/test_query.py index 7f9d9fe65e99e..6f31a97ed5ea1 100644 --- a/posthog/hogql/test/test_query.py +++ b/posthog/hogql/test/test_query.py @@ -11,7 +11,7 @@ from posthog.hogql.errors import SyntaxException, HogQLException from posthog.hogql.property import property_to_expr from posthog.hogql.query import execute_hogql_query -from posthog.hogql.test.utils import pretty_print_in_tests +from posthog.hogql.test.utils import pretty_print_in_tests, pretty_print_response_in_tests from posthog.models import Cohort from posthog.models.cohort.util import recalculate_cohortpeople from posthog.models.utils import UUIDT @@ -65,11 +65,7 @@ def test_query(self): placeholders={"random_uuid": ast.Constant(value=random_uuid)}, team=self.team, ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot - self.assertEqual( - response.hogql, - f"SELECT count(), event FROM events WHERE equals(properties.random_uuid, '{random_uuid}') GROUP BY event LIMIT 100", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertEqual(response.results, [(2, "random event")]) @pytest.mark.usefixtures("unittest_snapshot") @@ -82,11 +78,7 @@ def test_subquery(self): placeholders={"random_uuid": ast.Constant(value=random_uuid)}, team=self.team, ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot - self.assertEqual( - response.hogql, - f"SELECT count, event FROM (SELECT count() AS count, event FROM events WHERE equals(properties.random_uuid, '{random_uuid}') GROUP BY event) GROUP BY count, event LIMIT 100", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertEqual(response.results, [(2, "random event")]) @pytest.mark.usefixtures("unittest_snapshot") @@ -99,11 +91,7 @@ def test_subquery_alias(self): placeholders={"random_uuid": ast.Constant(value=random_uuid)}, team=self.team, ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot - self.assertEqual( - response.hogql, - f"SELECT count, event FROM (SELECT count(*) AS count, event FROM events WHERE equals(properties.random_uuid, '{random_uuid}') GROUP BY event) AS c GROUP BY count, event LIMIT 100", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertEqual(response.results, [(2, "random event")]) @pytest.mark.usefixtures("unittest_snapshot") @@ -116,11 +104,7 @@ def test_query_distinct(self): placeholders={"random_uuid": ast.Constant(value=random_uuid)}, team=self.team, ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot - self.assertEqual( - response.hogql, - f"SELECT DISTINCT properties.sneaky_mail FROM persons WHERE equals(properties.random_uuid, '{random_uuid}') LIMIT 100", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertEqual(response.results, [("tim@posthog.com",)]) @pytest.mark.usefixtures("unittest_snapshot") @@ -131,11 +115,7 @@ def test_query_person_distinct_ids(self): f"select distinct person_id, distinct_id from person_distinct_ids", self.team, ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot - self.assertEqual( - response.hogql, - "SELECT DISTINCT person_id, distinct_id FROM person_distinct_ids LIMIT 100", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertTrue(len(response.results) > 0) def test_query_timings(self): @@ -166,11 +146,7 @@ def test_query_joins_simple(self): """, self.team, ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot - self.assertEqual( - response.hogql, - "SELECT event, timestamp, pdi.distinct_id, p.id, p.properties.sneaky_mail FROM events AS e LEFT JOIN person_distinct_ids AS pdi ON equals(pdi.distinct_id, e.distinct_id) LEFT JOIN persons AS p ON equals(p.id, pdi.person_id) LIMIT 100", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertEqual(response.results[0][0], "random event") self.assertEqual(response.results[0][2], "bla") self.assertEqual(response.results[0][4], "tim@posthog.com") @@ -195,11 +171,7 @@ def test_query_joins_pdi(self): self.team, ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot - self.assertEqual( - response.hogql, - "SELECT event, timestamp, pdi.person_id FROM events AS e INNER JOIN (SELECT distinct_id, argMax(person_id, version) AS person_id FROM raw_person_distinct_ids GROUP BY distinct_id HAVING equals(argMax(is_deleted, version), 0)) AS pdi ON equals(e.distinct_id, pdi.distinct_id) LIMIT 100", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertTrue(len(response.results) > 0) @pytest.mark.usefixtures("unittest_snapshot") @@ -211,11 +183,7 @@ def test_query_joins_events_pdi(self): "SELECT event, timestamp, pdi.distinct_id, pdi.person_id FROM events LIMIT 10", self.team, ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot - self.assertEqual( - response.hogql, - "SELECT event, timestamp, pdi.distinct_id, pdi.person_id FROM events LIMIT 10", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertEqual(response.results[0][0], "random event") self.assertEqual(response.results[0][2], "bla") self.assertEqual(response.results[0][3], UUID("00000000-0000-4000-8000-000000000000")) @@ -233,7 +201,7 @@ def test_query_joins_events_e_pdi(self): response.hogql, "SELECT event, e.timestamp, e.pdi.distinct_id, pdi.person_id FROM events AS e LIMIT 10", ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertEqual(response.results[0][0], "random event") self.assertEqual(response.results[0][2], "bla") self.assertEqual(response.results[0][3], UUID("00000000-0000-4000-8000-000000000000")) @@ -251,7 +219,7 @@ def test_query_joins_pdi_persons(self): response.hogql, "SELECT pdi.distinct_id, pdi.person.created_at FROM person_distinct_ids AS pdi LIMIT 10", ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertEqual(response.results[0][0], "bla") self.assertEqual( response.results[0][1], @@ -271,7 +239,7 @@ def test_query_joins_pdi_person_properties(self): response.hogql, "SELECT pdi.distinct_id, pdi.person.properties.sneaky_mail FROM person_distinct_ids AS pdi LIMIT 10", ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertEqual(response.results[0][0], "bla") self.assertEqual(response.results[0][1], "tim@posthog.com") @@ -284,11 +252,7 @@ def test_query_joins_events_pdi_person(self): "SELECT event, timestamp, pdi.distinct_id, pdi.person.id FROM events LIMIT 10", self.team, ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot - self.assertEqual( - response.hogql, - "SELECT event, timestamp, pdi.distinct_id, pdi.person.id FROM events LIMIT 10", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertEqual(response.results[0][0], "random event") self.assertEqual(response.results[0][2], "bla") self.assertEqual(response.results[0][3], UUID("00000000-0000-4000-8000-000000000000")) @@ -303,11 +267,7 @@ def test_query_joins_events_pdi_person_properties(self): "SELECT event, timestamp, pdi.distinct_id, pdi.person.properties.sneaky_mail FROM events LIMIT 10", self.team, ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot - self.assertEqual( - response.hogql, - "SELECT event, timestamp, pdi.distinct_id, pdi.person.properties.sneaky_mail FROM events LIMIT 10", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertEqual(response.results[0][0], "random event") self.assertEqual(response.results[0][2], "bla") self.assertEqual(response.results[0][3], "tim@posthog.com") @@ -321,11 +281,7 @@ def test_query_joins_events_pdi_e_person_properties(self): "SELECT event, e.timestamp, pdi.distinct_id, e.pdi.person.properties.sneaky_mail FROM events e LIMIT 10", self.team, ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot - self.assertEqual( - response.hogql, - "SELECT event, e.timestamp, pdi.distinct_id, e.pdi.person.properties.sneaky_mail FROM events AS e LIMIT 10", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertEqual(response.results[0][0], "random event") self.assertEqual(response.results[0][2], "bla") self.assertEqual(response.results[0][3], "tim@posthog.com") @@ -339,11 +295,7 @@ def test_query_joins_events_person_properties(self): "SELECT event, e.timestamp, e.pdi.person.properties.sneaky_mail FROM events e LIMIT 10", self.team, ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot - self.assertEqual( - response.hogql, - "SELECT event, e.timestamp, e.pdi.person.properties.sneaky_mail FROM events AS e LIMIT 10", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertEqual(response.results[0][0], "random event") self.assertEqual(response.results[0][2], "tim@posthog.com") @@ -355,11 +307,7 @@ def test_query_joins_events_person_properties_in_aggregration(self): "SELECT s.pdi.person.properties.sneaky_mail, count() FROM events s GROUP BY s.pdi.person.properties.sneaky_mail LIMIT 10", self.team, ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot - self.assertEqual( - response.hogql, - "SELECT s.pdi.person.properties.sneaky_mail, count() FROM events AS s GROUP BY s.pdi.person.properties.sneaky_mail LIMIT 10", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertEqual(response.results[0][0], "tim@posthog.com") @pytest.mark.usefixtures("unittest_snapshot") @@ -370,11 +318,7 @@ def test_select_person_on_events(self): "SELECT poe.properties.sneaky_mail, count() FROM events s GROUP BY poe.properties.sneaky_mail LIMIT 10", self.team, ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot - self.assertEqual( - response.hogql, - "SELECT poe.properties.sneaky_mail, count() FROM events AS s GROUP BY poe.properties.sneaky_mail LIMIT 10", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertEqual(response.results[0][0], "tim@posthog.com") @pytest.mark.usefixtures("unittest_snapshot") @@ -387,11 +331,7 @@ def test_query_select_person_with_joins_without_poe(self): "SELECT event, timestamp, person.id, person.properties.sneaky_mail FROM events LIMIT 10", self.team, ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot - self.assertEqual( - response.hogql, - "SELECT event, timestamp, person.id, person.properties.sneaky_mail FROM events LIMIT 10", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertEqual(response.results[0][0], "random event") self.assertEqual(response.results[0][2], UUID("00000000-0000-4000-8000-000000000000")) self.assertEqual(response.results[0][3], "tim@posthog.com") @@ -406,15 +346,12 @@ def test_query_select_person_with_poe_without_joins(self): "SELECT event, timestamp, person.id, person.properties.sneaky_mail FROM events LIMIT 10", self.team, ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot - self.assertEqual( - response.hogql, - "SELECT event, timestamp, person.id, person.properties.sneaky_mail FROM events LIMIT 10", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertEqual(response.results[0][0], "random event") self.assertEqual(response.results[0][2], UUID("00000000-0000-4000-8000-000000000000")) self.assertEqual(response.results[0][3], "tim@posthog.com") + @pytest.mark.usefixtures("unittest_snapshot") def test_prop_cohort_basic(self): with freeze_time("2020-01-10"): _create_person( @@ -467,10 +404,7 @@ def test_prop_cohort_basic(self): ) }, ) - self.assertEqual( - response.clickhouse, - f"SELECT events.event, count() FROM events INNER JOIN (SELECT argMax(person_distinct_id2.person_id, person_distinct_id2.version) AS person_id, person_distinct_id2.distinct_id AS distinct_id FROM person_distinct_id2 WHERE equals(person_distinct_id2.team_id, {self.team.pk}) GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS events__pdi ON equals(events.distinct_id, events__pdi.distinct_id) WHERE and(equals(events.team_id, {self.team.pk}), ifNull(in(events__pdi.person_id, (SELECT cohortpeople.person_id FROM cohortpeople WHERE and(equals(cohortpeople.team_id, {self.team.pk}), equals(cohortpeople.cohort_id, {cohort.pk})) GROUP BY cohortpeople.person_id, cohortpeople.cohort_id, cohortpeople.version HAVING ifNull(greater(sum(cohortpeople.sign), 0), 0))), 0)) GROUP BY events.event LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertEqual(response.results, [("$pageview", 2)]) with override_settings(PERSON_ON_EVENTS_OVERRIDE=True, PERSON_ON_EVENTS_V2_OVERRIDE=False): @@ -484,15 +418,10 @@ def test_prop_cohort_basic(self): ) }, ) - self.assertEqual( - response.clickhouse, - f"SELECT events.event, count(*) FROM events WHERE and(equals(events.team_id, {self.team.pk}), in(events.person_id, " - f"(SELECT cohortpeople.person_id FROM cohortpeople WHERE and(equals(cohortpeople.team_id, {self.team.pk}), " - f"equals(cohortpeople.cohort_id, {cohort.pk})) GROUP BY cohortpeople.person_id, cohortpeople.cohort_id, " - f"cohortpeople.version HAVING ifNull(greater(sum(cohortpeople.sign), 0), 0)))) GROUP BY events.event LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertEqual(response.results, [("$pageview", 2)]) + @pytest.mark.usefixtures("unittest_snapshot") def test_prop_cohort_static(self): with freeze_time("2020-01-10"): _create_person( @@ -533,11 +462,7 @@ def test_prop_cohort_static(self): }, ) self.assertEqual(response.results, [("$pageview", 1)]) - - self.assertEqual( - response.clickhouse, - f"SELECT events.event, count() FROM events INNER JOIN (SELECT argMax(person_distinct_id2.person_id, person_distinct_id2.version) AS person_id, person_distinct_id2.distinct_id AS distinct_id FROM person_distinct_id2 WHERE equals(person_distinct_id2.team_id, {self.team.pk}) GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS events__pdi ON equals(events.distinct_id, events__pdi.distinct_id) WHERE and(equals(events.team_id, {self.team.pk}), ifNull(in(events__pdi.person_id, (SELECT person_static_cohort.person_id FROM person_static_cohort WHERE and(equals(person_static_cohort.team_id, {self.team.pk}), equals(person_static_cohort.cohort_id, {cohort.pk})))), 0)) GROUP BY events.event LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot with override_settings(PERSON_ON_EVENTS_OVERRIDE=True, PERSON_ON_EVENTS_V2_OVERRIDE=False): response = execute_hogql_query( @@ -550,12 +475,10 @@ def test_prop_cohort_static(self): ) }, ) - self.assertEqual( - response.clickhouse, - f"SELECT events.event, count(*) FROM events WHERE and(equals(events.team_id, {self.team.pk}), in(events.person_id, (SELECT person_static_cohort.person_id FROM person_static_cohort WHERE and(equals(person_static_cohort.team_id, {self.team.pk}), equals(person_static_cohort.cohort_id, {cohort.pk}))))) GROUP BY events.event LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertEqual(response.results, [("$pageview", 1)]) + @pytest.mark.usefixtures("unittest_snapshot") def test_join_with_property_materialized_session_id(self): with freeze_time("2020-01-10"): _create_person( @@ -586,22 +509,19 @@ def test_join_with_property_materialized_session_id(self): "select e.event, s.session_id from events e left join session_replay_events s on s.session_id = e.properties.$session_id where e.properties.$session_id is not null limit 10", team=self.team, ) - self.assertEqual( - response.clickhouse, - f"SELECT e.event, s.session_id FROM events AS e LEFT JOIN session_replay_events AS s ON equals(s.session_id, nullIf(nullIf(e.`$session_id`, ''), 'null')) WHERE and(equals(s.team_id, {self.team.pk}), equals(e.team_id, {self.team.pk}), isNotNull(nullIf(nullIf(e.`$session_id`, ''), 'null'))) LIMIT 10 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot + assert pretty_print_in_tests(response.hogql, self.team.pk) == self.snapshot self.assertEqual(response.results, [("$pageview", "111"), ("$pageview", "111")]) response = execute_hogql_query( "select e.event, s.session_id from session_replay_events s left join events e on e.properties.$session_id = s.session_id where e.properties.$session_id is not null limit 10", team=self.team, ) - self.assertEqual( - response.clickhouse, - f"SELECT e.event, s.session_id FROM session_replay_events AS s LEFT JOIN events AS e ON equals(nullIf(nullIf(e.`$session_id`, ''), 'null'), s.session_id) WHERE and(equals(e.team_id, {self.team.pk}), equals(s.team_id, {self.team.pk}), isNotNull(nullIf(nullIf(e.`$session_id`, ''), 'null'))) LIMIT 10 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot + assert pretty_print_in_tests(response.hogql, self.team.pk) == self.snapshot self.assertEqual(response.results, [("$pageview", "111"), ("$pageview", "111")]) + @pytest.mark.usefixtures("unittest_snapshot") def test_join_with_property_not_materialized(self): with freeze_time("2020-01-10"): _create_person( @@ -632,20 +552,16 @@ def test_join_with_property_not_materialized(self): "select e.event, s.session_id from events e left join session_replay_events s on s.session_id = e.properties.$$$session_id where e.properties.$$$session_id is not null limit 10", team=self.team, ) - self.assertEqual( - response.clickhouse, - f"SELECT e.event, s.session_id FROM events AS e LEFT JOIN session_replay_events AS s ON equals(s.session_id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, %(hogql_val_0)s), ''), 'null'), '^\"|\"$', '')) WHERE and(equals(s.team_id, {self.team.pk}), equals(e.team_id, {self.team.pk}), isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, %(hogql_val_1)s), ''), 'null'), '^\"|\"$', ''))) LIMIT 10 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot + assert pretty_print_in_tests(response.hogql, self.team.pk) == self.snapshot self.assertEqual(response.results, [("$pageview", "111"), ("$pageview", "111")]) response = execute_hogql_query( "select e.event, s.session_id from session_replay_events s left join events e on e.properties.$$$session_id = s.session_id where e.properties.$$$session_id is not null limit 10", team=self.team, ) - self.assertEqual( - response.clickhouse, - f"SELECT e.event, s.session_id FROM session_replay_events AS s LEFT JOIN events AS e ON equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, %(hogql_val_0)s), ''), 'null'), '^\"|\"$', ''), s.session_id) WHERE and(equals(e.team_id, {self.team.pk}), equals(s.team_id, {self.team.pk}), isNotNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, %(hogql_val_1)s), ''), 'null'), '^\"|\"$', ''))) LIMIT 10 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot + assert pretty_print_in_tests(response.hogql, self.team.pk) == self.snapshot self.assertEqual(response.results, [("$pageview", "111"), ("$pageview", "111")]) @pytest.mark.usefixtures("unittest_snapshot") @@ -656,7 +572,7 @@ def test_hogql_lambdas(self): team=self.team, ) self.assertEqual(response.results, [([2, 4, 6], 1)]) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot @pytest.mark.usefixtures("unittest_snapshot") def test_hogql_arrays(self): @@ -667,7 +583,7 @@ def test_hogql_arrays(self): ) # Following SQL tradition, ClickHouse array indexes start at 1, not from zero. self.assertEqual(response.results, [([1, 2, 3], 10)]) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot @pytest.mark.usefixtures("unittest_snapshot") def test_tuple_access(self): @@ -696,7 +612,7 @@ def test_tuple_access(self): response.results, [("0", [("random event", 1)]), ("1", [("random event", 1)])], ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot def test_null_properties(self): with freeze_time("2020-01-10"): @@ -960,7 +876,7 @@ def test_with_pivot_table_1_level(self): response.results, [("0", [("random event", 1)]), ("1", [("random event", 1)])], ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot @pytest.mark.usefixtures("unittest_snapshot") def test_with_pivot_table_2_levels(self): @@ -999,7 +915,7 @@ def test_with_pivot_table_2_levels(self): response.results, [("0", [("random event", 1)]), ("1", [("random event", 1)])], ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot def test_property_access_with_arrays(self): with freeze_time("2020-01-10"): @@ -1400,6 +1316,7 @@ def test_view_link(self): self.assertEqual(response.results, [("bla",), ("bla",), ("bla",), ("bla",)]) + @pytest.mark.usefixtures("unittest_snapshot") def test_hogql_query_filters(self): with freeze_time("2020-01-10"): random_uuid = self._create_random_events() @@ -1416,26 +1333,14 @@ def test_hogql_query_filters(self): ) placeholders = {"distinct_id": ast.Constant(value=random_uuid)} response = execute_hogql_query(query, team=self.team, filters=filters, placeholders=placeholders) - self.assertEqual( - response.hogql, - f"SELECT event, distinct_id FROM events WHERE and(equals(distinct_id, '{random_uuid}'), equals(properties.index, '4')) LIMIT 100", - ) - self.assertEqual( - response.clickhouse, - f"SELECT events.event, events.distinct_id FROM events WHERE and(equals(events.team_id, {self.team.pk}), equals(events.distinct_id, %(hogql_val_0)s), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_1)s), ''), 'null'), '^\"|\"$', ''), %(hogql_val_2)s), 0)) LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot + assert pretty_print_in_tests(response.hogql, self.team.pk) == self.snapshot self.assertEqual(len(response.results), 1) filters.dateRange = DateRange(date_from="2020-01-01", date_to="2020-01-02") response = execute_hogql_query(query, team=self.team, filters=filters, placeholders=placeholders) - self.assertEqual( - response.hogql, - f"SELECT event, distinct_id FROM events WHERE and(equals(distinct_id, '{random_uuid}'), and(equals(properties.index, '4'), less(timestamp, toDateTime('2020-01-02 00:00:00.000000')), greaterOrEquals(timestamp, toDateTime('2020-01-01 00:00:00.000000')))) LIMIT 100", - ) - self.assertEqual( - response.clickhouse, - f"SELECT events.event, events.distinct_id FROM events WHERE and(equals(events.team_id, {self.team.pk}), equals(events.distinct_id, %(hogql_val_0)s), and(ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, %(hogql_val_1)s), ''), 'null'), '^\"|\"$', ''), %(hogql_val_2)s), 0), less(toTimeZone(events.timestamp, %(hogql_val_3)s), toDateTime64('2020-01-02 00:00:00.000000', 6, 'UTC')), greaterOrEquals(toTimeZone(events.timestamp, %(hogql_val_4)s), toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')))) LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot + assert pretty_print_in_tests(response.hogql, self.team.pk) == self.snapshot self.assertEqual(len(response.results), 0) filters.dateRange = DateRange(date_from="2020-01-01", date_to="2020-02-02") @@ -1480,7 +1385,7 @@ def test_hogql_query_filters_alias(self): response.hogql, f"SELECT event, distinct_id FROM events AS e WHERE equals(properties.random_uuid, '{random_uuid}') LIMIT 100", ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertEqual(len(response.results), 2) @pytest.mark.usefixtures("unittest_snapshot") @@ -1491,7 +1396,7 @@ def test_hogql_union_all_limits(self): response.hogql, f"SELECT event FROM events LIMIT 100 UNION ALL SELECT event FROM events LIMIT 100", ) - assert pretty_print_in_tests(response.clickhouse, self.team.pk) == self.snapshot + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot def test_events_sessions_table(self): with freeze_time("2020-01-10 12:00:00"): diff --git a/posthog/hogql/test/utils.py b/posthog/hogql/test/utils.py index 7e46c620c997a..a3f4b1882c511 100644 --- a/posthog/hogql/test/utils.py +++ b/posthog/hogql/test/utils.py @@ -1,5 +1,7 @@ import dataclasses import json +from typing import Any + from pydantic import BaseModel @@ -16,6 +18,22 @@ def pretty_print_in_tests(query: str, team_id: int) -> str: ) +def pretty_print_response_in_tests(response: Any, team_id: int) -> str: + clickhouse = response.clickhouse + hogql = response.hogql + query = "-- ClickHouse\n" + clickhouse + "\n\n-- HogQL\n" + hogql + return ( + query.replace("SELECT", "\nSELECT") + .replace("FROM", "\nFROM") + .replace("WHERE", "\nWHERE") + .replace("GROUP", "\nGROUP") + .replace("HAVING", "\nHAVING") + .replace("LIMIT", "\nLIMIT") + .replace("SETTINGS", "\nSETTINGS") + .replace(f"team_id, {team_id})", "team_id, 420)") + ) + + def pretty_dataclasses(obj, seen=None, indent=0): if seen is None: seen = set() diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr new file mode 100644 index 0000000000000..787a6565b7d28 --- /dev/null +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -0,0 +1,76 @@ +# name: TestInCohort.test_in_cohort_dynamic + ' + -- ClickHouse + + SELECT events.event AS event + FROM events LEFT JOIN ( + SELECT cohortpeople.person_id AS person_id, 1 AS matched + FROM cohortpeople + WHERE and(equals(cohortpeople.team_id, 420), equals(cohortpeople.cohort_id, 10)) + GROUP BY cohortpeople.person_id, cohortpeople.cohort_id, cohortpeople.version + HAVING ifNull(greater(sum(cohortpeople.sign), 0), 0)) AS in_cohort__10 ON equals(in_cohort__10.person_id, events.person_id) + WHERE and(equals(events.team_id, 420), ifNull(equals(in_cohort__10.matched, 1), 0), equals(events.event, %(hogql_val_0)s)) + LIMIT 100 + SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event + FROM events LEFT JOIN ( + SELECT person_id, 1 AS matched + FROM raw_cohort_people + WHERE equals(cohort_id, 10) + GROUP BY person_id, cohort_id, version + HAVING greater(sum(sign), 0)) AS in_cohort__10 ON equals(in_cohort__10.person_id, person_id) + WHERE and(equals(in_cohort__10.matched, 1), equals(event, '018c6a03-e2f4-0000-1b43-0b8b068eedf9')) + LIMIT 100 + ' +--- +# name: TestInCohort.test_in_cohort_static + ' + -- ClickHouse + + SELECT events.event AS event + FROM events LEFT JOIN ( + SELECT person_static_cohort.person_id AS person_id, 1 AS matched + FROM person_static_cohort + WHERE and(equals(person_static_cohort.team_id, 420), equals(person_static_cohort.cohort_id, 11))) AS in_cohort__11 ON equals(in_cohort__11.person_id, events.person_id) + WHERE and(equals(events.team_id, 420), ifNull(equals(in_cohort__11.matched, 1), 0)) + LIMIT 100 + SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event + FROM events LEFT JOIN ( + SELECT person_id, 1 AS matched + FROM static_cohort_people + WHERE equals(cohort_id, 11)) AS in_cohort__11 ON equals(in_cohort__11.person_id, person_id) + WHERE equals(in_cohort__11.matched, 1) + LIMIT 100 + ' +--- +# name: TestInCohort.test_in_cohort_strings + ' + -- ClickHouse + + SELECT events.event AS event + FROM events LEFT JOIN ( + SELECT person_static_cohort.person_id AS person_id, 1 AS matched + FROM person_static_cohort + WHERE and(equals(person_static_cohort.team_id, 420), equals(person_static_cohort.cohort_id, 12))) AS in_cohort__12 ON equals(in_cohort__12.person_id, events.person_id) + WHERE and(equals(events.team_id, 420), ifNull(equals(in_cohort__12.matched, 1), 0)) + LIMIT 100 + SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 + + -- HogQL + + SELECT event + FROM events LEFT JOIN ( + SELECT person_id, 1 AS matched + FROM static_cohort_people + WHERE equals(cohort_id, 12)) AS in_cohort__12 ON equals(in_cohort__12.person_id, person_id) + WHERE equals(in_cohort__12.matched, 1) + LIMIT 100 + ' +--- diff --git a/posthog/hogql/transforms/test/__snapshots__/test_lazy_tables.ambr b/posthog/hogql/transforms/test/__snapshots__/test_lazy_tables.ambr index 4afb16d85f3b5..a0c2eda465c8d 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_lazy_tables.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_lazy_tables.ambr @@ -1,7 +1,7 @@ # name: TestLazyJoins.test_resolve_lazy_table_as_select_table ' - SELECT persons.id, persons.properties___email AS email, persons.`properties___$browser` AS `$browser` + SELECT persons.id AS id, persons.properties___email AS email, persons.`properties___$browser` AS `$browser` FROM ( SELECT argMax(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', ''), person.version) AS properties___email, argMax(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, %(hogql_val_1)s), ''), 'null'), '^"|"$', ''), person.version) AS `properties___$browser`, person.id AS id FROM person @@ -15,7 +15,7 @@ # name: TestLazyJoins.test_resolve_lazy_table_as_table_in_join ' - SELECT events.event, events.distinct_id, events__pdi.person_id, persons.properties___email AS email + SELECT events.event AS event, events.distinct_id AS distinct_id, events__pdi.person_id AS person_id, persons.properties___email AS email FROM events INNER JOIN ( SELECT argMax(person_distinct_id2.person_id, person_distinct_id2.version) AS person_id, person_distinct_id2.distinct_id AS distinct_id FROM person_distinct_id2 @@ -35,7 +35,7 @@ # name: TestLazyJoins.test_resolve_lazy_tables ' - SELECT events.event, events__pdi.person_id + SELECT events.event AS event, events__pdi.person_id AS person_id FROM events INNER JOIN ( SELECT argMax(person_distinct_id2.person_id, person_distinct_id2.version) AS person_id, person_distinct_id2.distinct_id AS distinct_id FROM person_distinct_id2 @@ -87,7 +87,7 @@ # name: TestLazyJoins.test_resolve_lazy_tables_traversed_fields ' - SELECT events.event, events__pdi.person_id + SELECT events.event AS event, events__pdi.person_id AS person_id FROM events INNER JOIN ( SELECT argMax(person_distinct_id2.person_id, person_distinct_id2.version) AS person_id, person_distinct_id2.distinct_id AS distinct_id FROM person_distinct_id2 @@ -101,7 +101,7 @@ # name: TestLazyJoins.test_resolve_lazy_tables_two_levels ' - SELECT events.event, events__pdi__person.id + SELECT events.event AS event, events__pdi__person.id AS id FROM events INNER JOIN ( SELECT argMax(person_distinct_id2.person_id, person_distinct_id2.version) AS person_id, person_distinct_id2.distinct_id AS distinct_id FROM person_distinct_id2 @@ -121,7 +121,7 @@ # name: TestLazyJoins.test_resolve_lazy_tables_two_levels_properties ' - SELECT events.event, events__pdi__person.`properties___$browser` AS `$browser` + SELECT events.event AS event, events__pdi__person.`properties___$browser` AS `$browser` FROM events INNER JOIN ( SELECT argMax(person_distinct_id2.person_id, person_distinct_id2.version) AS person_id, person_distinct_id2.distinct_id AS distinct_id FROM person_distinct_id2 @@ -141,7 +141,7 @@ # name: TestLazyJoins.test_resolve_lazy_tables_two_levels_properties_duplicate ' - SELECT events.event, events__pdi__person.properties, events__pdi__person.properties___name AS name + SELECT events.event AS event, events__pdi__person.properties AS properties, events__pdi__person.properties___name AS name FROM events INNER JOIN ( SELECT argMax(person_distinct_id2.person_id, person_distinct_id2.version) AS person_id, person_distinct_id2.distinct_id AS distinct_id FROM person_distinct_id2 @@ -161,7 +161,7 @@ # name: TestLazyJoins.test_resolve_lazy_tables_two_levels_traversed ' - SELECT events.event, events__pdi__person.id + SELECT events.event AS event, events__pdi__person.id AS id FROM events INNER JOIN ( SELECT argMax(person_distinct_id2.person_id, person_distinct_id2.version) AS person_id, person_distinct_id2.distinct_id AS distinct_id FROM person_distinct_id2 diff --git a/posthog/hogql/transforms/test/test_in_cohort.py b/posthog/hogql/transforms/test/test_in_cohort.py index 2a6e11aa7a877..879e88bcb7eca 100644 --- a/posthog/hogql/transforms/test/test_in_cohort.py +++ b/posthog/hogql/transforms/test/test_in_cohort.py @@ -1,9 +1,11 @@ +import pytest from django.test import override_settings from posthog.hogql import ast from posthog.hogql.errors import HogQLException from posthog.hogql.parser import parse_expr from posthog.hogql.query import execute_hogql_query +from posthog.hogql.test.utils import pretty_print_response_in_tests from posthog.models import Cohort from posthog.models.cohort.util import recalculate_cohortpeople from posthog.models.utils import UUIDT @@ -34,6 +36,7 @@ def _create_random_events(self) -> str: flush_persons_and_events() return random_uuid + @pytest.mark.usefixtures("unittest_snapshot") @override_settings(PERSON_ON_EVENTS_OVERRIDE=True, PERSON_ON_EVENTS_V2_OVERRIDE=False) def test_in_cohort_dynamic(self): random_uuid = self._create_random_events() @@ -47,17 +50,11 @@ def test_in_cohort_dynamic(self): self.team, modifiers=HogQLQueryModifiers(inCohortVia="leftjoin"), ) - self.assertEqual( - response.clickhouse, - f"SELECT events.event FROM events LEFT JOIN (SELECT cohortpeople.person_id, 1 AS matched FROM cohortpeople WHERE and(equals(cohortpeople.team_id, {self.team.pk}), equals(cohortpeople.cohort_id, {cohort.pk})) GROUP BY cohortpeople.person_id, cohortpeople.cohort_id, cohortpeople.version HAVING ifNull(greater(sum(cohortpeople.sign), 0), 0)) AS in_cohort__{cohort.pk} ON equals(in_cohort__{cohort.pk}.person_id, events.person_id) WHERE and(equals(events.team_id, {self.team.pk}), ifNull(equals(in_cohort__{cohort.pk}.matched, 1), 0), equals(events.event, %(hogql_val_0)s)) LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1", - ) - self.assertEqual( - response.hogql, - f"SELECT event FROM events LEFT JOIN (SELECT person_id, 1 AS matched FROM raw_cohort_people WHERE equals(cohort_id, {cohort.pk}) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__{cohort.pk} ON equals(in_cohort__{cohort.pk}.person_id, person_id) WHERE and(equals(in_cohort__{cohort.pk}.matched, 1), equals(event, '{random_uuid}')) LIMIT 100", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot self.assertEqual(len(response.results), 1) self.assertEqual(response.results[0][0], random_uuid) + @pytest.mark.usefixtures("unittest_snapshot") @override_settings(PERSON_ON_EVENTS_OVERRIDE=True, PERSON_ON_EVENTS_V2_OVERRIDE=False) def test_in_cohort_static(self): cohort = Cohort.objects.create( @@ -69,18 +66,12 @@ def test_in_cohort_static(self): self.team, modifiers=HogQLQueryModifiers(inCohortVia="leftjoin"), ) - self.assertEqual( - response.clickhouse, - f"SELECT events.event FROM events LEFT JOIN (SELECT person_static_cohort.person_id, 1 AS matched FROM person_static_cohort WHERE and(equals(person_static_cohort.team_id, {self.team.pk}), equals(person_static_cohort.cohort_id, {cohort.pk}))) AS in_cohort__{cohort.pk} ON equals(in_cohort__{cohort.pk}.person_id, events.person_id) WHERE and(equals(events.team_id, {self.team.pk}), ifNull(equals(in_cohort__{cohort.pk}.matched, 1), 0)) LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1", - ) - self.assertEqual( - response.hogql, - f"SELECT event FROM events LEFT JOIN (SELECT person_id, 1 AS matched FROM static_cohort_people WHERE equals(cohort_id, {cohort.pk})) AS in_cohort__{cohort.pk} ON equals(in_cohort__{cohort.pk}.person_id, person_id) WHERE equals(in_cohort__{cohort.pk}.matched, 1) LIMIT 100", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot + @pytest.mark.usefixtures("unittest_snapshot") @override_settings(PERSON_ON_EVENTS_OVERRIDE=True, PERSON_ON_EVENTS_V2_OVERRIDE=False) def test_in_cohort_strings(self): - cohort = Cohort.objects.create( + Cohort.objects.create( team=self.team, name="my cohort", is_static=True, @@ -90,15 +81,9 @@ def test_in_cohort_strings(self): self.team, modifiers=HogQLQueryModifiers(inCohortVia="leftjoin"), ) - self.assertEqual( - response.clickhouse, - f"SELECT events.event FROM events LEFT JOIN (SELECT person_static_cohort.person_id, 1 AS matched FROM person_static_cohort WHERE and(equals(person_static_cohort.team_id, {self.team.pk}), equals(person_static_cohort.cohort_id, {cohort.pk}))) AS in_cohort__{cohort.pk} ON equals(in_cohort__{cohort.pk}.person_id, events.person_id) WHERE and(equals(events.team_id, {self.team.pk}), ifNull(equals(in_cohort__{cohort.pk}.matched, 1), 0)) LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1", - ) - self.assertEqual( - response.hogql, - f"SELECT event FROM events LEFT JOIN (SELECT person_id, 1 AS matched FROM static_cohort_people WHERE equals(cohort_id, {cohort.pk})) AS in_cohort__{cohort.pk} ON equals(in_cohort__{cohort.pk}.person_id, person_id) WHERE equals(in_cohort__{cohort.pk}.matched, 1) LIMIT 100", - ) + assert pretty_print_response_in_tests(response, self.team.pk) == self.snapshot + @pytest.mark.usefixtures("unittest_snapshot") @override_settings(PERSON_ON_EVENTS_OVERRIDE=True, PERSON_ON_EVENTS_V2_OVERRIDE=True) def test_in_cohort_error(self): with self.assertRaises(HogQLException) as e: From 55d8662f8260177e1ffd9691089c3bd76e746b53 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Dec 2023 20:41:12 +0000 Subject: [PATCH 02/63] Update query snapshots --- .../api/test/__snapshots__/test_query.ambr | 108 +++++++++--------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/posthog/api/test/__snapshots__/test_query.ambr b/posthog/api/test/__snapshots__/test_query.ambr index 38ee1f19a66b2..8d9a9a5c2c4c8 100644 --- a/posthog/api/test/__snapshots__/test_query.ambr +++ b/posthog/api/test/__snapshots__/test_query.ambr @@ -1,8 +1,8 @@ # name: TestQuery.test_event_property_filter ' /* user_id:0 request:_snapshot_ */ - SELECT events.event, - events.distinct_id, + SELECT events.event AS event, + events.distinct_id AS distinct_id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'key'), ''), 'null'), '^"|"$', '') AS key, 'a%sd', concat(ifNull(toString(events.event), ''), ' ', ifNull(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'key'), ''), 'null'), '^"|"$', '')), '')) @@ -18,8 +18,8 @@ # name: TestQuery.test_event_property_filter.1 ' /* user_id:0 request:_snapshot_ */ - SELECT events.event, - events.distinct_id, + SELECT events.event AS event, + events.distinct_id AS distinct_id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'key'), ''), 'null'), '^"|"$', '') AS key, 'a%sd', concat(ifNull(toString(events.event), ''), ' ', ifNull(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'key'), ''), 'null'), '^"|"$', '')), '')) @@ -35,8 +35,8 @@ # name: TestQuery.test_event_property_filter.2 ' /* user_id:0 request:_snapshot_ */ - SELECT events.event, - events.distinct_id, + SELECT events.event AS event, + events.distinct_id AS distinct_id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'key'), ''), 'null'), '^"|"$', '') AS key, 'a%sd', concat(ifNull(toString(events.event), ''), ' ', ifNull(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'key'), ''), 'null'), '^"|"$', '')), '')) @@ -52,8 +52,8 @@ # name: TestQuery.test_event_property_filter_materialized ' /* user_id:0 request:_snapshot_ */ - SELECT events.event, - events.distinct_id, + SELECT events.event AS event, + events.distinct_id AS distinct_id, nullIf(nullIf(events.mat_key, ''), 'null') AS key, 'a%sd', concat(ifNull(toString(events.event), ''), ' ', ifNull(toString(nullIf(nullIf(events.mat_key, ''), 'null')), '')) @@ -69,8 +69,8 @@ # name: TestQuery.test_event_property_filter_materialized.1 ' /* user_id:0 request:_snapshot_ */ - SELECT events.event, - events.distinct_id, + SELECT events.event AS event, + events.distinct_id AS distinct_id, nullIf(nullIf(events.mat_key, ''), 'null') AS key, 'a%sd', concat(ifNull(toString(events.event), ''), ' ', ifNull(toString(nullIf(nullIf(events.mat_key, ''), 'null')), '')) @@ -86,8 +86,8 @@ # name: TestQuery.test_event_property_filter_materialized.2 ' /* user_id:0 request:_snapshot_ */ - SELECT events.event, - events.distinct_id, + SELECT events.event AS event, + events.distinct_id AS distinct_id, nullIf(nullIf(events.mat_key, ''), 'null') AS key, 'a%sd', concat(ifNull(toString(events.event), ''), ' ', ifNull(toString(nullIf(nullIf(events.mat_key, ''), 'null')), '')) @@ -103,7 +103,7 @@ # name: TestQuery.test_events_query_all_time_date ' /* user_id:0 request:_snapshot_ */ - SELECT events.event + SELECT events.event AS event FROM events WHERE and(equals(events.team_id, 2), less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('2023-01-12 12:14:05.000000', 6, 'UTC'))) ORDER BY events.event ASC @@ -116,7 +116,7 @@ # name: TestQuery.test_events_query_all_time_date.1 ' /* user_id:0 request:_snapshot_ */ - SELECT events.event + SELECT events.event AS event FROM events WHERE and(equals(events.team_id, 2), less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('2022-01-12 12:14:00.000000', 6, 'UTC'))) ORDER BY events.event ASC @@ -129,7 +129,7 @@ # name: TestQuery.test_events_query_all_time_date.2 ' /* user_id:0 request:_snapshot_ */ - SELECT events.event + SELECT events.event AS event FROM events WHERE and(equals(events.team_id, 2), less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('2022-01-01 00:00:00.000000', 6, 'UTC')), greater(toTimeZone(events.timestamp, 'UTC'), toDateTime64('2019-01-12 12:14:00.000000', 6, 'UTC'))) ORDER BY events.event ASC @@ -142,8 +142,8 @@ # name: TestQuery.test_full_hogql_query ' /* user_id:0 request:_snapshot_ */ - SELECT events.event, - events.distinct_id, + SELECT events.event AS event, + events.distinct_id AS distinct_id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'key'), ''), 'null'), '^"|"$', '') AS key FROM events WHERE equals(events.team_id, 2) @@ -156,8 +156,8 @@ # name: TestQuery.test_full_hogql_query_materialized ' /* user_id:0 request:_snapshot_ */ - SELECT events.event, - events.distinct_id, + SELECT events.event AS event, + events.distinct_id AS distinct_id, nullIf(nullIf(events.mat_key, ''), 'null') AS key FROM events WHERE equals(events.team_id, 2) @@ -184,9 +184,9 @@ # name: TestQuery.test_full_hogql_query_view.1 ' /* user_id:0 request:_snapshot_ */ - SELECT event_view.event, - event_view.distinct_id, - event_view.key + SELECT event_view.event AS event, + event_view.distinct_id AS distinct_id, + event_view.key AS key FROM (SELECT events.event AS event, events.distinct_id AS distinct_id, @@ -202,8 +202,8 @@ # name: TestQuery.test_hogql_property_filter ' /* user_id:0 request:_snapshot_ */ - SELECT events.event, - events.distinct_id, + SELECT events.event AS event, + events.distinct_id AS distinct_id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'key'), ''), 'null'), '^"|"$', '') AS key, 'a%sd', concat(ifNull(toString(events.event), ''), ' ', ifNull(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'key'), ''), 'null'), '^"|"$', '')), '')) @@ -219,8 +219,8 @@ # name: TestQuery.test_hogql_property_filter.1 ' /* user_id:0 request:_snapshot_ */ - SELECT events.event, - events.distinct_id, + SELECT events.event AS event, + events.distinct_id AS distinct_id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'key'), ''), 'null'), '^"|"$', '') AS key, 'a%sd', concat(ifNull(toString(events.event), ''), ' ', ifNull(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'key'), ''), 'null'), '^"|"$', '')), '')) @@ -236,8 +236,8 @@ # name: TestQuery.test_hogql_property_filter.2 ' /* user_id:0 request:_snapshot_ */ - SELECT events.event, - events.distinct_id, + SELECT events.event AS event, + events.distinct_id AS distinct_id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'key'), ''), 'null'), '^"|"$', '') AS key, 'a%sd', concat(ifNull(toString(events.event), ''), ' ', ifNull(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'key'), ''), 'null'), '^"|"$', '')), '')) @@ -253,8 +253,8 @@ # name: TestQuery.test_hogql_property_filter.3 ' /* user_id:0 request:_snapshot_ */ - SELECT events.event, - events.distinct_id, + SELECT events.event AS event, + events.distinct_id AS distinct_id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'key'), ''), 'null'), '^"|"$', '') AS key, 'a%sd', concat(ifNull(toString(events.event), ''), ' ', ifNull(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'key'), ''), 'null'), '^"|"$', '')), '')) @@ -270,8 +270,8 @@ # name: TestQuery.test_hogql_property_filter_materialized ' /* user_id:0 request:_snapshot_ */ - SELECT events.event, - events.distinct_id, + SELECT events.event AS event, + events.distinct_id AS distinct_id, nullIf(nullIf(events.mat_key, ''), 'null') AS key, 'a%sd', concat(ifNull(toString(events.event), ''), ' ', ifNull(toString(nullIf(nullIf(events.mat_key, ''), 'null')), '')) @@ -287,8 +287,8 @@ # name: TestQuery.test_hogql_property_filter_materialized.1 ' /* user_id:0 request:_snapshot_ */ - SELECT events.event, - events.distinct_id, + SELECT events.event AS event, + events.distinct_id AS distinct_id, nullIf(nullIf(events.mat_key, ''), 'null') AS key, 'a%sd', concat(ifNull(toString(events.event), ''), ' ', ifNull(toString(nullIf(nullIf(events.mat_key, ''), 'null')), '')) @@ -304,8 +304,8 @@ # name: TestQuery.test_hogql_property_filter_materialized.2 ' /* user_id:0 request:_snapshot_ */ - SELECT events.event, - events.distinct_id, + SELECT events.event AS event, + events.distinct_id AS distinct_id, nullIf(nullIf(events.mat_key, ''), 'null') AS key, 'a%sd', concat(ifNull(toString(events.event), ''), ' ', ifNull(toString(nullIf(nullIf(events.mat_key, ''), 'null')), '')) @@ -321,8 +321,8 @@ # name: TestQuery.test_hogql_property_filter_materialized.3 ' /* user_id:0 request:_snapshot_ */ - SELECT events.event, - events.distinct_id, + SELECT events.event AS event, + events.distinct_id AS distinct_id, nullIf(nullIf(events.mat_key, ''), 'null') AS key, 'a%sd', concat(ifNull(toString(events.event), ''), ' ', ifNull(toString(nullIf(nullIf(events.mat_key, ''), 'null')), '')) @@ -338,8 +338,8 @@ # name: TestQuery.test_person_property_filter ' /* user_id:0 request:_snapshot_ */ - SELECT events.event, - events.distinct_id, + SELECT events.event AS event, + events.distinct_id AS distinct_id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'key'), ''), 'null'), '^"|"$', '') AS key, 'a%sd', concat(ifNull(toString(events.event), ''), ' ', ifNull(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'key'), ''), 'null'), '^"|"$', '')), '')) @@ -352,11 +352,11 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS events__pdi ON equals(events.distinct_id, events__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'email'), ''), 'null'), '^"|"$', '') AS properties___email FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id @@ -372,8 +372,8 @@ # name: TestQuery.test_person_property_filter_materialized ' /* user_id:0 request:_snapshot_ */ - SELECT events.event, - events.distinct_id, + SELECT events.event AS event, + events.distinct_id AS distinct_id, nullIf(nullIf(events.mat_key, ''), 'null') AS key, 'a%sd', concat(ifNull(toString(events.event), ''), ' ', ifNull(toString(nullIf(nullIf(events.mat_key, ''), 'null')), '')) @@ -386,11 +386,11 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS events__pdi ON equals(events.distinct_id, events__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, nullIf(nullIf(person.pmat_email, ''), 'null') AS properties___email FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id @@ -468,9 +468,9 @@ # name: TestQuery.test_select_event_person ' /* user_id:0 request:_snapshot_ */ - SELECT events.event, - events.distinct_id, - events.distinct_id + SELECT events.event AS event, + events.distinct_id AS distinct_id, + events.distinct_id AS distinct_id FROM events WHERE and(equals(events.team_id, 2), less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('2020-01-10 12:14:05.000000', 6, 'UTC')), greater(toTimeZone(events.timestamp, 'UTC'), toDateTime64('2020-01-09 12:14:00.000000', 6, 'UTC'))) ORDER BY events.event ASC @@ -484,8 +484,8 @@ ' /* user_id:0 request:_snapshot_ */ SELECT replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'key'), ''), 'null'), '^"|"$', '') AS key, - events.event, - events.distinct_id, + events.event AS event, + events.distinct_id AS distinct_id, concat(ifNull(toString(events.event), ''), ' ', ifNull(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'key'), ''), 'null'), '^"|"$', '')), '')) FROM events WHERE and(equals(events.team_id, 2), less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('2020-01-10 12:14:05.000000', 6, 'UTC')), greater(toTimeZone(events.timestamp, 'UTC'), toDateTime64('2020-01-09 12:14:00.000000', 6, 'UTC'))) @@ -500,7 +500,7 @@ ' /* user_id:0 request:_snapshot_ */ SELECT tuple(events.uuid, events.event, events.properties, toTimeZone(events.timestamp, 'UTC'), events.team_id, events.distinct_id, events.elements_chain, toTimeZone(events.created_at, 'UTC')), - events.event + events.event AS event FROM events WHERE and(equals(events.team_id, 2), less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('2020-01-10 12:14:05.000000', 6, 'UTC')), greater(toTimeZone(events.timestamp, 'UTC'), toDateTime64('2020-01-09 12:14:00.000000', 6, 'UTC'))) ORDER BY tuple(events.uuid, events.event, events.properties, toTimeZone(events.timestamp, 'UTC'), events.team_id, events.distinct_id, events.elements_chain, toTimeZone(events.created_at, 'UTC')) ASC @@ -514,7 +514,7 @@ ' /* user_id:0 request:_snapshot_ */ SELECT count(), - events.event + events.event AS event FROM events WHERE and(equals(events.team_id, 2), less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('2020-01-10 12:14:05.000000', 6, 'UTC')), greater(toTimeZone(events.timestamp, 'UTC'), toDateTime64('2020-01-09 12:14:00.000000', 6, 'UTC'))) GROUP BY events.event @@ -529,7 +529,7 @@ ' /* user_id:0 request:_snapshot_ */ SELECT count(), - events.event + events.event AS event FROM events WHERE and(equals(events.team_id, 2), or(equals(events.event, 'sign up'), ifNull(like(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, 'key'), ''), 'null'), '^"|"$', ''), '%val2'), 0)), less(toTimeZone(events.timestamp, 'UTC'), toDateTime64('2020-01-10 12:14:05.000000', 6, 'UTC')), greater(toTimeZone(events.timestamp, 'UTC'), toDateTime64('2020-01-09 12:14:00.000000', 6, 'UTC'))) GROUP BY events.event From 629bb0a84d821ad3626179e9576c84dd936a8a42 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Dec 2023 20:44:29 +0000 Subject: [PATCH 03/63] Update query snapshots --- .../hogql/test/__snapshots__/test_query.ambr | 2 +- .../test/__snapshots__/test_in_cohort.ambr | 28 +- .../test_lifecycle_query_runner.ambr | 36 +- .../test_retention_query_runner.ambr | 56 +- .../test/__snapshots__/test_trends.ambr | 558 +++++++++--------- .../test_sessions_timeline_query_runner.ambr | 322 +++++----- 6 files changed, 508 insertions(+), 494 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index ecd983e738882..2d84d09e37ef8 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0017-1ec4-f9ee72932a04') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-5126-03aef09600a2') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 787a6565b7d28..634aa69a1405f 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -6,10 +6,10 @@ FROM events LEFT JOIN ( SELECT cohortpeople.person_id AS person_id, 1 AS matched FROM cohortpeople - WHERE and(equals(cohortpeople.team_id, 420), equals(cohortpeople.cohort_id, 10)) + WHERE and(equals(cohortpeople.team_id, 420), equals(cohortpeople.cohort_id, 1)) GROUP BY cohortpeople.person_id, cohortpeople.cohort_id, cohortpeople.version - HAVING ifNull(greater(sum(cohortpeople.sign), 0), 0)) AS in_cohort__10 ON equals(in_cohort__10.person_id, events.person_id) - WHERE and(equals(events.team_id, 420), ifNull(equals(in_cohort__10.matched, 1), 0), equals(events.event, %(hogql_val_0)s)) + HAVING ifNull(greater(sum(cohortpeople.sign), 0), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, events.person_id) + WHERE and(equals(events.team_id, 420), ifNull(equals(in_cohort__1.matched, 1), 0), equals(events.event, %(hogql_val_0)s)) LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 @@ -19,10 +19,10 @@ FROM events LEFT JOIN ( SELECT person_id, 1 AS matched FROM raw_cohort_people - WHERE equals(cohort_id, 10) + WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version - HAVING greater(sum(sign), 0)) AS in_cohort__10 ON equals(in_cohort__10.person_id, person_id) - WHERE and(equals(in_cohort__10.matched, 1), equals(event, '018c6a03-e2f4-0000-1b43-0b8b068eedf9')) + HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6a0c-628f-0000-ff51-4b4fa01e94cb')) LIMIT 100 ' --- @@ -34,8 +34,8 @@ FROM events LEFT JOIN ( SELECT person_static_cohort.person_id AS person_id, 1 AS matched FROM person_static_cohort - WHERE and(equals(person_static_cohort.team_id, 420), equals(person_static_cohort.cohort_id, 11))) AS in_cohort__11 ON equals(in_cohort__11.person_id, events.person_id) - WHERE and(equals(events.team_id, 420), ifNull(equals(in_cohort__11.matched, 1), 0)) + WHERE and(equals(person_static_cohort.team_id, 420), equals(person_static_cohort.cohort_id, 2))) AS in_cohort__2 ON equals(in_cohort__2.person_id, events.person_id) + WHERE and(equals(events.team_id, 420), ifNull(equals(in_cohort__2.matched, 1), 0)) LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 @@ -45,8 +45,8 @@ FROM events LEFT JOIN ( SELECT person_id, 1 AS matched FROM static_cohort_people - WHERE equals(cohort_id, 11)) AS in_cohort__11 ON equals(in_cohort__11.person_id, person_id) - WHERE equals(in_cohort__11.matched, 1) + WHERE equals(cohort_id, 2)) AS in_cohort__2 ON equals(in_cohort__2.person_id, person_id) + WHERE equals(in_cohort__2.matched, 1) LIMIT 100 ' --- @@ -58,8 +58,8 @@ FROM events LEFT JOIN ( SELECT person_static_cohort.person_id AS person_id, 1 AS matched FROM person_static_cohort - WHERE and(equals(person_static_cohort.team_id, 420), equals(person_static_cohort.cohort_id, 12))) AS in_cohort__12 ON equals(in_cohort__12.person_id, events.person_id) - WHERE and(equals(events.team_id, 420), ifNull(equals(in_cohort__12.matched, 1), 0)) + WHERE and(equals(person_static_cohort.team_id, 420), equals(person_static_cohort.cohort_id, 3))) AS in_cohort__3 ON equals(in_cohort__3.person_id, events.person_id) + WHERE and(equals(events.team_id, 420), ifNull(equals(in_cohort__3.matched, 1), 0)) LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 @@ -69,8 +69,8 @@ FROM events LEFT JOIN ( SELECT person_id, 1 AS matched FROM static_cohort_people - WHERE equals(cohort_id, 12)) AS in_cohort__12 ON equals(in_cohort__12.person_id, person_id) - WHERE equals(in_cohort__12.matched, 1) + WHERE equals(cohort_id, 3)) AS in_cohort__3 ON equals(in_cohort__3.person_id, person_id) + WHERE equals(in_cohort__3.matched, 1) LIMIT 100 ' --- diff --git a/posthog/hogql_queries/insights/test/__snapshots__/test_lifecycle_query_runner.ambr b/posthog/hogql_queries/insights/test/__snapshots__/test_lifecycle_query_runner.ambr index 12cf0173a7f97..5954c42aa3b1a 100644 --- a/posthog/hogql_queries/insights/test/__snapshots__/test_lifecycle_query_runner.ambr +++ b/posthog/hogql_queries/insights/test/__snapshots__/test_lifecycle_query_runner.ambr @@ -2,15 +2,15 @@ ' SELECT groupArray(start_of_period) AS date, groupArray(round(multiply(counts, divide(1, 0.1)))) AS total, - status + status AS status FROM (SELECT if(ifNull(equals(status, 'dormant'), 0), negate(sum(counts)), negate(negate(sum(counts)))) AS counts, - start_of_period, - status + start_of_period AS start_of_period, + status AS status FROM (SELECT periods.start_of_period AS start_of_period, 0 AS counts, - sec.status + sec.status AS status FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-19 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS start_of_period FROM numbers(dateDiff('day', toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 00:00:00', 6, 'UTC'))), toStartOfDay(plus(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-19 23:59:59', 6, 'UTC')), toIntervalDay(1))))) AS numbers) AS periods @@ -20,9 +20,9 @@ (SELECT 1) ARRAY JOIN ['new', 'returning', 'resurrecting', 'dormant'] AS status) AS sec ORDER BY sec.status ASC, start_of_period ASC - UNION ALL SELECT start_of_period, + UNION ALL SELECT start_of_period AS start_of_period, count(DISTINCT person_id) AS counts, - status + status AS status FROM (SELECT events__pdi__person.id AS person_id, min(toTimeZone(events__pdi__person.created_at, 'UTC')) AS created_at, @@ -73,15 +73,15 @@ ' SELECT groupArray(start_of_period) AS date, groupArray(counts) AS total, - status + status AS status FROM (SELECT if(ifNull(equals(status, 'dormant'), 0), negate(sum(counts)), negate(negate(sum(counts)))) AS counts, - start_of_period, - status + start_of_period AS start_of_period, + status AS status FROM (SELECT periods.start_of_period AS start_of_period, 0 AS counts, - sec.status + sec.status AS status FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-19 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS start_of_period FROM numbers(dateDiff('day', toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 00:00:00', 6, 'UTC'))), toStartOfDay(plus(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-19 23:59:59', 6, 'UTC')), toIntervalDay(1))))) AS numbers) AS periods @@ -91,9 +91,9 @@ (SELECT 1) ARRAY JOIN ['new', 'returning', 'resurrecting', 'dormant'] AS status) AS sec ORDER BY sec.status ASC, start_of_period ASC - UNION ALL SELECT start_of_period, + UNION ALL SELECT start_of_period AS start_of_period, count(DISTINCT person_id) AS counts, - status + status AS status FROM (SELECT events__pdi__person.id AS person_id, min(toTimeZone(events__pdi__person.created_at, 'UTC')) AS created_at, @@ -144,15 +144,15 @@ ' SELECT groupArray(start_of_period) AS date, groupArray(counts) AS total, - status + status AS status FROM (SELECT if(ifNull(equals(status, 'dormant'), 0), negate(sum(counts)), negate(negate(sum(counts)))) AS counts, - start_of_period, - status + start_of_period AS start_of_period, + status AS status FROM (SELECT periods.start_of_period AS start_of_period, 0 AS counts, - sec.status + sec.status AS status FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-19 23:59:59', 6, 'US/Pacific'))), toIntervalDay(numbers.number)) AS start_of_period FROM numbers(dateDiff('day', toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 00:00:00', 6, 'US/Pacific'))), toStartOfDay(plus(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-19 23:59:59', 6, 'US/Pacific')), toIntervalDay(1))))) AS numbers) AS periods @@ -162,9 +162,9 @@ (SELECT 1) ARRAY JOIN ['new', 'returning', 'resurrecting', 'dormant'] AS status) AS sec ORDER BY sec.status ASC, start_of_period ASC - UNION ALL SELECT start_of_period, + UNION ALL SELECT start_of_period AS start_of_period, count(DISTINCT person_id) AS counts, - status + status AS status FROM (SELECT events__pdi__person.id AS person_id, min(toTimeZone(events__pdi__person.created_at, 'US/Pacific')) AS created_at, diff --git a/posthog/hogql_queries/insights/test/__snapshots__/test_retention_query_runner.ambr b/posthog/hogql_queries/insights/test/__snapshots__/test_retention_query_runner.ambr index bd6e5436ad1d5..62d2f6910ce2b 100644 --- a/posthog/hogql_queries/insights/test/__snapshots__/test_retention_query_runner.ambr +++ b/posthog/hogql_queries/insights/test/__snapshots__/test_retention_query_runner.ambr @@ -4,9 +4,9 @@ actor_activity.intervals_from_base AS intervals_from_base, count(DISTINCT actor_activity.actor_id) AS count FROM - (SELECT DISTINCT breakdown_values, - intervals_from_base, - actor_id + (SELECT DISTINCT breakdown_values AS breakdown_values, + intervals_from_base AS intervals_from_base, + actor_id AS actor_id FROM (SELECT target_event.breakdown_values AS breakdown_values, dateDiff('day', target_event.event_date, returning_event.event_date) AS intervals_from_base, @@ -85,9 +85,9 @@ actor_activity.intervals_from_base AS intervals_from_base, count(DISTINCT actor_activity.actor_id) AS count FROM - (SELECT DISTINCT breakdown_values, - intervals_from_base, - actor_id + (SELECT DISTINCT breakdown_values AS breakdown_values, + intervals_from_base AS intervals_from_base, + actor_id AS actor_id FROM (SELECT target_event.breakdown_values AS breakdown_values, dateDiff('month', target_event.event_date, returning_event.event_date) AS intervals_from_base, @@ -149,9 +149,9 @@ actor_activity.intervals_from_base AS intervals_from_base, count(DISTINCT actor_activity.actor_id) AS count FROM - (SELECT DISTINCT breakdown_values, - intervals_from_base, - actor_id + (SELECT DISTINCT breakdown_values AS breakdown_values, + intervals_from_base AS intervals_from_base, + actor_id AS actor_id FROM (SELECT target_event.breakdown_values AS breakdown_values, dateDiff('day', target_event.event_date, returning_event.event_date) AS intervals_from_base, @@ -216,9 +216,9 @@ actor_activity.intervals_from_base AS intervals_from_base, count(DISTINCT actor_activity.actor_id) AS count FROM - (SELECT DISTINCT breakdown_values, - intervals_from_base, - actor_id + (SELECT DISTINCT breakdown_values AS breakdown_values, + intervals_from_base AS intervals_from_base, + actor_id AS actor_id FROM (SELECT target_event.breakdown_values AS breakdown_values, dateDiff('day', target_event.event_date, returning_event.event_date) AS intervals_from_base, @@ -236,11 +236,11 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS events__pdi ON equals(events.distinct_id, events__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'email'), ''), 'null'), '^"|"$', '') AS properties___email FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id @@ -277,11 +277,11 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS events__pdi ON equals(events.distinct_id, events__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'email'), ''), 'null'), '^"|"$', '') AS properties___email FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id @@ -303,9 +303,9 @@ actor_activity.intervals_from_base AS intervals_from_base, count(DISTINCT actor_activity.actor_id) AS count FROM - (SELECT DISTINCT breakdown_values, - intervals_from_base, - actor_id + (SELECT DISTINCT breakdown_values AS breakdown_values, + intervals_from_base AS intervals_from_base, + actor_id AS actor_id FROM (SELECT target_event.breakdown_values AS breakdown_values, dateDiff('day', target_event.event_date, returning_event.event_date) AS intervals_from_base, @@ -370,9 +370,9 @@ actor_activity.intervals_from_base AS intervals_from_base, count(DISTINCT actor_activity.actor_id) AS count FROM - (SELECT DISTINCT breakdown_values, - intervals_from_base, - actor_id + (SELECT DISTINCT breakdown_values AS breakdown_values, + intervals_from_base AS intervals_from_base, + actor_id AS actor_id FROM (SELECT target_event.breakdown_values AS breakdown_values, dateDiff('day', target_event.event_date, returning_event.event_date) AS intervals_from_base, @@ -437,9 +437,9 @@ actor_activity.intervals_from_base AS intervals_from_base, count(DISTINCT actor_activity.actor_id) AS count FROM - (SELECT DISTINCT breakdown_values, - intervals_from_base, - actor_id + (SELECT DISTINCT breakdown_values AS breakdown_values, + intervals_from_base AS intervals_from_base, + actor_id AS actor_id FROM (SELECT target_event.breakdown_values AS breakdown_values, dateDiff('week', target_event.event_date, returning_event.event_date) AS intervals_from_base, @@ -504,9 +504,9 @@ actor_activity.intervals_from_base AS intervals_from_base, count(DISTINCT actor_activity.actor_id) AS count FROM - (SELECT DISTINCT breakdown_values, - intervals_from_base, - actor_id + (SELECT DISTINCT breakdown_values AS breakdown_values, + intervals_from_base AS intervals_from_base, + actor_id AS actor_id FROM (SELECT target_event.breakdown_values AS breakdown_values, dateDiff('week', target_event.event_date, returning_event.event_date) AS intervals_from_base, diff --git a/posthog/hogql_queries/insights/trends/test/__snapshots__/test_trends.ambr b/posthog/hogql_queries/insights/trends/test/__snapshots__/test_trends.ambr index 10d5d36c02b51..8088ac81f9d0a 100644 --- a/posthog/hogql_queries/insights/trends/test/__snapshots__/test_trends.ambr +++ b/posthog/hogql_queries/insights/trends/test/__snapshots__/test_trends.ambr @@ -54,7 +54,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-07 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -72,17 +72,17 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, '$bool_prop'), ''), 'null'), '^"|"$', '') AS `properties___$bool_prop` FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id HAVING ifNull(equals(argMax(person.is_deleted, person.version), 0), 0))), 0)) SETTINGS optimize_aggregation_in_order=1) AS e__pdi__person ON equals(e__pdi.person_id, e__pdi__person.id) WHERE and(equals(e.team_id, 2), greaterOrEquals(toTimeZone(e.timestamp, 'UTC'), toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-01 00:00:00', 6, 'UTC')))), lessOrEquals(toTimeZone(e.timestamp, 'UTC'), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-07 23:59:59', 6, 'UTC'))), ifNull(equals(e__pdi__person.`properties___$bool_prop`, 'x'), 0), and(equals(e.event, 'sign up'), ifNull(in(e__pdi.person_id, - (SELECT cohortpeople.person_id + (SELECT cohortpeople.person_id AS person_id FROM cohortpeople WHERE and(equals(cohortpeople.team_id, 2), equals(cohortpeople.cohort_id, 4)) GROUP BY cohortpeople.person_id, cohortpeople.cohort_id, cohortpeople.version @@ -152,7 +152,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-07 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -169,7 +169,7 @@ WHERE equals(person_overrides.team_id, 2) GROUP BY person_overrides.old_person_id) AS e__override ON equals(e.person_id, e__override.old_person_id) WHERE and(equals(e.team_id, 2), greaterOrEquals(toTimeZone(e.timestamp, 'UTC'), toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-01 00:00:00', 6, 'UTC')))), lessOrEquals(toTimeZone(e.timestamp, 'UTC'), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-07 23:59:59', 6, 'UTC'))), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, '$bool_prop'), ''), 'null'), '^"|"$', ''), 'x'), 0), and(equals(e.event, 'sign up'), ifNull(in(ifNull(nullIf(e__override.override_person_id, '00000000-0000-0000-0000-000000000000'), e.person_id), - (SELECT cohortpeople.person_id + (SELECT cohortpeople.person_id AS person_id FROM cohortpeople WHERE and(equals(cohortpeople.team_id, 2), equals(cohortpeople.cohort_id, 5)) GROUP BY cohortpeople.person_id, cohortpeople.cohort_id, cohortpeople.version @@ -214,12 +214,12 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-01 00:00:00', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 23:59:59', 6, 'UTC'))), 0)) AS numbers @@ -317,12 +317,12 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-01 00:00:00', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 23:59:59', 6, 'UTC'))), 0)) AS numbers @@ -381,12 +381,12 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-22 13:01:01', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'UTC'))), 0)) AS numbers @@ -437,12 +437,12 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-22 13:01:01', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'UTC'))), 0)) AS numbers @@ -490,12 +490,12 @@ ' SELECT sum(count) AS total, - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 1 AS group_key, groupArray(day_start) AS day_start FROM - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-11 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -507,14 +507,14 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - breakdown_value + breakdown_value AS breakdown_value FROM (SELECT count(DISTINCT actor_id) AS total, - breakdown_value + breakdown_value AS breakdown_value FROM - (SELECT d.timestamp, - e.actor_id, - e.breakdown_value + (SELECT d.timestamp AS timestamp, + e.actor_id AS actor_id, + e.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-11 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS timestamp FROM numbers(dateDiff('day', minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-11 00:00:00', 6, 'UTC'))), toIntervalDay(7)), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-11 23:59:59', 6, 'UTC')))) AS numbers) AS d @@ -575,12 +575,12 @@ ' SELECT sum(count) AS total, - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 1 AS group_key, groupArray(day_start) AS day_start FROM - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-11 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -592,14 +592,14 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - breakdown_value + breakdown_value AS breakdown_value FROM (SELECT count(DISTINCT actor_id) AS total, - breakdown_value + breakdown_value AS breakdown_value FROM - (SELECT d.timestamp, - e.actor_id, - e.breakdown_value + (SELECT d.timestamp AS timestamp, + e.actor_id AS actor_id, + e.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-11 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS timestamp FROM numbers(dateDiff('day', minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-11 00:00:00', 6, 'UTC'))), toIntervalDay(7)), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-11 23:59:59', 6, 'UTC')))) AS numbers) AS d @@ -675,17 +675,17 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'name'), ''), 'null'), '^"|"$', '') AS properties___name FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id HAVING ifNull(equals(argMax(person.is_deleted, person.version), 0), 0))), 0)) SETTINGS optimize_aggregation_in_order=1) AS e__pdi__person ON equals(e__pdi.person_id, e__pdi__person.id) WHERE and(equals(e.team_id, 2), equals(e.event, '$pageview'), and(or(ifNull(equals(e__pdi__person.properties___name, 'p1'), 0), ifNull(equals(e__pdi__person.properties___name, 'p2'), 0), ifNull(equals(e__pdi__person.properties___name, 'p3'), 0)), ifNull(in(e__pdi.person_id, - (SELECT cohortpeople.person_id + (SELECT cohortpeople.person_id AS person_id FROM cohortpeople WHERE and(equals(cohortpeople.team_id, 2), equals(cohortpeople.cohort_id, 24)) GROUP BY cohortpeople.person_id, cohortpeople.cohort_id, cohortpeople.version @@ -705,12 +705,12 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-01 00:00:00', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 23:59:59', 6, 'UTC'))), 0)) AS numbers @@ -723,11 +723,11 @@ ORDER BY sec.breakdown_value ASC, day_start ASC UNION ALL SELECT counts AS total, toStartOfDay(timestamp) AS day_start, - breakdown_value + breakdown_value AS breakdown_value FROM - (SELECT d.timestamp, + (SELECT d.timestamp AS timestamp, count(DISTINCT e.actor_id) AS counts, - e.breakdown_value + e.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS timestamp FROM numbers(dateDiff('day', minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-01 00:00:00', 6, 'UTC'))), toIntervalDay(7)), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 23:59:59', 6, 'UTC')))) AS numbers) AS d @@ -744,17 +744,17 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'name'), ''), 'null'), '^"|"$', '') AS properties___name FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id HAVING ifNull(equals(argMax(person.is_deleted, person.version), 0), 0))), 0)) SETTINGS optimize_aggregation_in_order=1) AS e__pdi__person ON equals(e__pdi.person_id, e__pdi__person.id) WHERE and(equals(e.team_id, 2), and(and(equals(e.event, '$pageview'), and(or(ifNull(equals(e__pdi__person.properties___name, 'p1'), 0), ifNull(equals(e__pdi__person.properties___name, 'p2'), 0), ifNull(equals(e__pdi__person.properties___name, 'p3'), 0)), ifNull(in(e__pdi.person_id, - (SELECT cohortpeople.person_id + (SELECT cohortpeople.person_id AS person_id FROM cohortpeople WHERE and(equals(cohortpeople.team_id, 2), equals(cohortpeople.cohort_id, 24)) GROUP BY cohortpeople.person_id, cohortpeople.cohort_id, cohortpeople.version @@ -807,12 +807,12 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-01 00:00:00', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 23:59:59', 6, 'UTC'))), 0)) AS numbers @@ -893,12 +893,12 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-01 00:00:00', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 23:59:59', 6, 'UTC'))), 0)) AS numbers @@ -963,12 +963,12 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-28 13:01:01', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), 0)) AS numbers @@ -1032,12 +1032,12 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-28 13:01:01', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), 0)) AS numbers @@ -1124,7 +1124,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-02 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -1142,11 +1142,11 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'name'), ''), 'null'), '^"|"$', '') AS properties___name FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id @@ -1207,7 +1207,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-02 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -1233,7 +1233,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -1314,7 +1314,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -1357,12 +1357,12 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, '$some_prop'), ''), 'null'), '^"|"$', '') AS `properties___$some_prop`, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'filter_prop'), ''), 'null'), '^"|"$', '') AS properties___filter_prop FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id @@ -1383,12 +1383,12 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-28 13:01:01', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), 0)) AS numbers @@ -1401,11 +1401,11 @@ ORDER BY sec.breakdown_value ASC, day_start ASC UNION ALL SELECT counts AS total, toStartOfDay(timestamp) AS day_start, - breakdown_value + breakdown_value AS breakdown_value FROM - (SELECT d.timestamp, + (SELECT d.timestamp AS timestamp, count(DISTINCT e.actor_id) AS counts, - e.breakdown_value + e.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS timestamp FROM numbers(dateDiff('day', minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-28 13:01:01', 6, 'UTC'))), toIntervalDay(30)), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC')))) AS numbers) AS d @@ -1422,12 +1422,12 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, '$some_prop'), ''), 'null'), '^"|"$', '') AS `properties___$some_prop`, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'filter_prop'), ''), 'null'), '^"|"$', '') AS properties___filter_prop FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id @@ -1473,12 +1473,12 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-28 13:01:01', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), 0)) AS numbers @@ -1491,11 +1491,11 @@ ORDER BY sec.breakdown_value ASC, day_start ASC UNION ALL SELECT counts AS total, toStartOfDay(timestamp) AS day_start, - breakdown_value + breakdown_value AS breakdown_value FROM - (SELECT d.timestamp, + (SELECT d.timestamp AS timestamp, count(DISTINCT e.actor_id) AS counts, - e.breakdown_value + e.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS timestamp FROM numbers(dateDiff('day', minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-28 13:01:01', 6, 'UTC'))), toIntervalDay(30)), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC')))) AS numbers) AS d @@ -1534,7 +1534,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfWeek(assumeNotNull(parseDateTime64BestEffortOrNull('2022-11-30 23:59:59', 6, 'US/Pacific')), 0), toIntervalWeek(numbers.number)) AS day_start @@ -1589,7 +1589,7 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) WHERE and(equals(e.team_id, 2), greaterOrEquals(toTimeZone(e.timestamp, 'UTC'), toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-28 13:01:01', 6, 'UTC')))), lessOrEquals(toTimeZone(e.timestamp, 'UTC'), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), and(equals(e.event, 'sign up'), ifNull(in(e__pdi.person_id, - (SELECT cohortpeople.person_id + (SELECT cohortpeople.person_id AS person_id FROM cohortpeople WHERE and(equals(cohortpeople.team_id, 2), equals(cohortpeople.cohort_id, 37)) GROUP BY cohortpeople.person_id, cohortpeople.cohort_id, cohortpeople.version @@ -1609,12 +1609,12 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-28 13:01:01', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), 0)) AS numbers @@ -1637,7 +1637,7 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) WHERE and(equals(e.team_id, 2), greaterOrEquals(toTimeZone(e.timestamp, 'UTC'), toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-28 13:01:01', 6, 'UTC')))), lessOrEquals(toTimeZone(e.timestamp, 'UTC'), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), and(equals(e.event, 'sign up'), ifNull(in(e__pdi.person_id, - (SELECT cohortpeople.person_id + (SELECT cohortpeople.person_id AS person_id FROM cohortpeople WHERE and(equals(cohortpeople.team_id, 2), equals(cohortpeople.cohort_id, 37)) GROUP BY cohortpeople.person_id, cohortpeople.cohort_id, cohortpeople.version @@ -1688,7 +1688,7 @@ WHERE equals(person_overrides.team_id, 2) GROUP BY person_overrides.old_person_id) AS e__override ON equals(e.person_id, e__override.old_person_id) WHERE and(equals(e.team_id, 2), greaterOrEquals(toTimeZone(e.timestamp, 'UTC'), toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-28 13:01:01', 6, 'UTC')))), lessOrEquals(toTimeZone(e.timestamp, 'UTC'), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), and(equals(e.event, 'sign up'), ifNull(in(ifNull(nullIf(e__override.override_person_id, '00000000-0000-0000-0000-000000000000'), e.person_id), - (SELECT cohortpeople.person_id + (SELECT cohortpeople.person_id AS person_id FROM cohortpeople WHERE and(equals(cohortpeople.team_id, 2), equals(cohortpeople.cohort_id, 38)) GROUP BY cohortpeople.person_id, cohortpeople.cohort_id, cohortpeople.version @@ -1708,12 +1708,12 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-28 13:01:01', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), 0)) AS numbers @@ -1735,7 +1735,7 @@ WHERE equals(person_overrides.team_id, 2) GROUP BY person_overrides.old_person_id) AS e__override ON equals(e.person_id, e__override.old_person_id) WHERE and(equals(e.team_id, 2), greaterOrEquals(toTimeZone(e.timestamp, 'UTC'), toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-28 13:01:01', 6, 'UTC')))), lessOrEquals(toTimeZone(e.timestamp, 'UTC'), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), and(equals(e.event, 'sign up'), ifNull(in(ifNull(nullIf(e__override.override_person_id, '00000000-0000-0000-0000-000000000000'), e.person_id), - (SELECT cohortpeople.person_id + (SELECT cohortpeople.person_id AS person_id FROM cohortpeople WHERE and(equals(cohortpeople.team_id, 2), equals(cohortpeople.cohort_id, 38)) GROUP BY cohortpeople.person_id, cohortpeople.cohort_id, cohortpeople.version @@ -1758,7 +1758,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -1776,11 +1776,11 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'name'), ''), 'null'), '^"|"$', '') AS properties___name FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id @@ -1801,7 +1801,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -1819,11 +1819,11 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'name'), ''), 'null'), '^"|"$', '') AS properties___name FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id @@ -1844,7 +1844,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -1870,7 +1870,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -1888,11 +1888,11 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, nullIf(nullIf(person.pmat_name, ''), 'null') AS properties___name FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id @@ -1913,7 +1913,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -1939,7 +1939,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -1957,11 +1957,11 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, nullIf(nullIf(person.pmat_name, ''), 'null') AS properties___name FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id @@ -1996,7 +1996,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-03 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -2022,7 +2022,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-03 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -2054,7 +2054,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -2080,7 +2080,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -2119,7 +2119,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -2129,7 +2129,7 @@ UNION ALL SELECT counts AS total, toStartOfDay(timestamp) AS day_start FROM - (SELECT d.timestamp, + (SELECT d.timestamp AS timestamp, count(DISTINCT e.actor_id) AS counts FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS timestamp @@ -2171,7 +2171,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -2214,12 +2214,12 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-29 13:01:01', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'UTC'))), 0)) AS numbers @@ -2266,7 +2266,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'America/Phoenix'))), toIntervalDay(numbers.number)) AS day_start @@ -2292,7 +2292,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'America/Phoenix'))), toIntervalDay(numbers.number)) AS day_start @@ -2331,7 +2331,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'America/Phoenix'))), toIntervalDay(numbers.number)) AS day_start @@ -2341,7 +2341,7 @@ UNION ALL SELECT counts AS total, toStartOfDay(timestamp) AS day_start FROM - (SELECT d.timestamp, + (SELECT d.timestamp AS timestamp, count(DISTINCT e.actor_id) AS counts FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'America/Phoenix'))), toIntervalDay(numbers.number)) AS timestamp @@ -2383,7 +2383,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'America/Phoenix'))), toIntervalDay(numbers.number)) AS day_start @@ -2426,12 +2426,12 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'America/Phoenix'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-29 06:01:01', 6, 'America/Phoenix')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'America/Phoenix'))), 0)) AS numbers @@ -2478,7 +2478,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'Asia/Tokyo'))), toIntervalDay(numbers.number)) AS day_start @@ -2504,7 +2504,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'Asia/Tokyo'))), toIntervalDay(numbers.number)) AS day_start @@ -2543,7 +2543,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'Asia/Tokyo'))), toIntervalDay(numbers.number)) AS day_start @@ -2553,7 +2553,7 @@ UNION ALL SELECT counts AS total, toStartOfDay(timestamp) AS day_start FROM - (SELECT d.timestamp, + (SELECT d.timestamp AS timestamp, count(DISTINCT e.actor_id) AS counts FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'Asia/Tokyo'))), toIntervalDay(numbers.number)) AS timestamp @@ -2595,7 +2595,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'Asia/Tokyo'))), toIntervalDay(numbers.number)) AS day_start @@ -2638,12 +2638,12 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'Asia/Tokyo'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-29 22:01:01', 6, 'Asia/Tokyo')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 23:59:59', 6, 'Asia/Tokyo'))), 0)) AS numbers @@ -2690,7 +2690,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfHour(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 10:59:59', 6, 'UTC'))), toIntervalHour(numbers.number)) AS day_start @@ -2729,7 +2729,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfHour(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 10:59:59', 6, 'UTC'))), toIntervalHour(numbers.number)) AS day_start @@ -2755,7 +2755,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfHour(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 10:59:59', 6, 'America/Phoenix'))), toIntervalHour(numbers.number)) AS day_start @@ -2794,7 +2794,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfHour(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 10:59:59', 6, 'America/Phoenix'))), toIntervalHour(numbers.number)) AS day_start @@ -2820,7 +2820,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfHour(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 10:59:59', 6, 'Asia/Tokyo'))), toIntervalHour(numbers.number)) AS day_start @@ -2859,7 +2859,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfHour(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-05 10:59:59', 6, 'Asia/Tokyo'))), toIntervalHour(numbers.number)) AS day_start @@ -2885,7 +2885,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfWeek(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-26 23:59:59', 6, 'UTC')), 0), toIntervalWeek(numbers.number)) AS day_start @@ -2911,7 +2911,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfWeek(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-26 23:59:59', 6, 'UTC')), 3), toIntervalWeek(numbers.number)) AS day_start @@ -2937,7 +2937,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfWeek(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-26 23:59:59', 6, 'America/Phoenix')), 0), toIntervalWeek(numbers.number)) AS day_start @@ -2963,7 +2963,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfWeek(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-26 23:59:59', 6, 'America/Phoenix')), 3), toIntervalWeek(numbers.number)) AS day_start @@ -2989,7 +2989,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfWeek(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-26 23:59:59', 6, 'Asia/Tokyo')), 0), toIntervalWeek(numbers.number)) AS day_start @@ -3015,7 +3015,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfWeek(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-26 23:59:59', 6, 'Asia/Tokyo')), 3), toIntervalWeek(numbers.number)) AS day_start @@ -3050,13 +3050,13 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'email'), ''), 'null'), '^"|"$', '') AS properties___email, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, '$os'), ''), 'null'), '^"|"$', '') AS `properties___$os`, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, '$browser'), ''), 'null'), '^"|"$', '') AS `properties___$browser` FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id @@ -3077,12 +3077,12 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-07-01 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-01 00:00:00', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-07-01 23:59:59', 6, 'UTC'))), 0)) AS numbers @@ -3105,13 +3105,13 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'email'), ''), 'null'), '^"|"$', '') AS properties___email, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, '$os'), ''), 'null'), '^"|"$', '') AS `properties___$os`, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, '$browser'), ''), 'null'), '^"|"$', '') AS `properties___$browser` FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id @@ -3144,13 +3144,13 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'email'), ''), 'null'), '^"|"$', '') AS properties___email, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, '$os'), ''), 'null'), '^"|"$', '') AS `properties___$os`, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, '$browser'), ''), 'null'), '^"|"$', '') AS `properties___$browser` FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id @@ -3171,12 +3171,12 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-07-01 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-01 00:00:00', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-07-01 23:59:59', 6, 'UTC'))), 0)) AS numbers @@ -3199,13 +3199,13 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'email'), ''), 'null'), '^"|"$', '') AS properties___email, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, '$os'), ''), 'null'), '^"|"$', '') AS `properties___$os`, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, '$browser'), ''), 'null'), '^"|"$', '') AS `properties___$browser` FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id @@ -3229,7 +3229,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-31 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -3255,7 +3255,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-31 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -3273,11 +3273,11 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, '$some_prop'), ''), 'null'), '^"|"$', '') AS `properties___$some_prop` FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id @@ -3307,11 +3307,11 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, '$some_prop'), ''), 'null'), '^"|"$', '') AS `properties___$some_prop` FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id @@ -3332,12 +3332,12 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-31 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-24 13:00:01', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-31 23:59:59', 6, 'UTC'))), 0)) AS numbers @@ -3360,11 +3360,11 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, '$some_prop'), ''), 'null'), '^"|"$', '') AS `properties___$some_prop` FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id @@ -3388,7 +3388,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-31 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -3398,7 +3398,7 @@ UNION ALL SELECT counts AS total, toStartOfDay(timestamp) AS day_start FROM - (SELECT d.timestamp, + (SELECT d.timestamp AS timestamp, count(DISTINCT e.actor_id) AS counts FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-31 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS timestamp @@ -3427,7 +3427,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-31 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -3437,7 +3437,7 @@ UNION ALL SELECT counts AS total, toStartOfDay(timestamp) AS day_start FROM - (SELECT d.timestamp, + (SELECT d.timestamp AS timestamp, count(DISTINCT e.actor_id) AS counts FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-31 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS timestamp @@ -3483,12 +3483,12 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-31 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-24 13:00:01', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-31 23:59:59', 6, 'UTC'))), 0)) AS numbers @@ -3522,7 +3522,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -3548,7 +3548,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -3590,18 +3590,18 @@ groupArray(count) AS total, ifNull(toString(breakdown_value), '') AS breakdown_value FROM - (SELECT day_start, + (SELECT day_start AS day_start, sum(count) OVER (PARTITION BY breakdown_value ORDER BY day_start ASC) AS count, - breakdown_value + breakdown_value AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-28 13:00:01', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), 0)) AS numbers @@ -3664,18 +3664,18 @@ groupArray(count) AS total, ifNull(toString(breakdown_value), '') AS breakdown_value FROM - (SELECT day_start, + (SELECT day_start AS day_start, sum(count) OVER (PARTITION BY breakdown_value ORDER BY day_start ASC) AS count, - breakdown_value + breakdown_value AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-28 13:00:01', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), 0)) AS numbers @@ -3729,12 +3729,12 @@ ' SELECT sum(count) AS total, - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 1 AS group_key, groupArray(day_start) AS day_start FROM - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfWeek(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC')), 0), toIntervalWeek(numbers.number)) AS day_start @@ -3746,10 +3746,10 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - breakdown_value + breakdown_value AS breakdown_value FROM (SELECT quantile(0.5)(session_duration) AS total, - breakdown_value + breakdown_value AS breakdown_value FROM (SELECT any(e__session.duration) AS session_duration, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$some_property'), ''), 'null'), '^"|"$', '') AS breakdown_value @@ -3793,12 +3793,12 @@ ' SELECT sum(count) AS total, - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 1 AS group_key, groupArray(day_start) AS day_start FROM - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -3810,10 +3810,10 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - breakdown_value + breakdown_value AS breakdown_value FROM (SELECT quantile(0.5)(session_duration) AS total, - breakdown_value + breakdown_value AS breakdown_value FROM (SELECT any(e__session.duration) AS session_duration, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$some_property'), ''), 'null'), '^"|"$', '') AS breakdown_value @@ -3843,7 +3843,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -3869,7 +3869,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-28 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -3895,7 +3895,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -3919,12 +3919,12 @@ ' SELECT sum(count) AS total, - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 1 AS group_key, groupArray(day_start) AS day_start FROM - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-07 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -3936,7 +3936,7 @@ FROM (SELECT sum(total) AS count FROM - (SELECT total + (SELECT total AS total FROM (SELECT avg(total) AS total FROM @@ -3967,12 +3967,12 @@ ' SELECT sum(count) AS total, - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 1 AS group_key, groupArray(day_start) AS day_start FROM - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-07 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -3984,7 +3984,7 @@ FROM (SELECT sum(total) AS count FROM - (SELECT total + (SELECT total AS total FROM (SELECT avg(total) AS total FROM @@ -4024,12 +4024,12 @@ ' SELECT sum(count) AS total, - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 1 AS group_key, groupArray(day_start) AS day_start FROM - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-07 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -4041,13 +4041,13 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - breakdown_value + breakdown_value AS breakdown_value FROM - (SELECT total, - breakdown_value + (SELECT total AS total, + breakdown_value AS breakdown_value FROM (SELECT avg(total) AS total, - breakdown_value + breakdown_value AS breakdown_value FROM (SELECT count(e.uuid) AS total, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'color'), ''), 'null'), '^"|"$', '') AS breakdown_value @@ -4084,18 +4084,18 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-07 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-01 00:00:00', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-07 23:59:59', 6, 'UTC'))), 0)) AS numbers UNION ALL SELECT 0 AS total, toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-01 00:00:00', 6, 'UTC'))) AS day_start - UNION ALL SELECT total, - day_start + UNION ALL SELECT total AS total, + day_start AS day_start FROM (SELECT avg(total) AS total, - day_start + day_start AS day_start FROM (SELECT count(e.uuid) AS total, toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start @@ -4131,18 +4131,18 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-07 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-01 00:00:00', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-07 23:59:59', 6, 'UTC'))), 0)) AS numbers UNION ALL SELECT 0 AS total, toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-01 00:00:00', 6, 'UTC'))) AS day_start - UNION ALL SELECT total, - day_start + UNION ALL SELECT total AS total, + day_start AS day_start FROM (SELECT avg(total) AS total, - day_start + day_start AS day_start FROM (SELECT count(e.uuid) AS total, toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start @@ -4170,12 +4170,12 @@ SELECT groupArray(day_start) AS date, groupArray(count) AS total FROM - (SELECT day_start, + (SELECT day_start AS day_start, sum(count) OVER ( ORDER BY day_start ASC) AS count FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -4210,11 +4210,11 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, '$some_prop'), ''), 'null'), '^"|"$', '') AS `properties___$some_prop` FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id @@ -4232,12 +4232,12 @@ ' SELECT sum(count) AS total, - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 1 AS group_key, groupArray(day_start) AS day_start FROM - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfWeek(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC')), 0), toIntervalWeek(numbers.number)) AS day_start @@ -4249,10 +4249,10 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - breakdown_value + breakdown_value AS breakdown_value FROM (SELECT quantile(0.5)(session_duration) AS total, - breakdown_value + breakdown_value AS breakdown_value FROM (SELECT any(e__session.duration) AS session_duration, e__pdi__person.`properties___$some_prop` AS breakdown_value @@ -4271,11 +4271,11 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, '$some_prop'), ''), 'null'), '^"|"$', '') AS `properties___$some_prop` FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id @@ -4299,7 +4299,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfWeek(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC')), 0), toIntervalWeek(numbers.number)) AS day_start @@ -4323,12 +4323,12 @@ ' SELECT sum(count) AS total, - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 1 AS group_key, groupArray(day_start) AS day_start FROM - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfWeek(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC')), 0), toIntervalWeek(numbers.number)) AS day_start @@ -4362,12 +4362,12 @@ ' SELECT sum(count) AS total, - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 1 AS group_key, groupArray(day_start) AS day_start FROM - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -4403,7 +4403,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfWeek(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC')), 0), toIntervalWeek(numbers.number)) AS day_start @@ -4411,7 +4411,7 @@ UNION ALL SELECT 0 AS total, toStartOfWeek(assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-28 13:00:01', 6, 'UTC')), 0) AS day_start UNION ALL SELECT quantile(0.5)(session_duration) AS total, - day_start + day_start AS day_start FROM (SELECT any(e__session.duration) AS session_duration, toStartOfWeek(toTimeZone(e.timestamp, 'UTC'), 0) AS day_start @@ -4441,7 +4441,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -4449,7 +4449,7 @@ UNION ALL SELECT 0 AS total, toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-28 13:00:01', 6, 'UTC'))) AS day_start UNION ALL SELECT quantile(0.5)(session_duration) AS total, - day_start + day_start AS day_start FROM (SELECT any(e__session.duration) AS session_duration, toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start @@ -4496,12 +4496,12 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfWeek(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC')), 0), toIntervalWeek(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('week', assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-28 13:00:01', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), 0)) AS numbers @@ -4513,8 +4513,8 @@ JOIN breakdown_value AS breakdown_value) AS sec ORDER BY sec.breakdown_value ASC, day_start ASC UNION ALL SELECT quantile(0.5)(session_duration) AS total, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT any(e__session.duration) AS session_duration, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$some_property'), ''), 'null'), '^"|"$', '') AS breakdown_value, @@ -4566,12 +4566,12 @@ ifNull(toString(breakdown_value), '') AS breakdown_value FROM (SELECT sum(total) AS count, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT 0 AS total, ticks.day_start AS day_start, - sec.breakdown_value + sec.breakdown_value AS breakdown_value FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start FROM numbers(coalesce(dateDiff('day', assumeNotNull(parseDateTime64BestEffortOrNull('2019-12-28 13:00:05', 6, 'UTC')), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-04 23:59:59', 6, 'UTC'))), 0)) AS numbers @@ -4583,8 +4583,8 @@ JOIN breakdown_value AS breakdown_value) AS sec ORDER BY sec.breakdown_value ASC, day_start ASC UNION ALL SELECT quantile(0.5)(session_duration) AS total, - day_start, - breakdown_value + day_start AS day_start, + breakdown_value AS breakdown_value FROM (SELECT any(e__session.duration) AS session_duration, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$some_property'), ''), 'null'), '^"|"$', '') AS breakdown_value, @@ -4617,12 +4617,12 @@ ' SELECT sum(count) AS total, - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 1 AS group_key, groupArray(day_start) AS day_start FROM - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -4636,8 +4636,8 @@ FROM (SELECT count(DISTINCT actor_id) AS total FROM - (SELECT d.timestamp, - e.actor_id + (SELECT d.timestamp AS timestamp, + e.actor_id AS actor_id FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS timestamp FROM numbers(dateDiff('day', minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-11 00:00:00', 6, 'UTC'))), toIntervalDay(7)), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 23:59:59', 6, 'UTC')))) AS numbers) AS d @@ -4675,12 +4675,12 @@ ' SELECT sum(count) AS total, - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 1 AS group_key, groupArray(day_start) AS day_start FROM - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-08 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -4694,8 +4694,8 @@ FROM (SELECT count(DISTINCT actor_id) AS total FROM - (SELECT d.timestamp, - e.actor_id + (SELECT d.timestamp AS timestamp, + e.actor_id AS actor_id FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-08 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS timestamp FROM numbers(dateDiff('day', minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-01 00:00:00', 6, 'UTC'))), toIntervalDay(7)), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-08 23:59:59', 6, 'UTC')))) AS numbers) AS d @@ -4733,12 +4733,12 @@ ' SELECT sum(count) AS total, - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 1 AS group_key, groupArray(day_start) AS day_start FROM - (SELECT day_start + (SELECT day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-08 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -4752,8 +4752,8 @@ FROM (SELECT count(DISTINCT actor_id) AS total FROM - (SELECT d.timestamp, - e.actor_id + (SELECT d.timestamp AS timestamp, + e.actor_id AS actor_id FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-08 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS timestamp FROM numbers(dateDiff('day', minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-01 00:00:00', 6, 'UTC'))), toIntervalDay(7)), assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-08 23:59:59', 6, 'UTC')))) AS numbers) AS d @@ -4793,7 +4793,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-19 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -4803,7 +4803,7 @@ UNION ALL SELECT counts AS total, toStartOfDay(timestamp) AS day_start FROM - (SELECT d.timestamp, + (SELECT d.timestamp AS timestamp, count(DISTINCT e.actor_id) AS counts FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-19 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS timestamp @@ -4845,7 +4845,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-19 23:59:59', 6, 'America/Phoenix'))), toIntervalDay(numbers.number)) AS day_start @@ -4855,7 +4855,7 @@ UNION ALL SELECT counts AS total, toStartOfDay(timestamp) AS day_start FROM - (SELECT d.timestamp, + (SELECT d.timestamp AS timestamp, count(DISTINCT e.actor_id) AS counts FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-19 23:59:59', 6, 'America/Phoenix'))), toIntervalDay(numbers.number)) AS timestamp @@ -4897,7 +4897,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-19 23:59:59', 6, 'Asia/Tokyo'))), toIntervalDay(numbers.number)) AS day_start @@ -4907,7 +4907,7 @@ UNION ALL SELECT counts AS total, toStartOfDay(timestamp) AS day_start FROM - (SELECT d.timestamp, + (SELECT d.timestamp AS timestamp, count(DISTINCT e.actor_id) AS counts FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-19 23:59:59', 6, 'Asia/Tokyo'))), toIntervalDay(numbers.number)) AS timestamp @@ -4949,7 +4949,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -4959,7 +4959,7 @@ UNION ALL SELECT counts AS total, toStartOfDay(timestamp) AS day_start FROM - (SELECT d.timestamp, + (SELECT d.timestamp AS timestamp, count(DISTINCT e.actor_id) AS counts FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS timestamp @@ -4976,11 +4976,11 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, 'name'), ''), 'null'), '^"|"$', '') AS properties___name FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id @@ -5005,7 +5005,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS day_start @@ -5015,7 +5015,7 @@ UNION ALL SELECT counts AS total, toStartOfDay(timestamp) AS day_start FROM - (SELECT d.timestamp, + (SELECT d.timestamp AS timestamp, count(DISTINCT e.actor_id) AS counts FROM (SELECT minus(toStartOfDay(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-12 23:59:59', 6, 'UTC'))), toIntervalDay(numbers.number)) AS timestamp @@ -5032,11 +5032,11 @@ GROUP BY person_distinct_id2.distinct_id HAVING ifNull(equals(argMax(person_distinct_id2.is_deleted, person_distinct_id2.version), 0), 0)) AS e__pdi ON equals(e.distinct_id, e__pdi.distinct_id) INNER JOIN - (SELECT person.id, + (SELECT person.id AS id, nullIf(nullIf(person.pmat_name, ''), 'null') AS properties___name FROM person WHERE and(equals(person.team_id, 2), ifNull(in(tuple(person.id, person.version), - (SELECT person.id, max(person.version) AS version + (SELECT person.id AS id, max(person.version) AS version FROM person WHERE equals(person.team_id, 2) GROUP BY person.id @@ -5061,7 +5061,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfHour(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-09 17:00:00', 6, 'UTC'))), toIntervalHour(numbers.number)) AS day_start @@ -5071,7 +5071,7 @@ UNION ALL SELECT counts AS total, toStartOfHour(timestamp) AS day_start FROM - (SELECT d.timestamp, + (SELECT d.timestamp AS timestamp, count(DISTINCT e.actor_id) AS counts FROM (SELECT minus(toStartOfHour(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-09 17:00:00', 6, 'UTC'))), toIntervalHour(numbers.number)) AS timestamp @@ -5113,7 +5113,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfWeek(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-18 23:59:59', 6, 'UTC')), 0), toIntervalWeek(numbers.number)) AS day_start @@ -5123,7 +5123,7 @@ UNION ALL SELECT counts AS total, toStartOfWeek(timestamp, 0) AS day_start FROM - (SELECT d.timestamp, + (SELECT d.timestamp AS timestamp, count(DISTINCT e.actor_id) AS counts FROM (SELECT minus(toStartOfWeek(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-18 23:59:59', 6, 'UTC')), 0), toIntervalWeek(numbers.number)) AS timestamp @@ -5165,7 +5165,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfWeek(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-18 23:59:59', 6, 'America/Phoenix')), 0), toIntervalWeek(numbers.number)) AS day_start @@ -5175,7 +5175,7 @@ UNION ALL SELECT counts AS total, toStartOfWeek(timestamp, 0) AS day_start FROM - (SELECT d.timestamp, + (SELECT d.timestamp AS timestamp, count(DISTINCT e.actor_id) AS counts FROM (SELECT minus(toStartOfWeek(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-18 23:59:59', 6, 'America/Phoenix')), 0), toIntervalWeek(numbers.number)) AS timestamp @@ -5217,7 +5217,7 @@ groupArray(count) AS total FROM (SELECT sum(total) AS count, - day_start + day_start AS day_start FROM (SELECT 0 AS total, minus(toStartOfWeek(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-18 23:59:59', 6, 'Asia/Tokyo')), 0), toIntervalWeek(numbers.number)) AS day_start @@ -5227,7 +5227,7 @@ UNION ALL SELECT counts AS total, toStartOfWeek(timestamp, 0) AS day_start FROM - (SELECT d.timestamp, + (SELECT d.timestamp AS timestamp, count(DISTINCT e.actor_id) AS counts FROM (SELECT minus(toStartOfWeek(assumeNotNull(parseDateTime64BestEffortOrNull('2020-01-18 23:59:59', 6, 'Asia/Tokyo')), 0), toIntervalWeek(numbers.number)) AS timestamp diff --git a/posthog/hogql_queries/test/__snapshots__/test_sessions_timeline_query_runner.ambr b/posthog/hogql_queries/test/__snapshots__/test_sessions_timeline_query_runner.ambr index b73f7380c6b6b..6f369e808e993 100644 --- a/posthog/hogql_queries/test/__snapshots__/test_sessions_timeline_query_runner.ambr +++ b/posthog/hogql_queries/test/__snapshots__/test_sessions_timeline_query_runner.ambr @@ -1,34 +1,36 @@ # name: TestSessionsTimelineQueryRunner.test_before_and_after ' - SELECT e.uuid, - e.timestamp, - e.event, - e.properties, - e.distinct_id, - e.elements_chain, + SELECT e.uuid AS uuid, + e.timestamp AS timestamp, + e.event AS event, + e.properties AS properties, + e.distinct_id AS distinct_id, + e.elements_chain AS elements_chain, e.session_id AS formal_session_id, first_value(e.uuid) OVER (PARTITION BY tuple(e.person_id, e.session_id_flip_index) ORDER BY toInt64(e.timestamp) ASC RANGE BETWEEN 1800 PRECEDING AND CURRENT ROW) AS informal_session_uuid, dateDiff('s', sre.start_time, sre.end_time) AS recording_duration_s FROM - (SELECT uuid, - person_id, timestamp, event, - properties, - distinct_id, - elements_chain, - session_id, - prev_session_id, - sum(if(ifNull(equals(session_id, prev_session_id), isNull(session_id) - and isNull(prev_session_id)), 0, 1)) OVER (PARTITION BY person_id - ORDER BY timestamp ASC ROWS UNBOUNDED PRECEDING) AS session_id_flip_index + (SELECT uuid AS uuid, + person_id AS person_id, + timestamp AS timestamp, + event AS event, + properties AS properties, + distinct_id AS distinct_id, + elements_chain AS elements_chain, + session_id AS session_id, + prev_session_id AS prev_session_id, + sum(if(ifNull(equals(session_id, prev_session_id), isNull(session_id) + and isNull(prev_session_id)), 0, 1)) OVER (PARTITION BY person_id + ORDER BY timestamp ASC ROWS UNBOUNDED PRECEDING) AS session_id_flip_index FROM - (SELECT events.uuid, + (SELECT events.uuid AS uuid, events__pdi.person_id AS person_id, toTimeZone(events.timestamp, 'UTC') AS timestamp, - events.event, - events.properties, - events.distinct_id, - events.elements_chain, + events.event AS event, + events.properties AS properties, + events.distinct_id AS distinct_id, + events.elements_chain AS elements_chain, events.`$session_id` AS session_id, lagInFrame(events.`$session_id`, 1) OVER (PARTITION BY person_id ORDER BY timestamp ASC) AS prev_session_id @@ -46,7 +48,7 @@ LEFT JOIN (SELECT toTimeZone(session_replay_events.start_time, 'UTC') AS start_time, toTimeZone(session_replay_events.end_time, 'UTC') AS end_time, - session_replay_events.session_id + session_replay_events.session_id AS session_id FROM (SELECT min(session_replay_events.min_first_timestamp) AS start_time, max(session_replay_events.max_last_timestamp) AS end_time, @@ -62,35 +64,37 @@ --- # name: TestSessionsTimelineQueryRunner.test_before_and_after_defaults ' - SELECT e.uuid, - e.timestamp, - e.event, - e.properties, - e.distinct_id, - e.elements_chain, + SELECT e.uuid AS uuid, + e.timestamp AS timestamp, + e.event AS event, + e.properties AS properties, + e.distinct_id AS distinct_id, + e.elements_chain AS elements_chain, e.session_id AS formal_session_id, first_value(e.uuid) OVER (PARTITION BY tuple(e.person_id, e.session_id_flip_index) ORDER BY toInt64(e.timestamp) ASC RANGE BETWEEN 1800 PRECEDING AND CURRENT ROW) AS informal_session_uuid, dateDiff('s', sre.start_time, sre.end_time) AS recording_duration_s FROM - (SELECT uuid, - person_id, timestamp, event, - properties, - distinct_id, - elements_chain, - session_id, - prev_session_id, - sum(if(ifNull(equals(session_id, prev_session_id), isNull(session_id) - and isNull(prev_session_id)), 0, 1)) OVER (PARTITION BY person_id - ORDER BY timestamp ASC ROWS UNBOUNDED PRECEDING) AS session_id_flip_index + (SELECT uuid AS uuid, + person_id AS person_id, + timestamp AS timestamp, + event AS event, + properties AS properties, + distinct_id AS distinct_id, + elements_chain AS elements_chain, + session_id AS session_id, + prev_session_id AS prev_session_id, + sum(if(ifNull(equals(session_id, prev_session_id), isNull(session_id) + and isNull(prev_session_id)), 0, 1)) OVER (PARTITION BY person_id + ORDER BY timestamp ASC ROWS UNBOUNDED PRECEDING) AS session_id_flip_index FROM - (SELECT events.uuid, + (SELECT events.uuid AS uuid, events__pdi.person_id AS person_id, toTimeZone(events.timestamp, 'UTC') AS timestamp, - events.event, - events.properties, - events.distinct_id, - events.elements_chain, + events.event AS event, + events.properties AS properties, + events.distinct_id AS distinct_id, + events.elements_chain AS elements_chain, events.`$session_id` AS session_id, lagInFrame(events.`$session_id`, 1) OVER (PARTITION BY person_id ORDER BY timestamp ASC) AS prev_session_id @@ -108,7 +112,7 @@ LEFT JOIN (SELECT toTimeZone(session_replay_events.start_time, 'UTC') AS start_time, toTimeZone(session_replay_events.end_time, 'UTC') AS end_time, - session_replay_events.session_id + session_replay_events.session_id AS session_id FROM (SELECT min(session_replay_events.min_first_timestamp) AS start_time, max(session_replay_events.max_last_timestamp) AS end_time, @@ -124,35 +128,37 @@ --- # name: TestSessionsTimelineQueryRunner.test_event_limit_and_has_more ' - SELECT e.uuid, - e.timestamp, - e.event, - e.properties, - e.distinct_id, - e.elements_chain, + SELECT e.uuid AS uuid, + e.timestamp AS timestamp, + e.event AS event, + e.properties AS properties, + e.distinct_id AS distinct_id, + e.elements_chain AS elements_chain, e.session_id AS formal_session_id, first_value(e.uuid) OVER (PARTITION BY tuple(e.person_id, e.session_id_flip_index) ORDER BY toInt64(e.timestamp) ASC RANGE BETWEEN 1800 PRECEDING AND CURRENT ROW) AS informal_session_uuid, dateDiff('s', sre.start_time, sre.end_time) AS recording_duration_s FROM - (SELECT uuid, - person_id, timestamp, event, - properties, - distinct_id, - elements_chain, - session_id, - prev_session_id, - sum(if(ifNull(equals(session_id, prev_session_id), isNull(session_id) - and isNull(prev_session_id)), 0, 1)) OVER (PARTITION BY person_id - ORDER BY timestamp ASC ROWS UNBOUNDED PRECEDING) AS session_id_flip_index + (SELECT uuid AS uuid, + person_id AS person_id, + timestamp AS timestamp, + event AS event, + properties AS properties, + distinct_id AS distinct_id, + elements_chain AS elements_chain, + session_id AS session_id, + prev_session_id AS prev_session_id, + sum(if(ifNull(equals(session_id, prev_session_id), isNull(session_id) + and isNull(prev_session_id)), 0, 1)) OVER (PARTITION BY person_id + ORDER BY timestamp ASC ROWS UNBOUNDED PRECEDING) AS session_id_flip_index FROM - (SELECT events.uuid, + (SELECT events.uuid AS uuid, events__pdi.person_id AS person_id, toTimeZone(events.timestamp, 'UTC') AS timestamp, - events.event, - events.properties, - events.distinct_id, - events.elements_chain, + events.event AS event, + events.properties AS properties, + events.distinct_id AS distinct_id, + events.elements_chain AS elements_chain, events.`$session_id` AS session_id, lagInFrame(events.`$session_id`, 1) OVER (PARTITION BY person_id ORDER BY timestamp ASC) AS prev_session_id @@ -170,7 +176,7 @@ LEFT JOIN (SELECT toTimeZone(session_replay_events.start_time, 'UTC') AS start_time, toTimeZone(session_replay_events.end_time, 'UTC') AS end_time, - session_replay_events.session_id + session_replay_events.session_id AS session_id FROM (SELECT min(session_replay_events.min_first_timestamp) AS start_time, max(session_replay_events.max_last_timestamp) AS end_time, @@ -186,35 +192,37 @@ --- # name: TestSessionsTimelineQueryRunner.test_formal_and_informal_sessions_global ' - SELECT e.uuid, - e.timestamp, - e.event, - e.properties, - e.distinct_id, - e.elements_chain, + SELECT e.uuid AS uuid, + e.timestamp AS timestamp, + e.event AS event, + e.properties AS properties, + e.distinct_id AS distinct_id, + e.elements_chain AS elements_chain, e.session_id AS formal_session_id, first_value(e.uuid) OVER (PARTITION BY tuple(e.person_id, e.session_id_flip_index) ORDER BY toInt64(e.timestamp) ASC RANGE BETWEEN 1800 PRECEDING AND CURRENT ROW) AS informal_session_uuid, dateDiff('s', sre.start_time, sre.end_time) AS recording_duration_s FROM - (SELECT uuid, - person_id, timestamp, event, - properties, - distinct_id, - elements_chain, - session_id, - prev_session_id, - sum(if(ifNull(equals(session_id, prev_session_id), isNull(session_id) - and isNull(prev_session_id)), 0, 1)) OVER (PARTITION BY person_id - ORDER BY timestamp ASC ROWS UNBOUNDED PRECEDING) AS session_id_flip_index + (SELECT uuid AS uuid, + person_id AS person_id, + timestamp AS timestamp, + event AS event, + properties AS properties, + distinct_id AS distinct_id, + elements_chain AS elements_chain, + session_id AS session_id, + prev_session_id AS prev_session_id, + sum(if(ifNull(equals(session_id, prev_session_id), isNull(session_id) + and isNull(prev_session_id)), 0, 1)) OVER (PARTITION BY person_id + ORDER BY timestamp ASC ROWS UNBOUNDED PRECEDING) AS session_id_flip_index FROM - (SELECT events.uuid, + (SELECT events.uuid AS uuid, events__pdi.person_id AS person_id, toTimeZone(events.timestamp, 'UTC') AS timestamp, - events.event, - events.properties, - events.distinct_id, - events.elements_chain, + events.event AS event, + events.properties AS properties, + events.distinct_id AS distinct_id, + events.elements_chain AS elements_chain, events.`$session_id` AS session_id, lagInFrame(events.`$session_id`, 1) OVER (PARTITION BY person_id ORDER BY timestamp ASC) AS prev_session_id @@ -232,7 +240,7 @@ LEFT JOIN (SELECT toTimeZone(session_replay_events.start_time, 'UTC') AS start_time, toTimeZone(session_replay_events.end_time, 'UTC') AS end_time, - session_replay_events.session_id + session_replay_events.session_id AS session_id FROM (SELECT min(session_replay_events.min_first_timestamp) AS start_time, max(session_replay_events.max_last_timestamp) AS end_time, @@ -248,35 +256,37 @@ --- # name: TestSessionsTimelineQueryRunner.test_formal_session_with_recording ' - SELECT e.uuid, - e.timestamp, - e.event, - e.properties, - e.distinct_id, - e.elements_chain, + SELECT e.uuid AS uuid, + e.timestamp AS timestamp, + e.event AS event, + e.properties AS properties, + e.distinct_id AS distinct_id, + e.elements_chain AS elements_chain, e.session_id AS formal_session_id, first_value(e.uuid) OVER (PARTITION BY tuple(e.person_id, e.session_id_flip_index) ORDER BY toInt64(e.timestamp) ASC RANGE BETWEEN 1800 PRECEDING AND CURRENT ROW) AS informal_session_uuid, dateDiff('s', sre.start_time, sre.end_time) AS recording_duration_s FROM - (SELECT uuid, - person_id, timestamp, event, - properties, - distinct_id, - elements_chain, - session_id, - prev_session_id, - sum(if(ifNull(equals(session_id, prev_session_id), isNull(session_id) - and isNull(prev_session_id)), 0, 1)) OVER (PARTITION BY person_id - ORDER BY timestamp ASC ROWS UNBOUNDED PRECEDING) AS session_id_flip_index + (SELECT uuid AS uuid, + person_id AS person_id, + timestamp AS timestamp, + event AS event, + properties AS properties, + distinct_id AS distinct_id, + elements_chain AS elements_chain, + session_id AS session_id, + prev_session_id AS prev_session_id, + sum(if(ifNull(equals(session_id, prev_session_id), isNull(session_id) + and isNull(prev_session_id)), 0, 1)) OVER (PARTITION BY person_id + ORDER BY timestamp ASC ROWS UNBOUNDED PRECEDING) AS session_id_flip_index FROM - (SELECT events.uuid, + (SELECT events.uuid AS uuid, events__pdi.person_id AS person_id, toTimeZone(events.timestamp, 'UTC') AS timestamp, - events.event, - events.properties, - events.distinct_id, - events.elements_chain, + events.event AS event, + events.properties AS properties, + events.distinct_id AS distinct_id, + events.elements_chain AS elements_chain, events.`$session_id` AS session_id, lagInFrame(events.`$session_id`, 1) OVER (PARTITION BY person_id ORDER BY timestamp ASC) AS prev_session_id @@ -294,7 +304,7 @@ LEFT JOIN (SELECT toTimeZone(session_replay_events.start_time, 'UTC') AS start_time, toTimeZone(session_replay_events.end_time, 'UTC') AS end_time, - session_replay_events.session_id + session_replay_events.session_id AS session_id FROM (SELECT min(session_replay_events.min_first_timestamp) AS start_time, max(session_replay_events.max_last_timestamp) AS end_time, @@ -310,35 +320,37 @@ --- # name: TestSessionsTimelineQueryRunner.test_formal_sessions_for_person ' - SELECT e.uuid, - e.timestamp, - e.event, - e.properties, - e.distinct_id, - e.elements_chain, + SELECT e.uuid AS uuid, + e.timestamp AS timestamp, + e.event AS event, + e.properties AS properties, + e.distinct_id AS distinct_id, + e.elements_chain AS elements_chain, e.session_id AS formal_session_id, first_value(e.uuid) OVER (PARTITION BY tuple(e.person_id, e.session_id_flip_index) ORDER BY toInt64(e.timestamp) ASC RANGE BETWEEN 1800 PRECEDING AND CURRENT ROW) AS informal_session_uuid, dateDiff('s', sre.start_time, sre.end_time) AS recording_duration_s FROM - (SELECT uuid, - person_id, timestamp, event, - properties, - distinct_id, - elements_chain, - session_id, - prev_session_id, - sum(if(ifNull(equals(session_id, prev_session_id), isNull(session_id) - and isNull(prev_session_id)), 0, 1)) OVER (PARTITION BY person_id - ORDER BY timestamp ASC ROWS UNBOUNDED PRECEDING) AS session_id_flip_index + (SELECT uuid AS uuid, + person_id AS person_id, + timestamp AS timestamp, + event AS event, + properties AS properties, + distinct_id AS distinct_id, + elements_chain AS elements_chain, + session_id AS session_id, + prev_session_id AS prev_session_id, + sum(if(ifNull(equals(session_id, prev_session_id), isNull(session_id) + and isNull(prev_session_id)), 0, 1)) OVER (PARTITION BY person_id + ORDER BY timestamp ASC ROWS UNBOUNDED PRECEDING) AS session_id_flip_index FROM - (SELECT events.uuid, + (SELECT events.uuid AS uuid, events__pdi.person_id AS person_id, toTimeZone(events.timestamp, 'UTC') AS timestamp, - events.event, - events.properties, - events.distinct_id, - events.elements_chain, + events.event AS event, + events.properties AS properties, + events.distinct_id AS distinct_id, + events.elements_chain AS elements_chain, events.`$session_id` AS session_id, lagInFrame(events.`$session_id`, 1) OVER (PARTITION BY person_id ORDER BY timestamp ASC) AS prev_session_id @@ -356,7 +368,7 @@ LEFT JOIN (SELECT toTimeZone(session_replay_events.start_time, 'UTC') AS start_time, toTimeZone(session_replay_events.end_time, 'UTC') AS end_time, - session_replay_events.session_id + session_replay_events.session_id AS session_id FROM (SELECT min(session_replay_events.min_first_timestamp) AS start_time, max(session_replay_events.max_last_timestamp) AS end_time, @@ -372,35 +384,37 @@ --- # name: TestSessionsTimelineQueryRunner.test_formal_sessions_global ' - SELECT e.uuid, - e.timestamp, - e.event, - e.properties, - e.distinct_id, - e.elements_chain, + SELECT e.uuid AS uuid, + e.timestamp AS timestamp, + e.event AS event, + e.properties AS properties, + e.distinct_id AS distinct_id, + e.elements_chain AS elements_chain, e.session_id AS formal_session_id, first_value(e.uuid) OVER (PARTITION BY tuple(e.person_id, e.session_id_flip_index) ORDER BY toInt64(e.timestamp) ASC RANGE BETWEEN 1800 PRECEDING AND CURRENT ROW) AS informal_session_uuid, dateDiff('s', sre.start_time, sre.end_time) AS recording_duration_s FROM - (SELECT uuid, - person_id, timestamp, event, - properties, - distinct_id, - elements_chain, - session_id, - prev_session_id, - sum(if(ifNull(equals(session_id, prev_session_id), isNull(session_id) - and isNull(prev_session_id)), 0, 1)) OVER (PARTITION BY person_id - ORDER BY timestamp ASC ROWS UNBOUNDED PRECEDING) AS session_id_flip_index + (SELECT uuid AS uuid, + person_id AS person_id, + timestamp AS timestamp, + event AS event, + properties AS properties, + distinct_id AS distinct_id, + elements_chain AS elements_chain, + session_id AS session_id, + prev_session_id AS prev_session_id, + sum(if(ifNull(equals(session_id, prev_session_id), isNull(session_id) + and isNull(prev_session_id)), 0, 1)) OVER (PARTITION BY person_id + ORDER BY timestamp ASC ROWS UNBOUNDED PRECEDING) AS session_id_flip_index FROM - (SELECT events.uuid, + (SELECT events.uuid AS uuid, events__pdi.person_id AS person_id, toTimeZone(events.timestamp, 'UTC') AS timestamp, - events.event, - events.properties, - events.distinct_id, - events.elements_chain, + events.event AS event, + events.properties AS properties, + events.distinct_id AS distinct_id, + events.elements_chain AS elements_chain, events.`$session_id` AS session_id, lagInFrame(events.`$session_id`, 1) OVER (PARTITION BY person_id ORDER BY timestamp ASC) AS prev_session_id @@ -418,7 +432,7 @@ LEFT JOIN (SELECT toTimeZone(session_replay_events.start_time, 'UTC') AS start_time, toTimeZone(session_replay_events.end_time, 'UTC') AS end_time, - session_replay_events.session_id + session_replay_events.session_id AS session_id FROM (SELECT min(session_replay_events.min_first_timestamp) AS start_time, max(session_replay_events.max_last_timestamp) AS end_time, From 27efddf0b5798519ff59e245ee0e434326c1616b Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Dec 2023 20:57:29 +0000 Subject: [PATCH 04/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 2d84d09e37ef8..8f5eea7cb8e61 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-5126-03aef09600a2') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-4292-d10abf3ac156') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 634aa69a1405f..ef27b35625975 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6a0c-628f-0000-ff51-4b4fa01e94cb')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6a18-4d2d-0000-0e71-370ef97c093a')) LIMIT 100 ' --- From 20e9f2ea6c3830ad004f491bceb20c59de5bb401 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Dec 2023 21:11:11 +0000 Subject: [PATCH 05/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 8f5eea7cb8e61..1e0d727d0cf44 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-4292-d10abf3ac156') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-c00b-b61565758e80') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index ef27b35625975..40994d64c9af4 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6a18-4d2d-0000-0e71-370ef97c093a')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6a24-de5c-0000-7694-7fe6c2b4d030')) LIMIT 100 ' --- From daa43c7682edb3744c49ed04e99bf5c1b2003dc4 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Dec 2023 21:24:20 +0000 Subject: [PATCH 06/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 1e0d727d0cf44..a62401b138e31 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-c00b-b61565758e80') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-9caa-ba77f02d43c9') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 40994d64c9af4..0fae9458951b9 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6a24-de5c-0000-7694-7fe6c2b4d030')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6a30-b36f-0000-cac6-b263205db07c')) LIMIT 100 ' --- From cf134a3cd9207e3025239b57e5467b9459b9d7f6 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Dec 2023 21:37:19 +0000 Subject: [PATCH 07/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index a62401b138e31..860e23138920d 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-9caa-ba77f02d43c9') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-4ddf-89a554662271') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 0fae9458951b9..ad8c14d162e34 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6a30-b36f-0000-cac6-b263205db07c')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6a3c-9864-0000-0012-9760d10d760f')) LIMIT 100 ' --- From b148025e371487bba3a1d1568ebf44f22f0e7538 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Dec 2023 21:49:55 +0000 Subject: [PATCH 08/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 860e23138920d..dc82854d8edff 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-4ddf-89a554662271') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-e7a7-6dfdbf0c76e8') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index ad8c14d162e34..aa763098c4b39 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6a3c-9864-0000-0012-9760d10d760f')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6a48-5684-0000-e2bb-d58e48a99a15')) LIMIT 100 ' --- From f375a1723d3420c33fdbc30f575111221aad2d67 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Dec 2023 22:03:57 +0000 Subject: [PATCH 09/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index dc82854d8edff..da0a630546ccf 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-e7a7-6dfdbf0c76e8') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-be64-f66f595c9dd8') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index aa763098c4b39..3b72f07caaaf3 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6a48-5684-0000-e2bb-d58e48a99a15')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6a55-1fb3-0000-45c7-b9f97fba0c91')) LIMIT 100 ' --- From 33f68ddfb4a9d6379e32916bcdd2a965d9732e5e Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Dec 2023 22:34:02 +0000 Subject: [PATCH 10/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index da0a630546ccf..21adb6dbcec88 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-be64-f66f595c9dd8') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-82b6-0d1b5ba41357') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 3b72f07caaaf3..26199c8621174 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6a55-1fb3-0000-45c7-b9f97fba0c91')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6a70-b6b2-0000-85c0-d3cba265de51')) LIMIT 100 ' --- From d610de9b43df02d088157b2abab1f305abb61bb4 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Dec 2023 22:47:15 +0000 Subject: [PATCH 11/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 21adb6dbcec88..b01ffc99d10b8 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-82b6-0d1b5ba41357') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-7185-a8de7ee765de') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 26199c8621174..300315256e577 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6a70-b6b2-0000-85c0-d3cba265de51')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6a7c-cb74-0000-7c5f-8da55f86b09a')) LIMIT 100 ' --- From 7307b025c3529b91ebc07f55158e3cec48b4d630 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Dec 2023 23:01:31 +0000 Subject: [PATCH 12/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index b01ffc99d10b8..e9de75e157d6f 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-7185-a8de7ee765de') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-7edb-85200962e996') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 300315256e577..557426cb7260a 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6a7c-cb74-0000-7c5f-8da55f86b09a')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6a89-f171-0000-daf9-874025e6c42e')) LIMIT 100 ' --- From 92cb1cbdc4b0fb06410e5d1b5b7ae9a79f479725 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Dec 2023 23:15:06 +0000 Subject: [PATCH 13/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index e9de75e157d6f..af16414c10aa0 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-7edb-85200962e996') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-61d3-7088f01b3abf') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 557426cb7260a..269db10a6f49f 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6a89-f171-0000-daf9-874025e6c42e')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6a96-6146-0000-935c-28f2c2d690fd')) LIMIT 100 ' --- From e4e492ce4267af36069bf43cc0c9d4b6a360a003 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Dec 2023 23:27:55 +0000 Subject: [PATCH 14/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index af16414c10aa0..b606bcee8b763 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-61d3-7088f01b3abf') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-667f-289044863f4c') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 269db10a6f49f..85c9ff4398c26 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6a96-6146-0000-935c-28f2c2d690fd')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6aa2-144c-0000-9c65-9e0770e445b3')) LIMIT 100 ' --- From 97fee9684ab8b11179416876818499ae7a0345ef Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Dec 2023 23:41:20 +0000 Subject: [PATCH 15/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index b606bcee8b763..e80ef6029f693 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-667f-289044863f4c') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-1629-f24aa91a0c4d') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 85c9ff4398c26..d8f39a169e689 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6aa2-144c-0000-9c65-9e0770e445b3')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6aae-5939-0000-be5f-2681f7b51578')) LIMIT 100 ' --- From c58fd85f53736e0e2e38c46f9c07776f97e03c65 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Dec 2023 23:53:31 +0000 Subject: [PATCH 16/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index e80ef6029f693..f5ef3f2fa05cb 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-1629-f24aa91a0c4d') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-ed3a-4b1b5545c6e3') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index d8f39a169e689..c8119f3fe7513 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6aae-5939-0000-be5f-2681f7b51578')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6ab9-9eb5-0000-e759-806ab047501e')) LIMIT 100 ' --- From be853b7439d985b423898ae1f11c8b979213e8a6 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 00:06:25 +0000 Subject: [PATCH 17/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index f5ef3f2fa05cb..ee2472a12f490 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-ed3a-4b1b5545c6e3') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-59a6-35b41a433637') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index c8119f3fe7513..b15207e03f2ce 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6ab9-9eb5-0000-e759-806ab047501e')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6ac5-5ef6-0000-4cea-f7c9b6dc570a')) LIMIT 100 ' --- From 8f00943b933371e3c721c023b191e5deeea8e77b Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 00:19:57 +0000 Subject: [PATCH 18/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index ee2472a12f490..9ce46be769541 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-59a6-35b41a433637') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-882d-7e2b2db80992') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index b15207e03f2ce..718ba26a63898 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6ac5-5ef6-0000-4cea-f7c9b6dc570a')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6ad1-6c8e-0000-7feb-9f98731eeb07')) LIMIT 100 ' --- From fcd3d25bc17bf729072de43f49be39ed38105052 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 00:32:58 +0000 Subject: [PATCH 19/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 9ce46be769541..0f2580198d3e5 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-882d-7e2b2db80992') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-980a-541d431c0e5c') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 718ba26a63898..0f5971b731ecb 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6ad1-6c8e-0000-7feb-9f98731eeb07')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6add-ac0b-0000-c1b7-64e570e687d7')) LIMIT 100 ' --- From 9a8bbca99e9acd63a43ea6bd444da1ea92a6d548 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 00:45:39 +0000 Subject: [PATCH 20/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 0f2580198d3e5..6aa29f0e44291 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-980a-541d431c0e5c') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-89b7-f02c165482e1') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 0f5971b731ecb..36a6372369a93 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6add-ac0b-0000-c1b7-64e570e687d7')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6ae9-47d1-0000-9931-d056a3177a69')) LIMIT 100 ' --- From 64b9950f9f8143a1928dd2f9a3910dda36a76cf9 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 00:59:26 +0000 Subject: [PATCH 21/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 6aa29f0e44291..273c64b304dbb 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-89b7-f02c165482e1') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-9c24-a4c0d645fe88') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 36a6372369a93..56c6f17e978d7 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6ae9-47d1-0000-9931-d056a3177a69')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6af5-d6b3-0000-6fb6-928ef920bda0')) LIMIT 100 ' --- From 9223935c49a2b9fa763f1ed61b6bd462386baa13 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 01:11:47 +0000 Subject: [PATCH 22/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 273c64b304dbb..5701c43f0925c 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-9c24-a4c0d645fe88') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-cdd6-85fed6af7490') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 56c6f17e978d7..18f8a11657b8e 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6af5-d6b3-0000-6fb6-928ef920bda0')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b01-11cd-0000-5556-c3e3c9c245ac')) LIMIT 100 ' --- From a4e3a59dc4bef053e6f79af58665b45917b3754e Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 01:24:37 +0000 Subject: [PATCH 23/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 5701c43f0925c..fffaa6d7d5d0f 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-cdd6-85fed6af7490') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-a243-06799bbeb6a4') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 18f8a11657b8e..0a27fcfd5b34e 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b01-11cd-0000-5556-c3e3c9c245ac')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b0c-f6b6-0000-657d-7b3651ff2fff')) LIMIT 100 ' --- From 13f7ac605b794f8997eb1e62c4852c72728099a3 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 01:37:45 +0000 Subject: [PATCH 24/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index fffaa6d7d5d0f..f13f1a861447d 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-a243-06799bbeb6a4') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-9241-8cae0c3e9909') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 0a27fcfd5b34e..5e460536965ce 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b0c-f6b6-0000-657d-7b3651ff2fff')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b18-dc0b-0000-473f-3fada808f421')) LIMIT 100 ' --- From b72a63be79526c425d58477bee5e98f718cc01df Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 01:50:48 +0000 Subject: [PATCH 25/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index f13f1a861447d..f077b406f740b 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-9241-8cae0c3e9909') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-1ef8-e97ed7799f49') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 5e460536965ce..74d1371a92618 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b18-dc0b-0000-473f-3fada808f421')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b24-cb85-0000-6057-9401e2acb448')) LIMIT 100 ' --- From 336b422203e03c72fe61fad15c25d4399fc701fe Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 02:04:00 +0000 Subject: [PATCH 26/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index f077b406f740b..f0e592b8e5b03 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-1ef8-e97ed7799f49') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-6cba-798fa6ce7bae') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 74d1371a92618..72cc775d98e9a 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b24-cb85-0000-6057-9401e2acb448')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b30-c31a-0000-5fec-3190936de6bf')) LIMIT 100 ' --- From ca734ee48777cdb6efa307d28d3ed954a4d52e1f Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 02:16:54 +0000 Subject: [PATCH 27/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index f0e592b8e5b03..cb15f45f693c7 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-6cba-798fa6ce7bae') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-5d67-76251af37e86') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 72cc775d98e9a..0870043d54da6 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b30-c31a-0000-5fec-3190936de6bf')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b3c-c609-0000-37b5-74d9fc2dcc59')) LIMIT 100 ' --- From 2c7d5cb3582bceeadb7dc4f65320dcbfb22ec236 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 02:30:29 +0000 Subject: [PATCH 28/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index cb15f45f693c7..bd3b281ad7950 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-5d67-76251af37e86') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-1175-6a4a3bb9fb4d') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 0870043d54da6..584e1c4083ae1 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b3c-c609-0000-37b5-74d9fc2dcc59')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b49-3fdb-0000-c5a4-28f839c247df')) LIMIT 100 ' --- From 599317d6eae0d8d569c68aebda61a281ea583c85 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 02:43:36 +0000 Subject: [PATCH 29/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index bd3b281ad7950..ff1ab42d8d305 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-1175-6a4a3bb9fb4d') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-e603-339f6cef436a') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 584e1c4083ae1..307fc3d480881 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b49-3fdb-0000-c5a4-28f839c247df')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b55-3561-0000-a919-d98dddf4a7be')) LIMIT 100 ' --- From 3e2de37f1832ca7b389bcde747170ab0217b97d3 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 02:56:33 +0000 Subject: [PATCH 30/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index ff1ab42d8d305..608a36d07cbd4 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-e603-339f6cef436a') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-05ac-fd20c57eff9c') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 307fc3d480881..a5ce733131461 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b55-3561-0000-a919-d98dddf4a7be')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b61-099e-0000-8ac7-d0c4eebb3948')) LIMIT 100 ' --- From 8da9f6af775e01262fd43ef638d0b6ed54ffcbd1 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 03:09:11 +0000 Subject: [PATCH 31/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 608a36d07cbd4..027059758c1c9 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-05ac-fd20c57eff9c') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-fbdf-c8f55ea3c915') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index a5ce733131461..b38ef30f569fd 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b61-099e-0000-8ac7-d0c4eebb3948')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b6c-ab8b-0000-e3e9-03067a015f17')) LIMIT 100 ' --- From d43df6a55c032798c4bd67b62345e81b0399f388 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 03:22:11 +0000 Subject: [PATCH 32/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 027059758c1c9..1b90828301f47 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-fbdf-c8f55ea3c915') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-ab1a-148baf32891f') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index b38ef30f569fd..b9a78e829f22a 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b6c-ab8b-0000-e3e9-03067a015f17')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b78-7432-0000-17c1-442cf9fe5f78')) LIMIT 100 ' --- From cba1976c30224865c519b5bcbd315c308522eae4 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 03:35:30 +0000 Subject: [PATCH 33/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 1b90828301f47..10c0ea20f4236 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-ab1a-148baf32891f') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-ab38-355a67b79fec') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index b9a78e829f22a..52c56d30d45fc 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b78-7432-0000-17c1-442cf9fe5f78')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b84-b227-0000-54bc-e134a60c0d8d')) LIMIT 100 ' --- From 8f7e1e93310e58345a6141eb3417124498cfc1b1 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 03:48:57 +0000 Subject: [PATCH 34/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 10c0ea20f4236..0f78208d90792 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-ab38-355a67b79fec') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-6b20-a4ed8a8f533b') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 52c56d30d45fc..2d1d219b8f0eb 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b84-b227-0000-54bc-e134a60c0d8d')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b91-183a-0000-0a76-d943f66c765f')) LIMIT 100 ' --- From 82f572629b50d8540a471ada18b7309b58a1b26e Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 04:01:23 +0000 Subject: [PATCH 35/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 0f78208d90792..99dec3ff180a1 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-6b20-a4ed8a8f533b') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-bbdc-6bb491a56f83') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 2d1d219b8f0eb..6768d122ff21a 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b91-183a-0000-0a76-d943f66c765f')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b9c-833b-0000-0afd-aed9b40bc604')) LIMIT 100 ' --- From 76370219e6d5f972fd78fb362d4dbcae1731c62f Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 04:14:38 +0000 Subject: [PATCH 36/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 99dec3ff180a1..de93646e39c28 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-bbdc-6bb491a56f83') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-3922-9f052fba7994') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 6768d122ff21a..d485492f5fe49 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6b9c-833b-0000-0afd-aed9b40bc604')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6ba8-9f42-0000-9858-13ae158455d8')) LIMIT 100 ' --- From c92ede2614ed03ffa5cedd6c4db8e606e99e1687 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 04:28:04 +0000 Subject: [PATCH 37/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index de93646e39c28..629b8a8f0f51b 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-3922-9f052fba7994') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-d741-a7b83c8f6b0d') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index d485492f5fe49..14ff7e95323c5 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6ba8-9f42-0000-9858-13ae158455d8')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6bb4-a175-0000-457c-790be496adee')) LIMIT 100 ' --- From cc7ee476e045cba88c4e3ed2db8f698333a03065 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 04:40:31 +0000 Subject: [PATCH 38/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 629b8a8f0f51b..34f31411d72eb 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-d741-a7b83c8f6b0d') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-b1ef-c1f013896241') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 14ff7e95323c5..7f9fc6f8c4305 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6bb4-a175-0000-457c-790be496adee')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6bc0-4872-0000-0ec2-f850a008fa18')) LIMIT 100 ' --- From cb63bc036eb1ef28fd5462abfc773ca3d3398292 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 04:53:26 +0000 Subject: [PATCH 39/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 34f31411d72eb..8b39ddffdc2ba 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-b1ef-c1f013896241') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-abb7-685806fcd737') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 7f9fc6f8c4305..8070483fc5d3c 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6bc0-4872-0000-0ec2-f850a008fa18')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6bcc-20ae-0000-c1ff-441d369d2dda')) LIMIT 100 ' --- From 05653f6643a50c58862d79f15d6d76ceca201955 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 05:06:20 +0000 Subject: [PATCH 40/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 8b39ddffdc2ba..22e0870a2eb0c 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-abb7-685806fcd737') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-79b4-116a3fa6341f') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 8070483fc5d3c..48134640ca664 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6bcc-20ae-0000-c1ff-441d369d2dda')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6bd7-fa3b-0000-b05e-75dbc713e63f')) LIMIT 100 ' --- From e599b385429adbadb4b2dbfcc98de1abe1a9f931 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 05:19:46 +0000 Subject: [PATCH 41/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 22e0870a2eb0c..cf9a234f36d82 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-79b4-116a3fa6341f') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-b567-0b33f89c5653') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 48134640ca664..9ea082efc55cb 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6bd7-fa3b-0000-b05e-75dbc713e63f')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6be4-1c4b-0000-d633-74043e4a9273')) LIMIT 100 ' --- From 968e1a104aa1c6f3d882787c942418b0f49fda08 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 05:32:44 +0000 Subject: [PATCH 42/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index cf9a234f36d82..c569feecbde82 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-b567-0b33f89c5653') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-b26d-ec648f72057b') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 9ea082efc55cb..f02d507e50677 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6be4-1c4b-0000-d633-74043e4a9273')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6bef-e094-0000-f7b8-36759a3f2580')) LIMIT 100 ' --- From 66256260e22500cf2ca668146df03be5ef3e8cbc Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 05:46:16 +0000 Subject: [PATCH 43/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index c569feecbde82..18705d2c49b7a 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-b26d-ec648f72057b') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-e412-c5418c20c0ff') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index f02d507e50677..f82aa0c6e2831 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6bef-e094-0000-f7b8-36759a3f2580')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6bfc-516c-0000-5f31-d7e3d62d89b6')) LIMIT 100 ' --- From 6ed8dd4c1ca762e9a7161ec92ce00828fb280a9c Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 05:58:58 +0000 Subject: [PATCH 44/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 18705d2c49b7a..26dc2288192d1 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-e412-c5418c20c0ff') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-8691-0cd8d62202d5') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index f82aa0c6e2831..4c7930355e6b0 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6bfc-516c-0000-5f31-d7e3d62d89b6')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c08-0cb6-0000-ee1f-79f749699e62')) LIMIT 100 ' --- From 0c1970023ea633ff66c514fe23395ab22ab1c75f Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 06:11:44 +0000 Subject: [PATCH 45/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 26dc2288192d1..ea357263cd314 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-8691-0cd8d62202d5') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-d4dc-2fbd0f51d387') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 4c7930355e6b0..f8049540278d1 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c08-0cb6-0000-ee1f-79f749699e62')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c13-cebb-0000-2f8c-fbeaaea22f1b')) LIMIT 100 ' --- From 08b5a3f1ffc4e324a4015dc7c87c11c676052200 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 06:25:23 +0000 Subject: [PATCH 46/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index ea357263cd314..b865f87ac7be1 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-d4dc-2fbd0f51d387') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-dfe3-bc9e507db0b8') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index f8049540278d1..e2ca48e4dca6f 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c13-cebb-0000-2f8c-fbeaaea22f1b')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c20-25c5-0000-560e-1b69dbd7af98')) LIMIT 100 ' --- From 3b87bde8fe9a22620996fb888662610759ec6254 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 06:38:23 +0000 Subject: [PATCH 47/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index b865f87ac7be1..db8a8f96fac88 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-dfe3-bc9e507db0b8') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-41dc-7d4db9de3715') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index e2ca48e4dca6f..b8b0e2a19c5ca 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c20-25c5-0000-560e-1b69dbd7af98')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c2c-31c7-0000-79e7-5e182bbe231f')) LIMIT 100 ' --- From a9aab38dee5e5836531407ef35d01a41c4a29d4c Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 06:51:01 +0000 Subject: [PATCH 48/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index db8a8f96fac88..e8922d3f97e33 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-41dc-7d4db9de3715') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-2fb6-d20e65839341') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index b8b0e2a19c5ca..39330098615d8 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c2c-31c7-0000-79e7-5e182bbe231f')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c37-ba71-0000-f2d8-a7d6acefb864')) LIMIT 100 ' --- From d14f41718b43e35ae4083f3e63ecadd492470e7e Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 07:04:00 +0000 Subject: [PATCH 49/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index e8922d3f97e33..de806483a332c 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-2fb6-d20e65839341') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-2d11-0f4c3ddfaf04') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 39330098615d8..615f011275e35 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c37-ba71-0000-f2d8-a7d6acefb864')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c43-976f-0000-c1b8-5893901a56bc')) LIMIT 100 ' --- From 560da2eff0add38701575023571727b798a38122 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 07:17:02 +0000 Subject: [PATCH 50/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index de806483a332c..421b1ce3b5595 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-2d11-0f4c3ddfaf04') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-499a-6805becc2265') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 615f011275e35..d89ceb26a472b 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c43-976f-0000-c1b8-5893901a56bc')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c4f-7abc-0000-563e-e0ee4f9c6165')) LIMIT 100 ' --- From 3fa999cdd31c1159449307637208d4be747eb6ce Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 07:29:50 +0000 Subject: [PATCH 51/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 421b1ce3b5595..b6531f50fc3bd 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-499a-6805becc2265') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-46b0-b1f44de6d248') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index d89ceb26a472b..dd6be5e4d748a 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c4f-7abc-0000-563e-e0ee4f9c6165')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c5a-f546-0000-d289-8a09262aa6ef')) LIMIT 100 ' --- From 8edc8cf1f3f703275abd86cc4e2755c11fb85576 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 07:42:43 +0000 Subject: [PATCH 52/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index b6531f50fc3bd..e0492d1d2aa68 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-46b0-b1f44de6d248') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-7d8d-821184ddca20') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index dd6be5e4d748a..cfe32568ef6b0 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c5a-f546-0000-d289-8a09262aa6ef')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c66-ee48-0000-3ad4-85a8b4d83b12')) LIMIT 100 ' --- From 9d32e09f80728812de63f7d72a71c3e1c3d4e62b Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 07:55:18 +0000 Subject: [PATCH 53/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index e0492d1d2aa68..c82bd24e40e98 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-7d8d-821184ddca20') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-8ad4-0cf056db4062') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index cfe32568ef6b0..d29673d5aa5e3 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c66-ee48-0000-3ad4-85a8b4d83b12')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c72-9a5c-0000-58cd-f59346916a94')) LIMIT 100 ' --- From e4f0e380890cc4846a42dedc286071e885b6ec24 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 08:08:51 +0000 Subject: [PATCH 54/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index c82bd24e40e98..806316786a44d 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-8ad4-0cf056db4062') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-1fe4-87d5a430e69f') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index d29673d5aa5e3..22106b9f8cd93 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c72-9a5c-0000-58cd-f59346916a94')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c7e-e8e6-0000-fb2e-a168e0648f79')) LIMIT 100 ' --- From 7e2351d920765dd9db6dc430638eb14d49c46c20 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 08:22:13 +0000 Subject: [PATCH 55/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 806316786a44d..b17828af7ed8f 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-1fe4-87d5a430e69f') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-990d-f7a283223825') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 22106b9f8cd93..d0484806ab2f3 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c7e-e8e6-0000-fb2e-a168e0648f79')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c8b-3eed-0000-5b69-33f85d5aa7b8')) LIMIT 100 ' --- From 4ab9680e9ea8755f3fde647b261448c1659d09c4 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 08:34:42 +0000 Subject: [PATCH 56/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index b17828af7ed8f..fbb3b02cc0716 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-990d-f7a283223825') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-d177-c85080efa104') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index d0484806ab2f3..2e58df50415c5 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c8b-3eed-0000-5b69-33f85d5aa7b8')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c96-b597-0000-3093-e3c2f5243077')) LIMIT 100 ' --- From e013ddea1bc897a4cca0c6c8eddd89dc64a19763 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 08:49:34 +0000 Subject: [PATCH 57/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index fbb3b02cc0716..87aa94a549f3f 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-d177-c85080efa104') + WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-efde-64d93d4f4544') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index 2e58df50415c5..e2185bb4c20c4 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6c96-b597-0000-3093-e3c2f5243077')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6ca4-34e1-0000-d14a-902570c098a4')) LIMIT 100 ' --- From 6d6962e07c7e6a800cdda5241faa579d4f4cdae7 Mon Sep 17 00:00:00 2001 From: Marius Andra Date: Fri, 15 Dec 2023 10:07:20 +0100 Subject: [PATCH 58/63] stable random --- posthog/api/test/test_query.py | 10 +++++----- posthog/hogql/functions/test/test_cohort.py | 2 +- posthog/hogql/test/test_query.py | 8 ++++---- posthog/hogql/test/utils.py | 18 ++++++------------ .../hogql/transforms/test/test_in_cohort.py | 2 +- .../test/test_lifecycle_query_runner.py | 2 +- .../test/test_hogql_query_runner.py | 2 +- .../test/test_persons_query_runner.py | 2 +- .../tasks/exports/test/test_csv_exporter.py | 4 ++-- 9 files changed, 22 insertions(+), 28 deletions(-) diff --git a/posthog/api/test/test_query.py b/posthog/api/test/test_query.py index d538e5a241cdf..d8bdb746a67b4 100644 --- a/posthog/api/test/test_query.py +++ b/posthog/api/test/test_query.py @@ -570,7 +570,7 @@ def test_full_hogql_query(self): @patch("posthog.hogql.constants.DEFAULT_RETURNED_ROWS", 10) @patch("posthog.hogql.constants.MAX_SELECT_RETURNED_ROWS", 15) def test_full_hogql_query_limit(self, MAX_SELECT_RETURNED_ROWS=15, DEFAULT_RETURNED_ROWS=10): - random_uuid = str(UUIDT()) + random_uuid = f"RANDOM_TEST_ID::{UUIDT()}" with freeze_time("2020-01-10 12:00:00"): for _ in range(20): _create_event( @@ -594,7 +594,7 @@ def test_full_hogql_query_limit(self, MAX_SELECT_RETURNED_ROWS=15, DEFAULT_RETUR @patch("posthog.hogql.constants.DEFAULT_RETURNED_ROWS", 10) @patch("posthog.hogql.constants.MAX_SELECT_RETURNED_ROWS", 15) def test_full_hogql_query_limit_exported(self, MAX_SELECT_RETURNED_ROWS=15, DEFAULT_RETURNED_ROWS=10): - random_uuid = str(UUIDT()) + random_uuid = f"RANDOM_TEST_ID::{UUIDT()}" with freeze_time("2020-01-10 12:00:00"): for _ in range(20): _create_event( @@ -619,7 +619,7 @@ def test_full_hogql_query_limit_exported(self, MAX_SELECT_RETURNED_ROWS=15, DEFA @patch("posthog.hogql.constants.DEFAULT_RETURNED_ROWS", 10) @patch("posthog.hogql.constants.MAX_SELECT_RETURNED_ROWS", 15) def test_full_events_query_limit(self, MAX_SELECT_RETURNED_ROWS=15, DEFAULT_RETURNED_ROWS=10): - random_uuid = str(UUIDT()) + random_uuid = f"RANDOM_TEST_ID::{UUIDT()}" with freeze_time("2020-01-10 12:00:00"): for _ in range(20): _create_event( @@ -645,7 +645,7 @@ def test_full_events_query_limit(self, MAX_SELECT_RETURNED_ROWS=15, DEFAULT_RETU @patch("posthog.hogql.constants.DEFAULT_RETURNED_ROWS", 10) @patch("posthog.hogql.constants.MAX_SELECT_RETURNED_ROWS", 15) def test_full_events_query_limit_exported(self, MAX_SELECT_RETURNED_ROWS=15, DEFAULT_RETURNED_ROWS=10): - random_uuid = str(UUIDT()) + random_uuid = f"RANDOM_TEST_ID::{UUIDT()}" with freeze_time("2020-01-10 12:00:00"): for _ in range(20): _create_event( @@ -764,7 +764,7 @@ def test_full_hogql_query_view(self): ) def test_full_hogql_query_values(self): - random_uuid = str(UUIDT()) + random_uuid = f"RANDOM_TEST_ID::{UUIDT()}" with freeze_time("2020-01-10 12:00:00"): for _ in range(20): _create_event( diff --git a/posthog/hogql/functions/test/test_cohort.py b/posthog/hogql/functions/test/test_cohort.py index 7ba4a19ff2815..1c5460bc9176d 100644 --- a/posthog/hogql/functions/test/test_cohort.py +++ b/posthog/hogql/functions/test/test_cohort.py @@ -25,7 +25,7 @@ class TestCohort(BaseTest): maxDiff = None def _create_random_events(self) -> str: - random_uuid = str(UUIDT()) + random_uuid = f"RANDOM_TEST_ID::{UUIDT()}" _create_person( properties={"$os": "Chrome", "random_uuid": random_uuid}, team=self.team, diff --git a/posthog/hogql/test/test_query.py b/posthog/hogql/test/test_query.py index 6f31a97ed5ea1..3c1969d3198cb 100644 --- a/posthog/hogql/test/test_query.py +++ b/posthog/hogql/test/test_query.py @@ -33,7 +33,7 @@ class TestQuery(ClickhouseTestMixin, APIBaseTest): maxDiff = None def _create_random_events(self) -> str: - random_uuid = str(UUIDT()) + random_uuid = f"RANDOM_TEST_ID::{UUIDT()}" _create_person( properties={"sneaky_mail": "tim@posthog.com", "random_uuid": random_uuid}, team=self.team, @@ -657,7 +657,7 @@ def test_null_properties(self): ) def test_window_functions_simple(self): - random_uuid = str(UUIDT()) + random_uuid = f"RANDOM_TEST_ID::{UUIDT()}" for person in range(5): distinct_id = f"person_{person}_{random_uuid}" with freeze_time("2020-01-10 00:00:00"): @@ -732,7 +732,7 @@ def test_window_functions_simple(self): self.assertEqual(response.results, expected) def test_window_functions_with_window(self): - random_uuid = str(UUIDT()) + random_uuid = f"RANDOM_TEST_ID::{UUIDT()}" for person in range(5): distinct_id = f"person_{person}_{random_uuid}" with freeze_time("2020-01-10 00:00:00"): @@ -919,7 +919,7 @@ def test_with_pivot_table_2_levels(self): def test_property_access_with_arrays(self): with freeze_time("2020-01-10"): - random_uuid = str(UUIDT()) + random_uuid = f"RANDOM_TEST_ID::{UUIDT()}" _create_person(team=self.team, distinct_ids=[f"P{random_uuid}"], is_identified=True) _create_event( distinct_id=f"P{random_uuid}", diff --git a/posthog/hogql/test/utils.py b/posthog/hogql/test/utils.py index a3f4b1882c511..c75305274679e 100644 --- a/posthog/hogql/test/utils.py +++ b/posthog/hogql/test/utils.py @@ -1,12 +1,15 @@ import dataclasses import json +import re from typing import Any from pydantic import BaseModel def pretty_print_in_tests(query: str, team_id: int) -> str: - return ( + return re.sub( + r"RANDOM_TEST_ID::[a-f0-9\-]+", + "RANDOM_TEST_ID::UUID", query.replace("SELECT", "\nSELECT") .replace("FROM", "\nFROM") .replace("WHERE", "\nWHERE") @@ -14,7 +17,7 @@ def pretty_print_in_tests(query: str, team_id: int) -> str: .replace("HAVING", "\nHAVING") .replace("LIMIT", "\nLIMIT") .replace("SETTINGS", "\nSETTINGS") - .replace(f"team_id, {team_id})", "team_id, 420)") + .replace(f"team_id, {team_id})", "team_id, 420)"), ) @@ -22,16 +25,7 @@ def pretty_print_response_in_tests(response: Any, team_id: int) -> str: clickhouse = response.clickhouse hogql = response.hogql query = "-- ClickHouse\n" + clickhouse + "\n\n-- HogQL\n" + hogql - return ( - query.replace("SELECT", "\nSELECT") - .replace("FROM", "\nFROM") - .replace("WHERE", "\nWHERE") - .replace("GROUP", "\nGROUP") - .replace("HAVING", "\nHAVING") - .replace("LIMIT", "\nLIMIT") - .replace("SETTINGS", "\nSETTINGS") - .replace(f"team_id, {team_id})", "team_id, 420)") - ) + return pretty_print_in_tests(query, team_id) def pretty_dataclasses(obj, seen=None, indent=0): diff --git a/posthog/hogql/transforms/test/test_in_cohort.py b/posthog/hogql/transforms/test/test_in_cohort.py index 879e88bcb7eca..5563ab3eda7e6 100644 --- a/posthog/hogql/transforms/test/test_in_cohort.py +++ b/posthog/hogql/transforms/test/test_in_cohort.py @@ -25,7 +25,7 @@ class TestInCohort(BaseTest): maxDiff = None def _create_random_events(self) -> str: - random_uuid = str(UUIDT()) + random_uuid = f"RANDOM_TEST_ID::{UUIDT()}" _create_person( properties={"$os": "Chrome", "random_uuid": random_uuid}, team=self.team, diff --git a/posthog/hogql_queries/insights/test/test_lifecycle_query_runner.py b/posthog/hogql_queries/insights/test/test_lifecycle_query_runner.py index d2876e418edfa..5d5bd40d153e2 100644 --- a/posthog/hogql_queries/insights/test/test_lifecycle_query_runner.py +++ b/posthog/hogql_queries/insights/test/test_lifecycle_query_runner.py @@ -39,7 +39,7 @@ class TestLifecycleQueryRunner(ClickhouseTestMixin, APIBaseTest): maxDiff = None def _create_random_events(self) -> str: - random_uuid = str(UUIDT()) + random_uuid = f"RANDOM_TEST_ID::{UUIDT()}" _create_person( properties={"sneaky_mail": "tim@posthog.com", "random_uuid": random_uuid}, team=self.team, diff --git a/posthog/hogql_queries/test/test_hogql_query_runner.py b/posthog/hogql_queries/test/test_hogql_query_runner.py index badc27efef3bf..db744d7d4fa03 100644 --- a/posthog/hogql_queries/test/test_hogql_query_runner.py +++ b/posthog/hogql_queries/test/test_hogql_query_runner.py @@ -17,7 +17,7 @@ class TestHogQLQueryRunner(ClickhouseTestMixin, APIBaseTest): random_uuid: str def _create_random_persons(self) -> str: - random_uuid = str(UUIDT()) + random_uuid = f"RANDOM_TEST_ID::{UUIDT()}" for index in range(10): _create_person( properties={ diff --git a/posthog/hogql_queries/test/test_persons_query_runner.py b/posthog/hogql_queries/test/test_persons_query_runner.py index 6163293d74f3a..9c925dceadbb3 100644 --- a/posthog/hogql_queries/test/test_persons_query_runner.py +++ b/posthog/hogql_queries/test/test_persons_query_runner.py @@ -29,7 +29,7 @@ class TestPersonsQueryRunner(ClickhouseTestMixin, APIBaseTest): random_uuid: str def _create_random_persons(self) -> str: - random_uuid = str(UUIDT()) + random_uuid = f"RANDOM_TEST_ID::{UUIDT()}" for index in range(10): _create_person( properties={ diff --git a/posthog/tasks/exports/test/test_csv_exporter.py b/posthog/tasks/exports/test/test_csv_exporter.py index 65fda3baa0dd4..3570d19440021 100644 --- a/posthog/tasks/exports/test/test_csv_exporter.py +++ b/posthog/tasks/exports/test/test_csv_exporter.py @@ -292,7 +292,7 @@ def test_raises_expected_error_when_json_is_none(self, patched_api_call) -> None @patch("posthog.hogql.constants.DEFAULT_RETURNED_ROWS", 5) @patch("posthog.models.exported_asset.UUIDT") def test_csv_exporter_hogql_query(self, mocked_uuidt, DEFAULT_RETURNED_ROWS=5, MAX_SELECT_RETURNED_ROWS=10) -> None: - random_uuid = str(UUIDT()) + random_uuid = f"RANDOM_TEST_ID::{UUIDT()}" for i in range(15): _create_event( event="$pageview", @@ -335,7 +335,7 @@ def test_csv_exporter_hogql_query(self, mocked_uuidt, DEFAULT_RETURNED_ROWS=5, M @patch("posthog.hogql.constants.MAX_SELECT_RETURNED_ROWS", 10) @patch("posthog.models.exported_asset.UUIDT") def test_csv_exporter_events_query(self, mocked_uuidt, MAX_SELECT_RETURNED_ROWS=10) -> None: - random_uuid = str(UUIDT()) + random_uuid = f"RANDOM_TEST_ID::{UUIDT()}" for i in range(15): _create_event( event="$pageview", From 1f43109d42a2c0557419e5b93a4b29f74f32379f Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 09:18:30 +0000 Subject: [PATCH 59/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 87aa94a549f3f..a54c4e16e2cc5 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -823,7 +823,7 @@ FROM ( SELECT count(*) AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0000-efde-64d93d4f4544') + WHERE equals(properties.random_uuid, 'RANDOM_TEST_ID::UUID') GROUP BY event) AS c GROUP BY count, event LIMIT 100 diff --git a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr index e2185bb4c20c4..cc92012f1806f 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_in_cohort.ambr @@ -22,7 +22,7 @@ WHERE equals(cohort_id, 1) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0)) AS in_cohort__1 ON equals(in_cohort__1.person_id, person_id) - WHERE and(equals(in_cohort__1.matched, 1), equals(event, '018c6ca4-34e1-0000-d14a-902570c098a4')) + WHERE and(equals(in_cohort__1.matched, 1), equals(event, 'RANDOM_TEST_ID::UUID')) LIMIT 100 ' --- From 196fd6dced8f1d10e4cb4d6e053467a305072371 Mon Sep 17 00:00:00 2001 From: Marius Andra Date: Mon, 18 Dec 2023 16:42:37 +0100 Subject: [PATCH 60/63] fix tests --- posthog/hogql/resolver.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/posthog/hogql/resolver.py b/posthog/hogql/resolver.py index 9d69cd9c2954d..92a9a493f335c 100644 --- a/posthog/hogql/resolver.py +++ b/posthog/hogql/resolver.py @@ -444,6 +444,7 @@ def visit_field(self, node: ast.Field): raise ResolverException(f"Unable to resolve field: {name}") # Recursively resolve the rest of the chain until we can point to the deepest node. + field_name = node.chain[-1] loop_type = type chain_to_parse = node.chain[1:] previous_types = [] @@ -484,7 +485,7 @@ def visit_field(self, node: ast.Field): if isinstance(node.type, ast.FieldType): return ast.Alias( - alias=node.type.name, + alias=field_name or node.type.name, expr=node, hidden=True, type=ast.FieldAliasType(alias=node.type.name, type=node.type), From 8a3b7f4cf423bc813da5f1f94060162871506d8e Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 18 Dec 2023 15:48:47 +0000 Subject: [PATCH 61/63] Update query snapshots --- .../test/__snapshots__/test_cohort.ambr | 14 ++++----- .../hogql/test/__snapshots__/test_query.ambr | 30 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/posthog/hogql/functions/test/__snapshots__/test_cohort.ambr b/posthog/hogql/functions/test/__snapshots__/test_cohort.ambr index d415946aa75fd..b44ac2b6f0f09 100644 --- a/posthog/hogql/functions/test/__snapshots__/test_cohort.ambr +++ b/posthog/hogql/functions/test/__snapshots__/test_cohort.ambr @@ -7,7 +7,7 @@ WHERE and(equals(events.team_id, 420), in(events.person_id, ( SELECT cohortpeople.person_id AS person_id FROM cohortpeople - WHERE and(equals(cohortpeople.team_id, 420), equals(cohortpeople.cohort_id, 1)) + WHERE and(equals(cohortpeople.team_id, 420), equals(cohortpeople.cohort_id, 6)) GROUP BY cohortpeople.person_id, cohortpeople.cohort_id, cohortpeople.version HAVING ifNull(greater(sum(cohortpeople.sign), 0), 0))), equals(events.event, %(hogql_val_0)s)) LIMIT 100 @@ -20,9 +20,9 @@ WHERE and(in(person_id, ( SELECT person_id FROM raw_cohort_people - WHERE equals(cohort_id, 1) + WHERE equals(cohort_id, 6) GROUP BY person_id, cohort_id, version - HAVING greater(sum(sign), 0))), equals(event, '018c6a03-51e8-0000-f395-a489e01f6d20')) + HAVING greater(sum(sign), 0))), equals(event, 'RANDOM_TEST_ID::UUID')) LIMIT 100 ' --- @@ -35,7 +35,7 @@ WHERE and(equals(events.team_id, 420), in(events.person_id, ( SELECT person_static_cohort.person_id AS person_id FROM person_static_cohort - WHERE and(equals(person_static_cohort.team_id, 420), equals(person_static_cohort.cohort_id, 2))))) + WHERE and(equals(person_static_cohort.team_id, 420), equals(person_static_cohort.cohort_id, 7))))) LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 @@ -46,7 +46,7 @@ WHERE in(person_id, ( SELECT person_id FROM static_cohort_people - WHERE equals(cohort_id, 2))) + WHERE equals(cohort_id, 7))) LIMIT 100 ' --- @@ -59,7 +59,7 @@ WHERE and(equals(events.team_id, 420), in(events.person_id, ( SELECT person_static_cohort.person_id AS person_id FROM person_static_cohort - WHERE and(equals(person_static_cohort.team_id, 420), equals(person_static_cohort.cohort_id, 3))))) + WHERE and(equals(person_static_cohort.team_id, 420), equals(person_static_cohort.cohort_id, 8))))) LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 @@ -70,7 +70,7 @@ WHERE in(person_id, ( SELECT person_id FROM static_cohort_people - WHERE equals(cohort_id, 3))) + WHERE equals(cohort_id, 8))) LIMIT 100 ' --- diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index a54c4e16e2cc5..9aef7c29941cd 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -40,7 +40,7 @@ SELECT event, distinct_id FROM events - WHERE and(equals(distinct_id, '016f8cc0-2400-0000-b4fa-0b49fb31d6d3'), equals(properties.index, '4')) + WHERE and(equals(distinct_id, 'RANDOM_TEST_ID::UUID'), equals(properties.index, '4')) LIMIT 100 ' --- @@ -49,7 +49,7 @@ SELECT event, distinct_id FROM events - WHERE and(equals(distinct_id, '016f8cc0-2400-0000-b4fa-0b49fb31d6d3'), equals(properties.index, '4')) + WHERE and(equals(distinct_id, 'RANDOM_TEST_ID::UUID'), equals(properties.index, '4')) LIMIT 100 ' --- @@ -67,7 +67,7 @@ SELECT event, distinct_id FROM events - WHERE and(equals(distinct_id, '016f8cc0-2400-0000-b4fa-0b49fb31d6d3'), and(equals(properties.index, '4'), less(timestamp, toDateTime('2020-01-02 00:00:00.000000')), greaterOrEquals(timestamp, toDateTime('2020-01-01 00:00:00.000000')))) + WHERE and(equals(distinct_id, 'RANDOM_TEST_ID::UUID'), and(equals(properties.index, '4'), less(timestamp, toDateTime('2020-01-02 00:00:00.000000')), greaterOrEquals(timestamp, toDateTime('2020-01-01 00:00:00.000000')))) LIMIT 100 ' --- @@ -76,7 +76,7 @@ SELECT event, distinct_id FROM events - WHERE and(equals(distinct_id, '016f8cc0-2400-0000-b4fa-0b49fb31d6d3'), and(equals(properties.index, '4'), less(timestamp, toDateTime('2020-01-02 00:00:00.000000')), greaterOrEquals(timestamp, toDateTime('2020-01-01 00:00:00.000000')))) + WHERE and(equals(distinct_id, 'RANDOM_TEST_ID::UUID'), and(equals(properties.index, '4'), less(timestamp, toDateTime('2020-01-02 00:00:00.000000')), greaterOrEquals(timestamp, toDateTime('2020-01-01 00:00:00.000000')))) LIMIT 100 ' --- @@ -94,7 +94,7 @@ SELECT event, distinct_id FROM events AS e - WHERE equals(properties.random_uuid, '016f8cc0-2400-0001-c0f1-69ca93151ff2') + WHERE equals(properties.random_uuid, 'RANDOM_TEST_ID::UUID') LIMIT 100 ' --- @@ -244,7 +244,7 @@ WHERE and(equals(events.team_id, 420), ifNull(in(events__pdi.person_id, ( SELECT cohortpeople.person_id AS person_id FROM cohortpeople - WHERE and(equals(cohortpeople.team_id, 420), equals(cohortpeople.cohort_id, 8)) + WHERE and(equals(cohortpeople.team_id, 420), equals(cohortpeople.cohort_id, 13)) GROUP BY cohortpeople.person_id, cohortpeople.cohort_id, cohortpeople.version HAVING ifNull(greater(sum(cohortpeople.sign), 0), 0))), 0)) GROUP BY events.event @@ -258,7 +258,7 @@ WHERE in(person_id, ( SELECT person_id FROM raw_cohort_people - WHERE equals(cohort_id, 8) + WHERE equals(cohort_id, 13) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0))) GROUP BY event @@ -274,7 +274,7 @@ WHERE and(equals(events.team_id, 420), in(events.person_id, ( SELECT cohortpeople.person_id AS person_id FROM cohortpeople - WHERE and(equals(cohortpeople.team_id, 420), equals(cohortpeople.cohort_id, 8)) + WHERE and(equals(cohortpeople.team_id, 420), equals(cohortpeople.cohort_id, 13)) GROUP BY cohortpeople.person_id, cohortpeople.cohort_id, cohortpeople.version HAVING ifNull(greater(sum(cohortpeople.sign), 0), 0)))) GROUP BY events.event @@ -288,7 +288,7 @@ WHERE in(person_id, ( SELECT person_id FROM raw_cohort_people - WHERE equals(cohort_id, 8) + WHERE equals(cohort_id, 13) GROUP BY person_id, cohort_id, version HAVING greater(sum(sign), 0))) GROUP BY event @@ -309,7 +309,7 @@ WHERE and(equals(events.team_id, 420), ifNull(in(events__pdi.person_id, ( SELECT person_static_cohort.person_id AS person_id FROM person_static_cohort - WHERE and(equals(person_static_cohort.team_id, 420), equals(person_static_cohort.cohort_id, 9)))), 0)) + WHERE and(equals(person_static_cohort.team_id, 420), equals(person_static_cohort.cohort_id, 14)))), 0)) GROUP BY events.event LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 @@ -321,7 +321,7 @@ WHERE in(person_id, ( SELECT person_id FROM static_cohort_people - WHERE equals(cohort_id, 9))) + WHERE equals(cohort_id, 14))) GROUP BY event LIMIT 100 ' @@ -335,7 +335,7 @@ WHERE and(equals(events.team_id, 420), in(events.person_id, ( SELECT person_static_cohort.person_id AS person_id FROM person_static_cohort - WHERE and(equals(person_static_cohort.team_id, 420), equals(person_static_cohort.cohort_id, 9))))) + WHERE and(equals(person_static_cohort.team_id, 420), equals(person_static_cohort.cohort_id, 14))))) GROUP BY events.event LIMIT 100 SETTINGS readonly=2, max_execution_time=60, allow_experimental_object_type=1 @@ -347,7 +347,7 @@ WHERE in(person_id, ( SELECT person_id FROM static_cohort_people - WHERE equals(cohort_id, 9))) + WHERE equals(cohort_id, 14))) GROUP BY event LIMIT 100 ' @@ -367,7 +367,7 @@ SELECT count(), event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0004-f14f-e1c1436db92b') + WHERE equals(properties.random_uuid, 'RANDOM_TEST_ID::UUID') GROUP BY event LIMIT 100 ' @@ -395,7 +395,7 @@ SELECT DISTINCT properties.sneaky_mail FROM persons - WHERE equals(properties.random_uuid, '016f8cc0-2400-0005-143b-3097b528d6b2') + WHERE equals(properties.random_uuid, 'RANDOM_TEST_ID::UUID') LIMIT 100 ' --- From 3a5074592d0e80945418b52aa885bcfaa426ff35 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 18 Dec 2023 15:53:04 +0000 Subject: [PATCH 62/63] Update query snapshots --- posthog/hogql/test/__snapshots__/test_query.ambr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/posthog/hogql/test/__snapshots__/test_query.ambr b/posthog/hogql/test/__snapshots__/test_query.ambr index 9aef7c29941cd..44499a927d566 100644 --- a/posthog/hogql/test/__snapshots__/test_query.ambr +++ b/posthog/hogql/test/__snapshots__/test_query.ambr @@ -797,7 +797,7 @@ FROM ( SELECT count() AS count, event FROM events - WHERE equals(properties.random_uuid, '016f8cc0-2400-0016-8a52-c803389c2009') + WHERE equals(properties.random_uuid, 'RANDOM_TEST_ID::UUID') GROUP BY event) GROUP BY count, event LIMIT 100 From 8ba8aac15b99fcfb2364c572e89db8442ed5e8db Mon Sep 17 00:00:00 2001 From: Marius Andra Date: Mon, 18 Dec 2023 17:26:09 +0100 Subject: [PATCH 63/63] fix test --- posthog/warehouse/api/test/test_view_link.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/warehouse/api/test/test_view_link.py b/posthog/warehouse/api/test/test_view_link.py index d7a265d9c159e..ba01536ded421 100644 --- a/posthog/warehouse/api/test/test_view_link.py +++ b/posthog/warehouse/api/test/test_view_link.py @@ -216,8 +216,8 @@ def test_view_link_nested_multiple_joins(self): self.assertEqual( query_response["types"], [ - ("events__event_view.fake", "String"), - ("events__person_view.p_distinct_id", "String"), + ("fake", "String"), + ("p_distinct_id", "String"), ], )