:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(product-analytics): remove funnel correlation (#116241)
Sam Pennington5893271ac807
diff --git a/bin/patch-schema-property-filter-discriminator.py b/bin/patch-schema-property-filter-discriminator.pyindex d8b8877b0e71..a6c9092e583b 100644--- a/bin/patch-schema-property-filter-discriminator.py+++ b/bin/patch-schema-property-filter-discriminator.py@@ -73,7 +73,7 @@ EXPECTED_SITE_COUNTS = {# recursive site, discriminated including the group via its AND/OR -> property_group tag."recursive": 1,# Plain inlined runs: list[<members>], optionally `| PropertyGroupFilter` / `| None`.- "plain": 61,+ "plain": 60,}diff --git a/common/storybook/storybook-timings.json b/common/storybook/storybook-timings.jsonindex f193e32e9e47..cf9a8559c123 100644--- a/common/storybook/storybook-timings.json+++ b/common/storybook/storybook-timings.json@@ -2751,14 +2751,6 @@"chromium": 27.061,"webkit": 6.377},- "products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelCorrelationTable.stories.tsx": {- "chromium": 6.059,- "webkit": 4.473- },- "products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelPropertyCorrelationTable.stories.tsx": {- "chromium": 8.23,- "webkit": 3.174- },"products/product_analytics/frontend/insights/funnels/FunnelFlowGraph/BuilderPathFlowNode.stories.tsx": {"chromium": 15.124,"webkit": 4.272diff --git a/ee/api/test/test_team.py b/ee/api/test/test_team.pyindex 26f304b045f2..e8f3b4351283 100644--- a/ee/api/test/test_team.py+++ b/ee/api/test/test_team.py@@ -106,23 +106,6 @@ def team_enterprise_api_test_factory():# Updating projects- def test_can_update_and_retrieve_person_property_names_excluded_from_correlation(self):- response = self.client.patch(- f"/api/environments/@current/",- {"correlation_config": {"excluded_person_property_names": ["$os"]}},- )- self.assertEqual(response.status_code, HTTP_200_OK)-- response = self.client.get(f"/api/environments/@current/")- self.assertEqual(response.status_code, HTTP_200_OK)-- response_data = response.json()-- self.assertLessEqual(- {"correlation_config": {"excluded_person_property_names": ["$os"]}}.items(),- response_data.items(),- )-# Fetching projectsdef test_fetch_team_as_org_admin_works(self):diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex f14335700bb0..7d6d5b57192c 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -2581,9 +2581,9 @@ snapshots:components-search--product-recents-and-starred--light:hash: v1.k794b7964.45213063c3c767175033b9c3ff72d94df2e3ffc9ffe46398bc78c45c3708f1b5.X_mXo_erMw09YXsaZY6-sc_9vQx8VtriGVHZgr_wJmwcomponents-search--searching--dark:- hash: v1.k794b7964.5483066671adf22da234092542ca8a1acf05fecb743ec9b237b9bf55358a1950.1OYejLrDWfNRqxxeRFEKa1MUNLNUkrx2LWUhekfRgkM+ hash: v1.k794b7964.e742f08c8f9d2ee625d414ec4fa1cf038d100a007190d9bf4f707ee010722bfd.wNoXWg4bUWL25dByyR24MsRkpXXoLuLY5w_gly8Z8AEcomponents-search--searching--light:- hash: v1.k794b7964.635fc573ea55fe12c73a5e669cbb64ce9b270356a2bfe4570644244e7865d279.KcjC65VFm_htl9QXt-QH82S5yN6XjnbeACnFVX_62Es+ hash: v1.k794b7964.327d9f64de83990e691ef8ff66f572c48faeca76e62a219293737bd6974a8ca7.-o1bBvfYQCaNIM1OwTiGg3p6fMPMFQVlth8BoG405jYcomponents-sentencelist--full-sentence--dark:hash: v1.k794b7964.7e8e5dd2e09d246cc3668f362f2391fe67618bd1143aa393832297f5dc30e558.yptEWKc5RAUY613Fwd5cQ0VIinMvpdoI6cuKgagAGxkcomponents-sentencelist--full-sentence--light:@@ -3840,10 +3840,6 @@ snapshots:hash: v1.k794b7964.bddaed6cbd123822a4c58b1ccb09ab84a616c6ae95f8d03a971fe34808fc7400.iavoXJZizrkBQDJ9VHAlrjhDxDVinaWWfPGajiePMCAinsights-funnelbarhorizontalchart--funnel-top-to-bottom-compare--light:hash: v1.k794b7964.81a3bd20e5e694a30e8137edf405d2ddd54c5848e6074e16ab7a3145de78d4ec.hixqKFoxTq6GIJ6BG8s4mH2y5snHdwonZZhuXEdmpG4- insights-funnelcorrelationtable--default--dark:- hash: v1.k794b7964.e5ea854681eea2dad0c60c95110ca67213681860da4e37264c96cc51ca37bee8.4xfWkpVdsd6WhY7yrKVo8yuQ5KosLRzm3IkzMgfGMmI- insights-funnelcorrelationtable--default--light:- hash: v1.k794b7964.c51708247c46288ad4a5438efe76ed845502212f0a4c499952a9a2faf630e636.XNGUh-Gb2-2epg7hlB6dn3dt2E-Jjv6Wr5-6gWuFDPIinsights-funnelhistogramchart--compare--dark:hash: v1.k794b7964.6b06e99186cad49caa5061ac7a3866b2966fc6d3c645955f71a9458c133eefc3.uKly0ggZQE62Nz-mbkKQzpeeoh1PDPqNoWB4Z-7E9Lsinsights-funnelhistogramchart--compare--light:@@ -3880,10 +3876,6 @@ snapshots:hash: v1.k794b7964.77db5fd39abf5b41db372ff16af2044f3c03b303aabe0d592f6c25de1898339a.3VJBqA15CtN76iDMdubH40FmnriyLRFCW_mGRXdYrsMinsights-funnellinechart--with-legend--light:hash: v1.k794b7964.d3d505f78dc4785055c98a602b0edd9c39549001dab1a3f1c3bf753f1cff60be.Lu6z04Zq2foZ5axwQK8Hg4ys33BYX2OIMjQkpYBycKM- insights-funnelpropertycorrelationtable--default--dark:- hash: v1.k794b7964.78fb6437968de10ad57843fbf5878102a73d60befd9fb4cad75d798df9890019.sRau17NRwFfT6JEJzu_sn1c8TkoQ8eyg_BsqpejRrwk- insights-funnelpropertycorrelationtable--default--light:- hash: v1.k794b7964.d92e6f81c63dc330f512b926f058c176125ac0413296275f5a3f416ae2fab10d.WgPOHv1rLmkFI1GCi8XasA5UoHRyk-wIzuiTFfgHX4Iinsights-funnelstepsbarchart--bar-labels--dark:hash: v1.k794b7964.5de2ee4fdd7ba021e1af1363b1e7977b10a245ce3ae6486008b83552cc41296d.tMGnyCUxbncHrGz42VrPrOAdXqsv6oqpZP2N6hjMW48insights-funnelstepsbarchart--bar-labels--light:@@ -3913,25 +3905,25 @@ snapshots:insights-funnelstepsbarchart--default--light:hash: v1.k794b7964.8a0522ec815ea8cc16cf80d267e59d19f1e252cb224046f990aac1813ede5471.OoVj4JjpY5y8uKoARS5NKsrL35_8Isiaz368TQrdH88insights-funnelstepsbarchart--edit-scene--dark:- hash: v1.k794b7964.daff0c52a654eec8038f0055e3ec5bb5e8b711cf29e959525046ac8bf7e0bbd4.zlw3hzw2GggUx4Tsxi9Q0yhcVLNKQXrQaplqR6aqHUQ+ hash: v1.k794b7964.7a808ef6465b805e0b3d60b9a3c42a9c564d58db9dd810fa6b22b65a1109c9cd.55RXNeqQzrRDEFDfZf6Qgf3Jy_7z1lQcDOXdT5nM7VYinsights-funnelstepsbarchart--edit-scene--light:- hash: v1.k794b7964.f1fe4fe0489eae529f52f1b529ade69417e36dc805969661a3395310a9230bdb.v88qRlvvjunu-s9gr5I61Q6pwyST3q9-A1O_zXPvLsQ+ hash: v1.k794b7964.944c542e36c004a661a16fb182d29822efd68050bca1a6ba3476de9ea2e9330f.7siA4PBt54AuV-AhfV-jFM7Ek_oSpv6AaIvbaF8wEr4insights-funnelstepsbarchart--edit-scene-viewports--medium--dark:- hash: v1.k794b7964.2639fae81892c7aece4c588caa0baed328f28f431f1658f343bf0f5102bc0556.csO06mCsCMFu6q6_9CQrIiy8JMCS4P1pxFdDFZ7dlrE+ hash: v1.k794b7964.0f3f42b9162817e6584c3073bdbc42054a4f12a78b576d60d03dd34c1565b0d4.5rsWaIpEA5z8PtTRn7A6A9RaUouNgij5y9-nNG-gtLwinsights-funnelstepsbarchart--edit-scene-viewports--medium--light:- hash: v1.k794b7964.3d2f0878d120b3ba06e2666921a4d2c7f555b3610897082faf398b3d7bd41482.MBptraH3oySrfcz_VT0gjc6CTzlzC88vL-t0USwoy5I+ hash: v1.k794b7964.f0dd5bc79f26b8d58bcb2bb3908db17048f49f22ef6e5fe8261a65a0297757f6.ZGr7l_lzhXvDbwIXbaa9-8RmLIDeGgyaUjuFclE2IIQinsights-funnelstepsbarchart--edit-scene-viewports--superwide--dark:- hash: v1.k794b7964.4a98d174dad5ab50c96b6774d2cfbae541e6f2a422e4578636c51ca17a4fbee9.1V9kxK2By0_G3mhdfs02P5YyuAgbNNGNcGqYIM2XB8Y+ hash: v1.k794b7964.7b0b6d35173a9ba24003f86ca529a8eca60668a4afa76b115d773faefc45c74d.ketbuWMrAkdk5J529QPwPiuKRo3KtCieBIm_wMvYi1Minsights-funnelstepsbarchart--edit-scene-viewports--superwide--light:- hash: v1.k794b7964.ffb14ea0ee0246d50eb68db25b11113593caeb2b5eead99919d85942dc9438ec.Uyj0vuocd9oQdTVQArMRGnCp-Eri6MQ3vi8Z8pPqYCI+ hash: v1.k794b7964.d149e93eea28903df05aa3c6e0d8a5bc19f06529b27780eb93a3c1f96c57e8ce.a7L85prxcatYb6IuMhfX9wgzSU2vogW6I6xCt7JH4nwinsights-funnelstepsbarchart--edit-scene-viewports--wide--dark:- hash: v1.k794b7964.daff0c52a654eec8038f0055e3ec5bb5e8b711cf29e959525046ac8bf7e0bbd4.mBpgjUpcZQUVkEQZk0Za1t_L5O3cPp29GdgIjaJYk7U+ hash: v1.k794b7964.7a808ef6465b805e0b3d60b9a3c42a9c564d58db9dd810fa6b22b65a1109c9cd.Wu7bXuAuqgNT6sxiZ2JOfJ5cNPDOdgsEWH8n_jntIcAinsights-funnelstepsbarchart--edit-scene-viewports--wide--light:- hash: v1.k794b7964.f1fe4fe0489eae529f52f1b529ade69417e36dc805969661a3395310a9230bdb.3VX77dp5R_vLBzgiXIUB58EqMoYOFsCOV02lqX-vyR8+ hash: v1.k794b7964.944c542e36c004a661a16fb182d29822efd68050bca1a6ba3476de9ea2e9330f.ovOYU-ey09DfEXCbU3kUYN469O5NRbsGHIf7Z__qFrkinsights-funnelstepsbarchart--edit-scene-with-inline-events--dark:- hash: v1.k794b7964.159e6a21bd67e5a7c7aa6e57731926b6b6f8e0677cbe6ba43df85f0eedd8e70f.psK5ocliwya-xjGAE0AFdMMhk1Nc7WRqmZ_fMo6KnZA+ hash: v1.k794b7964.2be8a4664b003638e0cebb9289412a8f6407c8d6cea8c88f50e8c7b164ef214d.o20jpTyQ8Vk7kUSSKon4exHjEldB4mW3blQt4YwsRdAinsights-funnelstepsbarchart--edit-scene-with-inline-events--light:- hash: v1.k794b7964.e77a98a469ca366c0bd54dd74ebaa93c2445ff3318a4d1a4586930d6deb97b26.cxpxUwbPla-ItwYQoMr3UIrpoyRhS92QxQ212Wazqpw+ hash: v1.k794b7964.fb44bae35519b5972ccc7fda97e803dd0f617d31877f6474bdf345b0249babd0.IeucwBZomVxB6_0114pIyap889C-8toZSXeA_D8seiEinsights-funneltimetoconverttable--default--dark:hash: v1.k794b7964.39fad6f5fd14cdf0e6d9e538cdc8eea2d6b0dbfc9f215c6226ae1b014b8b0c61.FEIbcPsm2lRRriC_2UPs1yryWU9SP5QiilC5IxwanY4insights-funneltimetoconverttable--default--light:@@ -9803,17 +9795,17 @@ snapshots:scenes-app-customer-analytics-journeys--empty-state--light:hash: v1.k794b7964.29f7134b12cd47b7afed6449964b733dadb83fbcd284b7bc8c69c604ba87b859.xq9cohgKAf9Yb4OezSDhJf9cVvmJp2ngZONesZZMX4Yscenes-app-customer-analytics-journeys--journey-with-empty-steps--dark:- hash: v1.k794b7964.06bc8a2300aca3b2b4d3a63b2f947279dc3fd4f219e0fad0db54aa59dc082c57.haNCY-Ju4GdaG9vShs9VU450zmMagXcKEqSHR6__Vb0+ hash: v1.k794b7964.b6a71bcea083ab7180ad71c5a15d5a7541b44bec12c270212f78fadf6fd2affc.kro91ueru-oSkJbKFLm0tmvQjLNI4ZVfLuhyPD1Blewscenes-app-customer-analytics-journeys--journey-with-empty-steps--light:- hash: v1.k794b7964.7572a119d15379607696d9b392bff53290ebd65774ffa6dc8a8e0d1ef4f98337.ppjhuvwfx28SXUKIOOYC7CELO_YZYc55gF6YGOlP5qI+ hash: v1.k794b7964.fc6119dcba04dbc76094f859ba7f9a1a4dae2cfdf905ce5af2f3536f0ce29557.5VsVQ0F3-GGcJI-4eikMfKDtIq5kI7N8mnXVF4eyhFMscenes-app-customer-analytics-journeys--journey-with-optional-steps--dark:- hash: v1.k794b7964.672932b2bdc2f069f2a553a6f17629d2ba3d550cd20fb7c45a3683f6eb7122cf.B4kwJ4_h80nIk3qwO4DImqzL5OvlVaDtO_UoXx1VjqM+ hash: v1.k794b7964.520ac5f62267d9a4e218b5f7fdc208d89167825ff7ace378eef9ef1a5db1dc9f.mYOGAnEm9TbphPmB6IFgyR4xVEpk4ljtKHLnCwTaWT0scenes-app-customer-analytics-journeys--journey-with-optional-steps--light:- hash: v1.k794b7964.f72959dfac5d798a02a9586ea41828f5eb9da92a6e866e52f19162252e5a5261.yxdTeu05Zm6BhnAf6y2NTIMLdKfCeplKfkorVMkTtt8+ hash: v1.k794b7964.4813e2685433bd489295ea5ca20d56b1cd406cb75fab5beb36535b4f1e74fae1.q6NF4fOVgibVJuaz8pWE9MWb_X3kqMmzx8F3OrTqKkkscenes-app-customer-analytics-journeys--journey-with-required-steps--dark:- hash: v1.k794b7964.72e5b1ab054ba3745c835a5b4d8b623c7e514e85f03b57fc1c800dbeac9d56f9.oelpzMqS4nBMi1RtHBNXFPgDNie5tvLQslOE8Jr5Jp4+ hash: v1.k794b7964.ad543b012ca4d3f5f7bcbeed1f83825b43816a30efdad8220825921462e10727.uQF13A5HJ--QvfT-_F8E5TdCYB2lHZ6CO2iRyjZ-UiYscenes-app-customer-analytics-journeys--journey-with-required-steps--light:- hash: v1.k794b7964.718c844b133d4d4f6d51dcfde199c6d7eac9688d1abb84a40237bb3aeb08090e.-zLSF9beQysKrGiGGcw8jsWbwSTtc5ihFwHU3ZNN7c4+ hash: v1.k794b7964.086e0d76ebffd897fb1ad1055fc66bd4186fa0a5bd246d5b632c8847b85d1b82.dScwUz9mktkFv1P2ZyoMcOZec7QwQeIH5XyRS5Pq4QYscenes-app-customer-analytics-journeys-nodes-builderpathflownode--all-variants--dark:hash: v1.k794b7964.854e4fb59460c8b35b52e85c8b279a27284a16b25e62fb52bf54c341a2d86f73.KeHBhNrGD2fpGRLwwIFn_KQ4tfNQTXtUn48g5PZh5rkscenes-app-customer-analytics-journeys-nodes-builderpathflownode--all-variants--light:@@ -14631,9 +14623,9 @@ snapshots:scenes-app-settings-environment--settings-environment-privacy--light:hash: v1.k794b7964.35ddb00627027f0fa538a44c6a0ac391262271b58c2aa1051a5fb075cb5d153b.TRooZhqb2WOAGMoPdBfB45S5SPrqyA-V7KMP96hGa64scenes-app-settings-environment--settings-environment-product-analytics--dark:- hash: v1.k794b7964.39c70ed4753655a76c632e011b3b992cb76a06a13bf1b3a656c218623807b221.oRM2ws1eyvR7_9Gvfl1JuSzSs7Sqk_GklvxJnaqP1kg+ hash: v1.k794b7964.475775fb928503a39e11f96e46a3159f361b26eb99d224d75bfbcf43aeada0e4.yH2qIhCdxHQyzmXz7PpQfVOqlrehSgohNe5u9BSSnbgscenes-app-settings-environment--settings-environment-product-analytics--light:- hash: v1.k794b7964.49605dd74a0ae5dbe8996ff0c4718bf9c27841157f4c81c436fe5d5be78d3670.TwhLOMB6MSW2zUV_Ak58CYNbmqGD23d83UApWx3CeYY+ hash: v1.k794b7964.dd07ab91a688091e7e5d6e220333985666c22685aeb699993ba1dcf77e02b550.3L1R_lE5gIqwQE_wT3oUEaybpxehFmeBFjRTdPu85EEscenes-app-settings-environment--settings-environment-replay--dark:hash: v1.k794b7964.46e71f8f768b229cb464190c47f3eb987022aaf0447d61d6a1e9ad4bf6b7a7b2.Ifq331Ron9UQtA1vswfhvyAOxN6kJjZeecwfsD9V4qUscenes-app-settings-environment--settings-environment-replay--light:@@ -14763,9 +14755,9 @@ snapshots:scenes-app-settings-project--settings-project-logs-read-only--light:hash: v1.k794b7964.004d43869df2ea4011396c99627970f338d93c5440674188998206cac054ea0a.CE-joAyp1BJzj_YryB2P_JM5sbBwPy11-CG5uvYafEAscenes-app-settings-project--settings-project-product-analytics--dark:- hash: v1.k794b7964.574649b42cf4051e80fd8878bd1fc188cb9b7237b4a8e13d66e9e41ede6b676b.jCD55MfmjMdEz6WY2Z9ai0bDEtg42mSLR8FCqe8aSWE+ hash: v1.k794b7964.d9d0888da7413fe42e1a23f872f614ab6c16f3e23b78c2cca1e4a1a2683fa5fd.IizzLyZ3SllPpT4wF0BiyWsjglx9U8JUN3vDLoXBiTsscenes-app-settings-project--settings-project-product-analytics--light:- hash: v1.k794b7964.cc088cf0511d40a383698159146f7d4e8134ba4b8ddcc2a4b5e4e8156b5fa90c.iIcm66cQezu869oJkiMevektDxtivGFeQ8tY6jmaquA+ hash: v1.k794b7964.44400b29a255b8243b0c521cef271faf9cb85381a00dab4ea5fd002b8a959c82.gnoevFVb9fGADjL7vwfocOmC4yz_bc1Rc7Vzd17_5ucscenes-app-settings-project--settings-project-replay--dark:hash: v1.k794b7964.46e71f8f768b229cb464190c47f3eb987022aaf0447d61d6a1e9ad4bf6b7a7b2.3slvFilCrdixoTarNjtZSKA4mZE-NJbNMX7YRs1rGOEscenes-app-settings-project--settings-project-replay--light:diff --git a/frontend/src/generated/core/api.schemas.ts b/frontend/src/generated/core/api.schemas.tsindex 96e660b455f7..491cacfd1ed1 100644--- a/frontend/src/generated/core/api.schemas.ts+++ b/frontend/src/generated/core/api.schemas.ts@@ -2466,7 +2466,6 @@ export interface ProjectCreateRequestApi {* @items.maxLength 400*/person_display_name_properties?: string[] | null- correlation_config?: unknown/*** Disables posthog-js autocapture (clicks, page views) when true.* @nullable@@ -3463,7 +3462,6 @@ export interface ProjectBackwardCompatApi {* @items.maxLength 400*/person_display_name_properties?: string[] | null- correlation_config?: unknown/*** Disables posthog-js autocapture (clicks, page views) when true.* @nullable@@ -4352,7 +4350,6 @@ export interface PatchedProjectBackwardCompatApi {* @items.maxLength 400*/person_display_name_properties?: string[] | null- correlation_config?: unknown/*** Disables posthog-js autocapture (clicks, page views) when true.* @nullablediff --git a/frontend/src/lib/api.mock.ts b/frontend/src/lib/api.mock.tsindex dcce3fbb0ee3..45bb8abc21af 100644--- a/frontend/src/lib/api.mock.ts+++ b/frontend/src/lib/api.mock.ts@@ -73,11 +73,6 @@ export const MOCK_DEFAULT_TEAM: TeamType = {timezone: 'UTC',data_attributes: ['data-attr'],person_display_name_properties: ['email', 'name', 'username'],- correlation_config: {- excluded_event_names: ['$autocapture', '$capture_metrics', '$feature_flag_called', '$groupidentify'],- excluded_event_property_names: ['$plugins_deferred', '$geoip_time_zone'],- excluded_person_property_names: ['$browser_version'],- },autocapture_opt_out: true,session_recording_opt_in: true,session_recording_sample_rate: '1.0',diff --git a/frontend/src/lib/utils/eventUsageLogic.ts b/frontend/src/lib/utils/eventUsageLogic.tsindex 8c0234a36b64..28953c10efd7 100644--- a/frontend/src/lib/utils/eventUsageLogic.ts+++ b/frontend/src/lib/utils/eventUsageLogic.ts@@ -63,7 +63,6 @@ import {ExperimentHoldoutType,ExperimentIdType,ExperimentStatsMethod,- FunnelCorrelation,ProductTour,PropertyFilterType,InsightModel,@@ -74,7 +73,7 @@ import { captureBIWorksheetAction } from 'products/business_intelligence/frontenimport { getExperimentStatus } from 'products/experiments/frontend/experimentStatus'import type { ExperimentMetricUnion } from '../../queries/schema/schema-general'-import type { FunnelCorrelationResultsType, Realm, UserType } from '../../types'+import type { Realm, UserType } from '../../types'export enum DashboardEventSource {LongPress = 'long_press',@@ -835,24 +834,6 @@ export interface eventUsageLogicActions {reportBounceRatePageViewModeUpdated: (mode: string) => {mode: string}- reportCorrelationInteraction: (- correlationType: FunnelCorrelation['result_type'],- action: string,- props?: Record<string, any>- ) => {- action: string- correlationType: FunnelCorrelationResultsType- props: Record<string, any> | undefined- }- reportCorrelationViewed: (- query: Node | null,- delay?: number,- propertiesTable?: boolean- ) => {- delay: number | undefined- propertiesTable: boolean | undefined- query: Node<Record<string, any>> | null- }reportCreatedDashboardFromModal: () => {value: true}@@ -1722,17 +1703,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([excludedDaysOfWeekCount: number) => ({ queryKind, excludeIncompletePeriods, excludedDaysOfWeekCount }),reportInsightDatePickerOpened: (queryKind: string | undefined) => ({ queryKind }),- // insight funnel correlation- reportCorrelationViewed: (query: Node | null, delay?: number, propertiesTable?: boolean) => ({- query,- delay, // Number of delayed seconds to report event (useful to measure insights where users don't navigate immediately away)- propertiesTable,- }),- reportCorrelationInteraction: (- correlationType: FunnelCorrelation['result_type'],- action: string,- props?: Record<string, any>- ) => ({ correlationType, action, props }),reportProjectCreationSubmitted: (projectCount: number, nameLength: number) => ({ projectCount, nameLength }),reportProjectNoticeDismissed: (key: string) => ({ key }),reportProjectNoticeShown: (variant: string) => ({ variant }),@@ -2370,20 +2340,6 @@ export const eventUsageLogic = kea<eventUsageLogicType>([...(presetKey ? { preset_key: presetKey } : {}),})},- reportCorrelationInteraction: ({ correlationType, action, props }) => {- posthog.capture('correlation interaction', { correlation_type: correlationType, action, ...props })- },- reportCorrelationViewed: ({ delay, query, propertiesTable }) => {- const payload = sanitizeQuery(query)- if (delay === 0) {- posthog.capture(`correlation${propertiesTable ? ' properties' : ''} viewed`, payload)- } else {- posthog.capture(`correlation${propertiesTable ? ' properties' : ''} analyzed`, {- ...payload,- delay,- })- }- },reportExperimentWizardStarted: () => {posthog.capture('experiment wizard started')},diff --git a/frontend/src/mocks/fixtures/api/projects/team_id/insights/funnelCorrelation.json b/frontend/src/mocks/fixtures/api/projects/team_id/insights/funnelCorrelation.jsondeleted file mode 100644index 8cec658c64f9..000000000000--- a/frontend/src/mocks/fixtures/api/projects/team_id/insights/funnelCorrelation.json+++ /dev/null@@ -1,48 +0,0 @@-{- "result": {- "events": [- {- "success_count": 472,- "success_people_url": "http://localhost:8000/api/person/funnel/correlation/?breakdown_attribution_type=first_touch&breakdown_normalize_url=False&date_from=-7d&display=FunnelViz",- "failure_count": 9,- "failure_people_url": "http://localhost:8000/api/person/funnel/correlation/?breakdown_attribution_type=first_touch&breakdown_normalize_url=False&date_from=-7d&display=FunnelViz",- "odds_ratio": 3006.964172813488,- "correlation_type": "success",- "event": {- "event": "score updated",- "properties": {},- "elements": []- }- },- {- "success_count": 60,- "success_people_url": "http://localhost:8000/api/person/funnel/correlation/?breakdown_attribution_type=first_touch&breakdown_normalize_url=False&date_from=-7d&display=FunnelViz",- "failure_count": 0,- "failure_people_url": "http://localhost:8000/api/person/funnel/correlation/?breakdown_attribution_type=first_touch&breakdown_normalize_url=False&date_from=-7d&display=FunnelViz",- "odds_ratio": 2750.7485294117646,- "correlation_type": "success",- "event": {- "event": "onboard teammate clicked",- "properties": {},- "elements": []- }- },- {- "success_count": 65,- "success_people_url": "http://localhost:8000/api/person/funnel/correlation/?breakdown_attribution_type=first_touch&breakdown_normalize_url=False&date_from=-7d&display=FunnelViz",- "failure_count": 75,- "failure_people_url": "http://localhost:8000/api/person/funnel/correlation/?breakdown_attribution_type=first_touch&breakdown_normalize_url=False&date_from=-7d&display=FunnelViz",- "odds_ratio": 35.41070956534874,- "correlation_type": "failure",- "event": {- "event": "cancellation prompt shown",- "properties": {},- "elements": []- }- }- ],- "skewed": true- },- "last_refresh": "2024-03-11T18:44:25.153943Z",- "is_cached": false-}diff --git a/frontend/src/queries/nodes/InsightViz/InsightViz.tsx b/frontend/src/queries/nodes/InsightViz/InsightViz.tsxindex 64d85d47c752..5bf48e41cd9a 100644--- a/frontend/src/queries/nodes/InsightViz/InsightViz.tsx+++ b/frontend/src/queries/nodes/InsightViz/InsightViz.tsx@@ -92,7 +92,6 @@ export function InsightViz({const showIfFull = !!query.fullconst disableHeader = embedded || !(query.showHeader ?? showIfFull)const disableTable = embedded || !(query.showTable ?? showIfFull)- const disableCorrelationTable = embedded || !(query.showCorrelationTable ?? showIfFull)const disableLastComputation = embedded || !(query.showLastComputation ?? showIfFull)const disableLastComputationRefresh = embedded || !(query.showLastComputationRefresh ?? showIfFull)const showingFilters = query.showFilters ?? editMode ?? false@@ -105,7 +104,6 @@ export function InsightViz({context={context}disableHeader={disableHeader}disableTable={disableTable}- disableCorrelationTable={disableCorrelationTable}disableLastComputation={disableLastComputation}disableLastComputationRefresh={disableLastComputationRefresh}showingResults={showingResults}diff --git a/frontend/src/queries/nodes/InsightViz/InsightVizDisplay.tsx b/frontend/src/queries/nodes/InsightViz/InsightVizDisplay.tsxindex 4d9d4920eafe..44fc749bf1db 100644--- a/frontend/src/queries/nodes/InsightViz/InsightVizDisplay.tsx+++ b/frontend/src/queries/nodes/InsightViz/InsightVizDisplay.tsx@@ -51,7 +51,6 @@ import { ChartAlternatives } from 'products/product_analytics/frontend/insights/import { InsightDataChecks } from 'products/product_analytics/frontend/insights/dataChecks/InsightDataChecks'import { Funnel } from 'products/product_analytics/frontend/insights/funnels/Funnel'import { FunnelCanvasLabel } from 'products/product_analytics/frontend/insights/funnels/FunnelCanvasLabel'-import { FunnelCorrelation } from 'products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelCorrelation'import { funnelDataLogic } from 'products/product_analytics/frontend/insights/funnels/funnelDataLogic'import { FunnelStepsTable } from 'products/product_analytics/frontend/insights/funnels/FunnelStepsTable/FunnelStepsTable'import { FunnelTimeToConvertTable } from 'products/product_analytics/frontend/insights/funnels/FunnelTimeToConvertTable/FunnelTimeToConvertTable'@@ -174,7 +173,6 @@ export function shouldShowDashboardInsightRefreshHint({export function InsightVizDisplay({disableHeader,disableTable,- disableCorrelationTable,disableLastComputation,disableLastComputationRefresh,showingResults,@@ -185,7 +183,6 @@ export function InsightVizDisplay({}: {disableHeader?: booleandisableTable?: boolean- disableCorrelationTable?: booleandisableLastComputation?: booleandisableLastComputationRefresh?: booleanshowingResults?: boolean@@ -632,7 +629,6 @@ export function InsightVizDisplay({<ResultCustomizationsModal />{renderAIAnalysisSection()}{renderTable()}- {!disableCorrelationTable && activeView === InsightType.FUNNELS && <FunnelCorrelation />}</>)}diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.jsonindex 5f291353d56d..227e0f0b689f 100644--- a/frontend/src/queries/schema.json+++ b/frontend/src/queries/schema.json@@ -1266,9 +1266,6 @@{"$ref": "#/definitions/FunnelsActorsQuery"},- {- "$ref": "#/definitions/FunnelCorrelationActorsQuery"- },{"$ref": "#/definitions/ExperimentActorsQuery"},@@ -1881,19 +1878,6 @@}]},- "AnyEntityNode": {- "anyOf": [- {- "$ref": "#/definitions/EventsNode"- },- {- "$ref": "#/definitions/ActionsNode"- },- {- "$ref": "#/definitions/DataWarehouseNode"- }- ]- },"AnyEntityNode<DataWarehouseNode>": {"anyOf": [{@@ -9531,124 +9515,6 @@"required": ["cache_key", "is_cached", "last_refresh", "next_allowed_client_refresh", "timezone"],"type": "object"},- "CachedFunnelCorrelationResponse": {- "additionalProperties": false,- "properties": {- "cache_key": {- "type": "string"- },- "cache_target_age": {- "format": "date-time",- "type": "string"- },- "calculation_trigger": {- "description": "What triggered the calculation of the query, leave empty if user/immediate",- "type": "string"- },- "columns": {- "items": {},- "type": "array"- },- "error": {- "description": "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.",- "type": "string"- },- "hasMore": {- "type": "boolean"- },- "hogql": {- "description": "Generated HogQL query.",- "type": "string"- },- "is_cached": {- "type": "boolean"- },- "last_refresh": {- "format": "date-time",- "type": "string"- },- "limit": {- "$ref": "#/definitions/integer"- },- "modifiers": {- "$ref": "#/definitions/HogQLQueryModifiers",- "description": "Modifiers used when performing the query"- },- "next_allowed_client_refresh": {- "format": "date-time",- "type": "string"- },- "offset": {- "$ref": "#/definitions/integer"- },- "query_metadata": {- "type": "object"- },- "query_scan": {- "$ref": "#/definitions/QueryScanSummary",- "description": "The rows and time of the run that produced these results, with its analysis once it is stored."- },- "query_status": {- "$ref": "#/definitions/QueryStatus",- "description": "Query status indicates whether next to the provided data, a query is still running."- },- "resolved_compare_date_range": {- "$ref": "#/definitions/ResolvedDateRangeResponse",- "description": "The resolved previous/comparison period date range, when comparing against another period"- },- "resolved_date_range": {- "$ref": "#/definitions/ResolvedDateRangeResponse",- "description": "The date range used for the query"- },- "results": {- "$ref": "#/definitions/FunnelCorrelationResult"- },- "timezone": {- "type": "string"- },- "timings": {- "description": "Measured timings for different parts of the query generation process",- "items": {- "$ref": "#/definitions/QueryTiming"- },- "type": "array"- },- "types": {- "items": {},- "type": "array"- },- "used_data_warehouse_sources": {- "description": "Connector-synced data warehouse sources referenced by this query, if any.",- "items": {- "$ref": "#/definitions/DataWarehouseSourceUsage"- },- "type": "array"- },- "warnings": {- "description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. Also carries access control warnings when a system-table query filters out objects the user can't access.",- "items": {- "anyOf": [- {- "$ref": "#/definitions/DataWarehouseSyncWarning"- },- {- "$ref": "#/definitions/AccessControlFilterWarning"- }- ]- },- "type": "array"- }- },- "required": [- "cache_key",- "is_cached",- "last_refresh",- "next_allowed_client_refresh",- "results",- "timezone"- ],- "type": "object"- },"CachedFunnelsQueryResponse": {"additionalProperties": false,"properties": {@@ -24399,23 +24265,6 @@"enum": ["hog", "llm_judge", "sentiment"],"type": "string"},- "EventDefinition": {- "additionalProperties": false,- "properties": {- "elements": {- "items": {},- "type": "array"- },- "event": {- "type": "string"- },- "properties": {- "type": "object"- }- },- "required": ["event", "properties", "elements"],- "type": "object"- },"EventMetadataPropertyFilter": {"additionalProperties": false,"properties": {@@ -24439,29 +24288,6 @@"required": ["key", "operator", "type"],"type": "object"},- "EventOddsRatioSerialized": {- "additionalProperties": false,- "properties": {- "correlation_type": {- "enum": ["success", "failure"],- "type": "string"- },- "event": {- "$ref": "#/definitions/EventDefinition"- },- "failure_count": {- "$ref": "#/definitions/integer"- },- "odds_ratio": {- "type": "number"- },- "success_count": {- "$ref": "#/definitions/integer"- }- },- "required": ["event", "success_count", "failure_count", "odds_ratio", "correlation_type"],- "type": "object"- },"EventPropertyFilter": {"additionalProperties": false,"description": "Sync with nodejs/src/types.ts",@@ -27753,202 +27579,6 @@"enum": ["second", "minute", "hour", "day", "week", "month"],"type": "string"},- "FunnelCorrelationActorsQuery": {- "additionalProperties": false,- "properties": {- "funnelCorrelationPersonConverted": {- "type": "boolean"- },- "funnelCorrelationPersonEntity": {- "$ref": "#/definitions/AnyEntityNode"- },- "funnelCorrelationPropertyValues": {- "items": {- "$ref": "#/definitions/AnyPropertyFilter"- },- "type": "array"- },- "includeRecordings": {- "type": "boolean"- },- "kind": {- "const": "FunnelCorrelationActorsQuery",- "type": "string"- },- "modifiers": {- "$ref": "#/definitions/HogQLQueryModifiers",- "description": "Modifiers used when performing the query"- },- "response": {- "$ref": "#/definitions/ActorsQueryResponse"- },- "source": {- "$ref": "#/definitions/FunnelCorrelationQuery"- },- "tags": {- "$ref": "#/definitions/QueryLogTags"- },- "version": {- "description": "version of the node, used for schema migrations",- "type": "number"- }- },- "required": ["kind", "source"],- "type": "object"- },- "FunnelCorrelationQuery": {- "additionalProperties": false,- "properties": {- "funnelCorrelationEventExcludePropertyNames": {- "items": {- "type": "string"- },- "type": "array"- },- "funnelCorrelationEventNames": {- "items": {- "type": "string"- },- "type": "array"- },- "funnelCorrelationExcludeEventNames": {- "items": {- "type": "string"- },- "type": "array"- },- "funnelCorrelationExcludeNames": {- "items": {- "type": "string"- },- "type": "array"- },- "funnelCorrelationNames": {- "items": {- "type": "string"- },- "type": "array"- },- "funnelCorrelationType": {- "$ref": "#/definitions/FunnelCorrelationResultsType"- },- "kind": {- "const": "FunnelCorrelationQuery",- "type": "string"- },- "response": {- "$ref": "#/definitions/FunnelCorrelationResponse"- },- "source": {- "$ref": "#/definitions/FunnelsActorsQuery"- },- "version": {- "description": "version of the node, used for schema migrations",- "type": "number"- }- },- "required": ["funnelCorrelationType", "kind", "source"],- "type": "object"- },- "FunnelCorrelationResponse": {- "additionalProperties": false,- "properties": {- "columns": {- "items": {},- "type": "array"- },- "error": {- "description": "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.",- "type": "string"- },- "hasMore": {- "type": "boolean"- },- "hogql": {- "description": "Generated HogQL query.",- "type": "string"- },- "limit": {- "$ref": "#/definitions/integer"- },- "modifiers": {- "$ref": "#/definitions/HogQLQueryModifiers",- "description": "Modifiers used when performing the query"- },- "offset": {- "$ref": "#/definitions/integer"- },- "query_status": {- "$ref": "#/definitions/QueryStatus",- "description": "Query status indicates whether next to the provided data, a query is still running."- },- "resolved_compare_date_range": {- "$ref": "#/definitions/ResolvedDateRangeResponse",- "description": "The resolved previous/comparison period date range, when comparing against another period"- },- "resolved_date_range": {- "$ref": "#/definitions/ResolvedDateRangeResponse",- "description": "The date range used for the query"- },- "results": {- "$ref": "#/definitions/FunnelCorrelationResult"- },- "timings": {- "description": "Measured timings for different parts of the query generation process",- "items": {- "$ref": "#/definitions/QueryTiming"- },- "type": "array"- },- "types": {- "items": {},- "type": "array"- },- "used_data_warehouse_sources": {- "description": "Connector-synced data warehouse sources referenced by this query, if any.",- "items": {- "$ref": "#/definitions/DataWarehouseSourceUsage"- },- "type": "array"- },- "warnings": {- "description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. Also carries access control warnings when a system-table query filters out objects the user can't access.",- "items": {- "anyOf": [- {- "$ref": "#/definitions/DataWarehouseSyncWarning"- },- {- "$ref": "#/definitions/AccessControlFilterWarning"- }- ]- },- "type": "array"- }- },- "required": ["results"],- "type": "object"- },- "FunnelCorrelationResult": {- "additionalProperties": false,- "properties": {- "events": {- "items": {- "$ref": "#/definitions/EventOddsRatioSerialized"- },- "type": "array"- },- "skewed": {- "type": "boolean"- }- },- "required": ["events", "skewed"],- "type": "object"- },- "FunnelCorrelationResultsType": {- "enum": ["events", "properties", "event_with_properties"],- "type": "string"- },"FunnelExclusion": {"discriminator": {"propertyName": "kind"@@ -30216,9 +29846,6 @@{"$ref": "#/definitions/FunnelsActorsQuery"},- {- "$ref": "#/definitions/FunnelCorrelationActorsQuery"- },{"$ref": "#/definitions/StickinessActorsQuery"},@@ -30520,6 +30147,7 @@"type": "string"},"showCorrelationTable": {+ "deprecated": "Funnel correlation was removed. The value is ignored.","type": "boolean"},"showFilters": {@@ -39980,7 +39608,6 @@"ActorsQuery","GroupsQuery","FunnelsActorsQuery",- "FunnelCorrelationActorsQuery","PathsV2ActorsQuery","SessionsTimelineQuery","RecordingsQuery",@@ -40018,7 +39645,6 @@"LifecycleQuery","InsightActorsQuery","InsightActorsQueryOptions",- "FunnelCorrelationQuery","WebOverviewQuery","WebStatsTableQuery","WebExternalClicksTableQuery",@@ -47150,85 +46776,6 @@"required": ["results"],"type": "object"},- {- "additionalProperties": false,- "properties": {- "columns": {- "items": {},- "type": "array"- },- "error": {- "description": "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.",- "type": "string"- },- "hasMore": {- "type": "boolean"- },- "hogql": {- "description": "Generated HogQL query.",- "type": "string"- },- "limit": {- "$ref": "#/definitions/integer"- },- "modifiers": {- "$ref": "#/definitions/HogQLQueryModifiers",- "description": "Modifiers used when performing the query"- },- "offset": {- "$ref": "#/definitions/integer"- },- "query_status": {- "$ref": "#/definitions/QueryStatus",- "description": "Query status indicates whether next to the provided data, a query is still running."- },- "resolved_compare_date_range": {- "$ref": "#/definitions/ResolvedDateRangeResponse",- "description": "The resolved previous/comparison period date range, when comparing against another period"- },- "resolved_date_range": {- "$ref": "#/definitions/ResolvedDateRangeResponse",- "description": "The date range used for the query"- },- "results": {- "$ref": "#/definitions/FunnelCorrelationResult"- },- "timings": {- "description": "Measured timings for different parts of the query generation process",- "items": {- "$ref": "#/definitions/QueryTiming"- },- "type": "array"- },- "types": {- "items": {},- "type": "array"- },- "used_data_warehouse_sources": {- "description": "Connector-synced data warehouse sources referenced by this query, if any.",- "items": {- "$ref": "#/definitions/DataWarehouseSourceUsage"- },- "type": "array"- },- "warnings": {- "description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. Also carries access control warnings when a system-table query filters out objects the user can't access.",- "items": {- "anyOf": [- {- "$ref": "#/definitions/DataWarehouseSyncWarning"- },- {- "$ref": "#/definitions/AccessControlFilterWarning"- }- ]- },- "type": "array"- }- },- "required": ["results"],- "type": "object"- },{"additionalProperties": false,"properties": {@@ -50608,9 +50155,6 @@{"$ref": "#/definitions/LifecycleQuery"},- {- "$ref": "#/definitions/FunnelCorrelationQuery"- },{"$ref": "#/definitions/DatabaseSchemaQuery"},@@ -52030,6 +51574,7 @@"type": "boolean"},"showCorrelationTable": {+ "deprecated": "Funnel correlation was removed. The value is ignored.","type": "boolean"},"showCount": {diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.tsindex dc6fc243ac91..105cbf5fb988 100644--- a/frontend/src/queries/schema/schema-general.ts+++ b/frontend/src/queries/schema/schema-general.ts@@ -98,7 +98,6 @@ export enum NodeKind {ActorsQuery = 'ActorsQuery',GroupsQuery = 'GroupsQuery',FunnelsActorsQuery = 'FunnelsActorsQuery',- FunnelCorrelationActorsQuery = 'FunnelCorrelationActorsQuery',PathsV2ActorsQuery = 'PathsV2ActorsQuery',SessionsTimelineQuery = 'SessionsTimelineQuery',RecordingsQuery = 'RecordingsQuery',@@ -139,7 +138,6 @@ export enum NodeKind {LifecycleQuery = 'LifecycleQuery',InsightActorsQuery = 'InsightActorsQuery',InsightActorsQueryOptions = 'InsightActorsQueryOptions',- FunnelCorrelationQuery = 'FunnelCorrelationQuery',// Web analytics + Web Vitals queriesWebOverviewQuery = 'WebOverviewQuery',@@ -380,7 +378,6 @@ export type QuerySchema =| PathsV2Query| StickinessQuery| LifecycleQuery- | FunnelCorrelationQuery// Misc| DatabaseSchemaQuery@@ -1745,6 +1742,7 @@ interface InsightVizNodeViewProps {full?: booleanshowHeader?: booleanshowTable?: boolean+ /** @deprecated Funnel correlation was removed. The value is ignored. */showCorrelationTable?: booleanshowLastComputation?: booleanshowLastComputationRefresh?: boolean@@ -2126,8 +2124,6 @@ export type FunnelsFilterLegacy = Omit<FunnelsFilterType,| keyof FilterType| 'funnel_step_breakdown'- | 'funnel_correlation_person_entity'- | 'funnel_correlation_person_converted'| 'entrance_period_start'| 'drop_off'| 'funnel_step'@@ -3033,7 +3029,6 @@ export interface ActorsQuery extends DataNode<ActorsQueryResponse> {source?:| InsightActorsQuery| FunnelsActorsQuery- | FunnelCorrelationActorsQuery| ExperimentActorsQuery| StickinessActorsQuery| PathsV2ActorsQuery@@ -6469,14 +6464,6 @@ export interface FunnelsActorsQuery extends InsightActorsQueryBase {compare?: 'current' | 'previous'}-export interface FunnelCorrelationActorsQuery extends InsightActorsQueryBase {- kind: NodeKind.FunnelCorrelationActorsQuery- source: FunnelCorrelationQuery- funnelCorrelationPersonConverted?: boolean- funnelCorrelationPersonEntity?: AnyEntityNode- funnelCorrelationPropertyValues?: AnyPropertyFilter[]-}-/** The kind of journey grid element a PathsV2ActorsQuery drills into. */export enum PathsV2ElementType {Node = 'node',@@ -6526,58 +6513,6 @@ export interface PathsV2ActorsQuery extends InsightActorsQueryBase {element: PathsV2ElementSelector}-export interface EventDefinition {- event: string- properties: Record<string, any>- elements: any[]-}--export interface EventOddsRatioSerialized {- event: EventDefinition- success_count: integer- failure_count: integer- odds_ratio: number- correlation_type: 'success' | 'failure'-}--export interface FunnelCorrelationResult {- events: EventOddsRatioSerialized[]- skewed: boolean-}--export interface FunnelCorrelationResponse extends AnalyticsQueryResponseBase {- results: FunnelCorrelationResult- columns?: any[]- types?: any[]- hasMore?: boolean- limit?: integer- offset?: integer-}-export type CachedFunnelCorrelationResponse = FunnelCorrelationResponse & CachedRetentionQueryResponse--export enum FunnelCorrelationResultsType {- Events = 'events',- Properties = 'properties',- EventWithProperties = 'event_with_properties',-}--export interface FunnelCorrelationQuery extends Node<FunnelCorrelationResponse> {- kind: NodeKind.FunnelCorrelationQuery- source: FunnelsActorsQuery- funnelCorrelationType: FunnelCorrelationResultsType-- /* Events */- funnelCorrelationExcludeEventNames?: string[]-- /* Events with properties */- funnelCorrelationEventNames?: string[]- funnelCorrelationEventExcludePropertyNames?: string[]-- /* Properties */- funnelCorrelationNames?: string[]- funnelCorrelationExcludeNames?: string[]-}-/** @format date-time */export type DatetimeDay = string@@ -6628,13 +6563,7 @@ export type CachedInsightActorsQueryOptionsResponse = CachedQueryResponse<Insighexport interface InsightActorsQueryOptions extends Node<InsightActorsQueryOptionsResponse> {kind: NodeKind.InsightActorsQueryOptions- source:- | InsightActorsQuery- | FunnelsActorsQuery- | FunnelCorrelationActorsQuery- | StickinessActorsQuery- | ExperimentActorsQuery- | PathsV2ActorsQuery+ source: InsightActorsQuery | FunnelsActorsQuery | StickinessActorsQuery | ExperimentActorsQuery | PathsV2ActorsQuery}export interface DatabaseSchemaSchema {diff --git a/frontend/src/scenes/insights/utils/cleanFilters.ts b/frontend/src/scenes/insights/utils/cleanFilters.tsindex e074e81f9919..7c643d14f367 100644--- a/frontend/src/scenes/insights/utils/cleanFilters.ts+++ b/frontend/src/scenes/insights/utils/cleanFilters.ts@@ -366,8 +366,6 @@ export function cleanFilters(: {}),exclusions: deepCleanFunnelExclusionEvents(filters),interval: autocorrectInterval(filters),- funnel_correlation_person_entity: filters.funnel_correlation_person_entity || undefined,- funnel_correlation_person_converted: filters.funnel_correlation_person_converted || undefined,funnel_custom_steps: filters.funnel_custom_steps || undefined,...(filters.aggregation_group_type_index != null? { aggregation_group_type_index: filters.aggregation_group_type_index }diff --git a/frontend/src/scenes/notebooks/Nodes/NotebookNodeQuery.tsx b/frontend/src/scenes/notebooks/Nodes/NotebookNodeQuery.tsxindex 1b9ee7c0ab75..9604004c6277 100644--- a/frontend/src/scenes/notebooks/Nodes/NotebookNodeQuery.tsx+++ b/frontend/src/scenes/notebooks/Nodes/NotebookNodeQuery.tsx@@ -166,7 +166,6 @@ const Component = ({modifiedQuery.showFilters = falsemodifiedQuery.showHeader = falsemodifiedQuery.showTable = false- modifiedQuery.showCorrelationTable = falsemodifiedQuery.embedded = true}diff --git a/frontend/src/scenes/saved-insights/insightTypesMetadata.tsx b/frontend/src/scenes/saved-insights/insightTypesMetadata.tsxindex ade2ba269e30..949782af79a3 100644--- a/frontend/src/scenes/saved-insights/insightTypesMetadata.tsx+++ b/frontend/src/scenes/saved-insights/insightTypesMetadata.tsx@@ -111,12 +111,6 @@ export const QUERY_TYPES_METADATA: Record<NodeKind, InsightTypeMetadata> = {inMenu: true,tooltipDocLink: 'https://posthog.com/docs/product-analytics/lifecycle',},- [NodeKind.FunnelCorrelationQuery]: {- name: 'Funnel Correlation',- description: 'See which events or properties correlate to a funnel result.',- icon: IconCorrelationAnalysis,- inMenu: false,- },[NodeKind.EventsNode]: {name: 'Events',description: 'List and explore events.',@@ -207,12 +201,6 @@ export const QUERY_TYPES_METADATA: Record<NodeKind, InsightTypeMetadata> = {icon: IconPerson,inMenu: false,},- [NodeKind.FunnelCorrelationActorsQuery]: {- name: 'Persons',- description: 'List of persons matching specified conditions, derived from an insight.',- icon: IconPerson,- inMenu: false,- },[NodeKind.PathsV2ActorsQuery]: {name: 'Persons',description: 'List of persons behind a journey grid element, derived from an insight.',diff --git a/frontend/src/scenes/settings/SettingsMap.tsx b/frontend/src/scenes/settings/SettingsMap.tsxindex 2a5864e1bb3f..983f1f96ef29 100644--- a/frontend/src/scenes/settings/SettingsMap.tsx+++ b/frontend/src/scenes/settings/SettingsMap.tsx@@ -93,7 +93,6 @@ import { AgentUsageSettings } from './environment/AgentUsageSettings'import { AutocaptureSettings, WebVitalsAutocaptureSettings } from './environment/AutocaptureSettings'import { CloudEnvironmentsSettings } from './environment/CloudEnvironmentsSettings'import { CloudImagesSettings } from './environment/CloudImagesSettings'-import { CorrelationConfig } from './environment/CorrelationConfig'import { CSPReportingSettings } from './environment/CSPReportingSettings'import { DataAttributes } from './environment/DataAttributes'import { DataColorThemes } from './environment/DataColorThemes'@@ -1332,15 +1331,6 @@ export const SETTINGS_MAP: SettingSection[] = [flag: '!SETTINGS_PERSONS_ON_EVENTS_HIDDEN', // Setting hidden for Cloud orgs created since June 2024keywords: ['person', 'properties', 'join', 'query', 'performance'],},- {- id: 'correlation-analysis',- title: 'Correlation analysis exclusions',- description:- 'Correlation analysis automatically surfaces relevant signals for conversion. Exclude events or properties that do not provide useful signals.',- docsUrl: 'https://posthog.com/docs/product-analytics/funnels#correlation-analysis',- component: <CorrelationConfig />,- keywords: ['funnel', 'conversion', 'exclude', 'property'],- },{id: 'person-display-name',title: 'Person display name',diff --git a/frontend/src/scenes/settings/environment/CorrelationConfig.tsx b/frontend/src/scenes/settings/environment/CorrelationConfig.tsxdeleted file mode 100644index 853543bf7fb1..000000000000--- a/frontend/src/scenes/settings/environment/CorrelationConfig.tsx+++ /dev/null@@ -1,102 +0,0 @@-import { useActions, useValues } from 'kea'--import { IconPlus } from '@posthog/icons'-import { LemonButton } from '@posthog/lemon-ui'--import { EventSelect } from 'lib/components/EventSelect/EventSelect'-import { PropertySelect } from 'lib/components/PropertySelect/PropertySelect'-import { RestrictionScope, useRestrictedArea } from 'lib/components/RestrictedArea'-import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'-import { TeamMembershipLevel } from 'lib/constants'-import { IconSelectEvents, IconSelectProperties } from 'lib/lemon-ui/icons'-import { LemonInputSelect } from 'lib/lemon-ui/LemonInputSelect/LemonInputSelect'-import { teamLogic } from 'scenes/teamLogic'--export function CorrelationConfig(): JSX.Element {- const { updateCurrentTeam } = useActions(teamLogic)- const { currentTeam, funnelCorrelationConfig } = useValues(teamLogic)- const restrictedReason = useRestrictedArea({- scope: RestrictionScope.Project,- minimumAccessLevel: TeamMembershipLevel.Admin,- })-- const handleChange = (- excludedProperties?: string[],- excludedEvents?: string[],- excludedEventProperties?: string[]- ): void => {- if (currentTeam) {- const updatedConfig = { ...funnelCorrelationConfig }- if (excludedProperties !== undefined) {- updatedConfig.excluded_person_property_names = excludedProperties- }- if (excludedEventProperties !== undefined) {- updatedConfig.excluded_event_property_names = excludedEventProperties- }- if (excludedEvents !== undefined) {- updatedConfig.excluded_event_names = excludedEvents- }- if (updatedConfig && JSON.stringify(updatedConfig) !== JSON.stringify(funnelCorrelationConfig)) {- updateCurrentTeam({ correlation_config: updatedConfig })- }- }- }-- return (- <>- {currentTeam && (- <div className="deprecated-space-y-2">- <div>- <h3 className="flex items-center gap-2">- <IconSelectProperties className="text-lg" />- Excluded person properties- </h3>- <PropertySelect- taxonomicFilterGroup={TaxonomicFilterGroupType.PersonProperties}- onChange={(properties) => handleChange(properties)}- selectedProperties={funnelCorrelationConfig.excluded_person_property_names || []}- addText="Add exclusion"- disabledReason={restrictedReason}- />- </div>- <div>- <h3 className="flex items-center gap-2">- <IconSelectEvents className="text-lg" />- Excluded events- </h3>- <EventSelect- onChange={(excludedEvents) => handleChange(undefined, excludedEvents)}- selectedEvents={funnelCorrelationConfig.excluded_event_names || []}- addElement={- <LemonButton- size="small"- type="secondary"- icon={<IconPlus />}- sideIcon={null}- disabledReason={restrictedReason}- >- Add exclusion- </LemonButton>- }- />- </div>- <div>- <h3 className="flex items-center gap-2">- <IconSelectEvents className="text-lg" />- Excluded event properties- </h3>- <div className="max-w-160">- <LemonInputSelect- mode="multiple"- allowCustomValues- onChange={(properties: string[]) => handleChange(undefined, undefined, properties)}- value={funnelCorrelationConfig.excluded_event_property_names || []}- disabled={!!restrictedReason}- />- </div>- </div>- </div>- )}- </>- )-}diff --git a/frontend/src/scenes/settings/types.ts b/frontend/src/scenes/settings/types.tsindex 53dfd5b27829..5b4f827f2084 100644--- a/frontend/src/scenes/settings/types.ts+++ b/frontend/src/scenes/settings/types.ts@@ -144,7 +144,6 @@ export type SettingId =| 'conversations-notifications'| 'cookieless-server-hash-mode'| 'core-memory'- | 'correlation-analysis'| 'csp-reporting'| 'custom-bot-definitions'| 'customer-analytics-accounts'diff --git a/frontend/src/scenes/team-activity/teamActivityDescriber.tsx b/frontend/src/scenes/team-activity/teamActivityDescriber.tsxindex 1ae069a13821..346fda7f0923 100644--- a/frontend/src/scenes/team-activity/teamActivityDescriber.tsx+++ b/frontend/src/scenes/team-activity/teamActivityDescriber.tsx@@ -21,14 +21,7 @@ import { ExperimentsConfig } from 'scenes/settings/environment/experimentsConfigimport { urls } from 'scenes/urls'import { CurrencyCode } from '~/queries/schema/schema-general'-import {- ActivityScope,- CorrelationConfigType,- GroupType,- PathCleaningFilter,- TeamSurveyConfigType,- TeamType,-} from '~/types'+import { ActivityScope, GroupType, PathCleaningFilter, TeamSurveyConfigType, TeamType } from '~/types'import { ThemeName } from '../dataThemeLogic'import { coreEventsConfigurationDescriber } from './core_events_config/coreEventsConfigurationDescriber'@@ -731,53 +724,6 @@ const TEAM_PROPERTIES_MAPPING: Record<],}},- correlation_config: (change) => {- const before = change.before as CorrelationConfigType- const after = change.after as CorrelationConfigType-- const descriptions = []-- const sameArray = (a: string[], b: string[]): boolean => {- if (a.length !== b.length) {- return false- }- return a.every((x) => b.includes(x)) && b.every((x) => a.includes(x))- }-- if (- after.excluded_person_property_names &&- !sameArray(before.excluded_person_property_names || [], after.excluded_person_property_names)- ) {- descriptions.push(- <>- set <em>excluded person properties</em> to{' '}- <code>{after.excluded_person_property_names.join(', ')}</code>- </>- )- }-- if (- after.excluded_event_property_names &&- !sameArray(before.excluded_event_property_names || [], after.excluded_event_property_names)- ) {- descriptions.push(- <>- set <em>excluded event properties</em> to{' '}- <code>{after.excluded_event_property_names.join(', ')}</code>- </>- )- }-- if (after.excluded_event_names && !sameArray(before.excluded_event_names || [], after.excluded_event_names)) {- descriptions.push(- <>- set <em>excluded event names</em> to <code>{after.excluded_event_names.join(', ')}</code>- </>- )- }-- return { description: descriptions }- },// Complex configs that require a custom describercustomer_analytics_config: customerAnalyticsConfigurationDescriber,diff --git a/frontend/src/scenes/teamLogic.tsx b/frontend/src/scenes/teamLogic.tsxindex 1e7a39c82a50..0cde1e53fc88 100644--- a/frontend/src/scenes/teamLogic.tsx+++ b/frontend/src/scenes/teamLogic.tsx@@ -26,7 +26,7 @@ import {type ProductIntentContext,ProductKey,} from '~/queries/schema/schema-general'-import { CorrelationConfigType, ProjectType, TeamPublicType, TeamType } from '~/types'+import { ProjectType, TeamPublicType, TeamType } from '~/types'import type { FeatureFlagsSet } from '../lib/logic/featureFlagLogic'import { organizationLogic } from './organizationLogic'@@ -111,7 +111,6 @@ export interface teamLogicValues {currentTeamLoading: booleancustomerAnalyticsConfig: CustomerAnalyticsConfigdemoOnlyProject: boolean- funnelCorrelationConfig: CorrelationConfigTypehasOnboardedAnyProduct: booleanisCurrentTeamUnavailable: booleanisTeamTokenResetAvailable: boolean@@ -335,7 +334,6 @@ export interface teamLogicMeta {currentTeam: TeamPublicType | TeamType | null,currentOrganization: null | import('~/types').OrganizationType) => boolean- funnelCorrelationConfig: (currentTeam: TeamPublicType | TeamType | null) => CorrelationConfigTypetimezone: (currentTeam: TeamPublicType | TeamType | null) => stringweekStartDay: (currentTeam: TeamPublicType | TeamType | null) => numberisTeamTokenResetAvailable: (currentTeam: TeamPublicType | TeamType | null) => boolean@@ -602,12 +600,6 @@ export const teamLogic = kea<teamLogicType>([): boolean =>(currentTeam?.is_demo && currentOrganization?.teams && currentOrganization.teams.length == 1) || false,],- funnelCorrelationConfig: [- (selectors) => [selectors.currentTeam],- (currentTeam: TeamPublicType | TeamType | null): CorrelationConfigType => {- return currentTeam?.correlation_config || {}- },- ],timezone: [(selectors) => [selectors.currentTeam],(currentTeam: TeamPublicType | TeamType | null): string => currentTeam?.timezone || 'UTC',diff --git a/frontend/src/scenes/trends/persons-modal/personsModalLogic.ts b/frontend/src/scenes/trends/persons-modal/personsModalLogic.tsindex f3b04c50085d..3e82a5abb880 100644--- a/frontend/src/scenes/trends/persons-modal/personsModalLogic.ts+++ b/frontend/src/scenes/trends/persons-modal/personsModalLogic.ts@@ -31,7 +31,6 @@ import {ActorsQuery,DataTableNode,ExperimentActorsQuery,- FunnelCorrelationActorsQuery,FunnelsActorsQuery,InsightActorsQuery,InsightActorsQueryOptions,@@ -141,13 +140,7 @@ function buildFunnelBreakdownFilter(source: ActorsQuery['source'] | null): Unive}export interface PersonModalLogicProps {- query?:- | InsightActorsQuery- | FunnelsActorsQuery- | FunnelCorrelationActorsQuery- | ExperimentActorsQuery- | PathsV2ActorsQuery- | null+ query?: InsightActorsQuery | FunnelsActorsQuery | ExperimentActorsQuery | PathsV2ActorsQuery | nullurl?: string | nulladditionalSelect?: Partial<Record<keyof CommonActorType, string>>orderBy?: string[]diff --git a/frontend/src/types.ts b/frontend/src/types.tsindex b941fe466d52..2d1258bbe383 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -750,12 +750,6 @@ export interface TeamBasicType extends WithAccessControl {timezone: string}-export interface CorrelationConfigType {- excluded_person_property_names?: string[]- excluded_event_property_names?: string[]- excluded_event_names?: string[]-}-export interface ProjectType extends ProjectBasicType, Pick<ProjectApi, 'logo_media_id'> {created_at: stringis_pending_deletion: boolean@@ -908,12 +902,6 @@ export interface TeamType extends TeamBasicType {/** Effective access level of the user in this specific team. Null if user has no access. */effective_membership_level: OrganizationMembershipLevel | null- /** Used to exclude person properties from correlation analysis results.- *- * For example can be used to exclude properties that have trivial causation.- * This field should have a default value of `{}`, but it IS nullable and can be `null` in some cases.- */- correlation_config: CorrelationConfigType | nullperson_on_events_querying_enabled: booleanextra_settings?: Record<string, string | number | boolean | undefined>modifiers?: HogQLQueryModifiers@@ -3390,9 +3378,7 @@ export interface FunnelsFilterType extends FilterType {drop_off?: booleanfunnel_step?: numberfunnel_step_breakdown?: string | number[] | number | null // used in steps breakdown: persons modal- funnel_custom_steps?: number[] // used to provide custom steps for which to get people in a funnel - primarily for correlation use- funnel_correlation_person_entity?: Record<string, any> // Funnel Correlation Persons Filter- funnel_correlation_person_converted?: 'true' | 'false' // Funnel Correlation Persons Converted - success or failure counts+ funnel_custom_steps?: number[] // used to provide custom steps for which to get people in a funnel}export interface PathsFilterType extends FilterType {path_type?: PathType@@ -3729,31 +3715,6 @@ export interface FlattenedFunnelStepByBreakdown {significant?: boolean}-export interface FunnelCorrelation {- event: Pick<EventType, 'elements' | 'event' | 'properties'>- odds_ratio: number- success_count: number- success_people_url: string- failure_count: number- failure_people_url: string- correlation_type: FunnelCorrelationType.Failure | FunnelCorrelationType.Success- result_type:- | FunnelCorrelationResultsType.Events- | FunnelCorrelationResultsType.Properties- | FunnelCorrelationResultsType.EventWithProperties-}--export enum FunnelCorrelationType {- Success = 'success',- Failure = 'failure',-}--export enum FunnelCorrelationResultsType {- Events = 'events',- Properties = 'properties',- EventWithProperties = 'event_with_properties',-}-export enum BreakdownAttributionType {FirstTouch = 'first_touch',LastTouch = 'last_touch',diff --git a/posthog/admin/inlines/team_inline.py b/posthog/admin/inlines/team_inline.pyindex a16a68588884..f77695618541 100644--- a/posthog/admin/inlines/team_inline.py+++ b/posthog/admin/inlines/team_inline.py@@ -34,7 +34,6 @@ class TeamInline(TabularInlinePaginated):"path_cleaning_filters","timezone","data_attributes",- "correlation_config","modifiers","plugins_opt_in","opt_out_capture",diff --git a/posthog/api/project.py b/posthog/api/project.pyindex 3aa1899b690e..db961810ae70 100644--- a/posthog/api/project.py+++ b/posthog/api/project.py@@ -748,7 +748,6 @@ class ProjectBackwardCompatSerializer("timezone", # Compat with TeamSerializer"data_attributes", # Compat with TeamSerializer"person_display_name_properties", # Compat with TeamSerializer- "correlation_config", # Compat with TeamSerializer"autocapture_opt_out", # Compat with TeamSerializer"autocapture_exceptions_opt_in", # Compat with TeamSerializer"autocapture_web_vitals_opt_in", # Compat with TeamSerializer@@ -861,7 +860,6 @@ class ProjectBackwardCompatSerializer("timezone","data_attributes","person_display_name_properties",- "correlation_config","autocapture_opt_out","autocapture_exceptions_opt_in","autocapture_web_vitals_opt_in",diff --git a/posthog/api/team/team_config.py b/posthog/api/team/team_config.pyindex 0cf006545684..b497243ee4b2 100644--- a/posthog/api/team/team_config.py+++ b/posthog/api/team/team_config.py@@ -97,7 +97,6 @@ TEAM_CONFIG_FIELDS = ("timezone","data_attributes","person_display_name_properties",- "correlation_config","autocapture_opt_out","autocapture_exceptions_opt_in","autocapture_web_vitals_opt_in",diff --git a/posthog/api/test/__snapshots__/test_action.ambr b/posthog/api/test/__snapshots__/test_action.ambrindex 2c9d64c9c6c2..3b5242e9b932 100644--- a/posthog/api/test/__snapshots__/test_action.ambr+++ b/posthog/api/test/__snapshots__/test_action.ambr@@ -164,7 +164,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -639,7 +638,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -769,7 +767,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",diff --git a/posthog/api/test/__snapshots__/test_element.ambr b/posthog/api/test/__snapshots__/test_element.ambrindex fffd546769ee..5cc0d101cd33 100644--- a/posthog/api/test/__snapshots__/test_element.ambr+++ b/posthog/api/test/__snapshots__/test_element.ambr@@ -287,7 +287,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",diff --git a/posthog/api/test/__snapshots__/test_preflight.ambr b/posthog/api/test/__snapshots__/test_preflight.ambrindex b5e89f8df55a..665f469f530e 100644--- a/posthog/api/test/__snapshots__/test_preflight.ambr+++ b/posthog/api/test/__snapshots__/test_preflight.ambr@@ -177,7 +177,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",diff --git a/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr b/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambrindex 52f882c9dd99..d77990059f30 100644--- a/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr+++ b/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr@@ -202,7 +202,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -581,7 +580,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -1050,7 +1048,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -1265,7 +1262,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -1843,7 +1839,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -2241,7 +2236,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -2398,7 +2392,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -2781,7 +2774,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -3247,7 +3239,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -3481,7 +3472,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -4027,7 +4017,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -4337,7 +4326,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -4577,7 +4565,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -5082,7 +5069,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -5297,7 +5283,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -5699,7 +5684,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -6104,7 +6088,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -6314,7 +6297,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -6702,7 +6684,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -7174,7 +7155,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -7389,7 +7369,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -7975,7 +7954,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -8192,7 +8170,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -8456,7 +8433,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -8794,7 +8770,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -9168,7 +9143,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -9313,7 +9287,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -9501,7 +9474,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -9848,7 +9820,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -10219,7 +10190,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -10364,7 +10334,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -10569,7 +10538,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -10910,7 +10878,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -11446,7 +11413,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -11732,7 +11698,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -12046,7 +12011,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -12473,7 +12437,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -12821,7 +12784,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -12992,7 +12954,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -13180,7 +13141,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -13562,7 +13522,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -13929,7 +13888,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -14074,7 +14032,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -14262,7 +14219,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -14605,7 +14561,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -14974,7 +14929,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -15119,7 +15073,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -15328,7 +15281,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -15664,7 +15616,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -16201,7 +16152,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -16487,7 +16437,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -16797,7 +16746,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -17224,7 +17172,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -17572,7 +17519,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -17733,7 +17679,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -17921,7 +17866,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -18265,7 +18209,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -18626,7 +18569,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -18771,7 +18713,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -18959,7 +18900,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -19296,7 +19236,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -19653,7 +19592,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -19798,7 +19736,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -19999,7 +19936,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -20337,7 +20273,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -20870,7 +20805,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -21156,7 +21090,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -21280,7 +21213,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -21554,7 +21486,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -22012,7 +21943,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -22377,7 +22307,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -22522,7 +22451,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -22710,7 +22638,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -23104,7 +23031,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -23374,7 +23300,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -23550,7 +23475,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -23695,7 +23619,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -23897,7 +23820,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -24224,7 +24146,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -24572,7 +24493,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -24730,7 +24650,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -24918,7 +24837,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -25253,7 +25171,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -25793,7 +25710,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -26079,7 +25995,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -26391,7 +26306,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -26811,7 +26725,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -27167,7 +27080,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -27312,7 +27224,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -27500,7 +27411,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -27885,7 +27795,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -28279,7 +28188,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -28424,7 +28332,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -28566,7 +28473,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -28751,7 +28657,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -29130,7 +29035,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -29478,7 +29382,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -29646,7 +29549,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -29834,7 +29736,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -30211,7 +30112,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -30750,7 +30650,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -31072,7 +30971,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -31406,7 +31304,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -31817,7 +31714,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -32180,7 +32076,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -32325,7 +32220,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -32528,7 +32422,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -32875,7 +32768,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -33090,7 +32982,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -33446,7 +33337,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -34143,7 +34033,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -34453,7 +34342,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -34693,7 +34581,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -35068,7 +34955,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -35389,7 +35275,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -35800,7 +35685,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -36370,7 +36254,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",diff --git a/posthog/api/test/notebooks/__snapshots__/test_notebook.ambr b/posthog/api/test/notebooks/__snapshots__/test_notebook.ambrindex 99150e655bbe..cf96c84887dd 100644--- a/posthog/api/test/notebooks/__snapshots__/test_notebook.ambr+++ b/posthog/api/test/notebooks/__snapshots__/test_notebook.ambr@@ -269,7 +269,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -572,7 +571,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -813,7 +811,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -952,7 +949,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -1369,7 +1365,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -1885,7 +1880,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",diff --git a/posthog/api/test/test_team_project_differential.py b/posthog/api/test/test_team_project_differential.pyindex 16b16780a34c..7b2128d6e39f 100644--- a/posthog/api/test/test_team_project_differential.py+++ b/posthog/api/test/test_team_project_differential.py@@ -158,7 +158,6 @@ FIELD_VALUES: dict[str, Any] = {"timezone": "America/New_York","data_attributes": ["data-attr"],"person_display_name_properties": ["email"],- "correlation_config": {"excluded_person_property_names": ["foo"]},"autocapture_opt_out": True,"autocapture_exceptions_opt_in": True,"autocapture_web_vitals_opt_in": True,diff --git a/posthog/api/utils.py b/posthog/api/utils.pyindex 059c0e0c7009..795fe350af31 100644--- a/posthog/api/utils.py+++ b/posthog/api/utils.py@@ -271,7 +271,6 @@ def parse_actor_property_filters(raw_properties: Optional[str]) -> list[dict]:INSIGHT_KINDS = {"TrendsQuery","FunnelsQuery",- "FunnelCorrelationQuery","RetentionQuery","PathsQuery","PathsV2Query",@@ -294,7 +293,6 @@ _EXTRA_ASYNC_KINDS = ASYNC_QUERY_KINDS - INSIGHT_KINDSINSIGHT_ACTORS_KINDS = {"InsightActorsQuery","FunnelsActorsQuery",- "FunnelCorrelationActorsQuery","StickinessActorsQuery","PathsV2ActorsQuery",}diff --git a/posthog/clickhouse/query_tagging.py b/posthog/clickhouse/query_tagging.pyindex 3bdb116daff6..63d5475d22a5 100644--- a/posthog/clickhouse/query_tagging.py+++ b/posthog/clickhouse/query_tagging.py@@ -329,8 +329,6 @@ def kind_fallback_tags(kind: NodeKind) -> FallbackTags | None:| NodeKind.INSIGHT_ACTORS_QUERY| NodeKind.INSIGHT_ACTORS_QUERY_OPTIONS| NodeKind.FUNNELS_ACTORS_QUERY- | NodeKind.FUNNEL_CORRELATION_QUERY- | NodeKind.FUNNEL_CORRELATION_ACTORS_QUERY| NodeKind.PATHS_V2_ACTORS_QUERY# data-source nodes, not full queries| NodeKind.EVENTS_NODEdiff --git a/posthog/constants.py b/posthog/constants.pyindex 7a17cc126fe4..c6c58debdb24 100644--- a/posthog/constants.py+++ b/posthog/constants.py@@ -197,15 +197,7 @@ FUNNEL_FROM_STEP = "funnel_from_step"FUNNEL_TO_STEP = "funnel_to_step"FUNNEL_STEP = "funnel_step"FUNNEL_CUSTOM_STEPS = "funnel_custom_steps"-FUNNEL_CORRELATION_TYPE = "funnel_correlation_type"FUNNEL_WINDOW_INTERVAL_TYPES = Literal["DAY", "SECOND", "MINUTE", "HOUR", "WEEK", "MONTH"]-# Funnel Correlation Properties-FUNNEL_CORRELATION_NAMES = "funnel_correlation_names"-FUNNEL_CORRELATION_EXCLUDE_NAMES = "funnel_correlation_exclude_names"-# Funnel Correlation Events-FUNNEL_CORRELATION_EVENT_NAMES = "funnel_correlation_event_names"-FUNNEL_CORRELATION_EXCLUDE_EVENT_NAMES = "funnel_correlation_exclude_event_names"-FUNNEL_CORRELATION_EVENT_EXCLUDE_PROPERTY_NAMES = "funnel_correlation_event_exclude_property_names"FUNNEL_PATHS = "funnel_paths"PATHS_HOGQL_EXPRESSION = "paths_hogql_expression"PATHS_INCLUDE_EVENT_TYPES = "include_event_types"@@ -245,12 +237,6 @@ class FunnelVizType(StrEnum):STEPS = "steps"-class FunnelCorrelationType(StrEnum):- EVENTS = "events"- PROPERTIES = "properties"- EVENT_WITH_PROPERTIES = "event_with_properties"--RETENTION_RECURRING = "retention_recurring"RETENTION_FIRST_OCCURRENCE_MATCHING_FILTERS = "retention_first_time"RETENTION_FIRST_EVER_OCCURRENCE = "retention_first_ever_occurrence"diff --git a/posthog/hogql_queries/insight_actors_query_options_runner.py b/posthog/hogql_queries/insight_actors_query_options_runner.pyindex 0be97614d6ec..9187014b4fa4 100644--- a/posthog/hogql_queries/insight_actors_query_options_runner.py+++ b/posthog/hogql_queries/insight_actors_query_options_runner.py@@ -71,8 +71,6 @@ class InsightActorsQueryOptionsRunner(QueryRunner):lifecycle_runner = cast(LifecycleQueryRunner, self.source_runner)return lifecycle_runner.to_actors_query_options()elif isinstance(self.source_runner, FunnelsQueryRunner):- # Only plain FunnelsActorsQuery sources land here — correlation modals wrap a- # FunnelCorrelationQueryRunner and keep falling through to the empty response.funnels_runner = cast(FunnelsQueryRunner, self.source_runner)return funnels_runner.to_actors_query_options()diff --git a/posthog/hogql_queries/insight_actors_query_runner.py b/posthog/hogql_queries/insight_actors_query_runner.pyindex b9063a7efb32..b3d327eb3b09 100644--- a/posthog/hogql_queries/insight_actors_query_runner.py+++ b/posthog/hogql_queries/insight_actors_query_runner.py@@ -4,8 +4,6 @@ from typing import Any, Optional, castfrom posthog.schema import (ExperimentActorsQuery,FunnelAggregateByHogQL,- FunnelCorrelationActorsQuery,- FunnelCorrelationQuery,FunnelsActorsQuery,FunnelsFilter,FunnelsQuery,@@ -32,7 +30,6 @@ from posthog.types import InsightActorsQueryNodefrom products.experiments.backend.hogql_queries.experiment_query_runner import ExperimentQueryRunnerfrom products.product_analytics.backend.facade.queries import (- FunnelCorrelationQueryRunner,FunnelsQueryRunner,LifecycleQueryRunner,PathsQueryRunner,@@ -92,11 +89,6 @@ class InsightActorsQueryRunner(AnalyticsQueryRunner[HogQLQueryResponse]):funnels_runner = cast(FunnelsQueryRunner, self.source_runner)funnels_runner.context.actorsQuery = cast(FunnelsActorsQuery, self.query)return funnels_runner.to_actors_query()- elif isinstance(self.source_runner, FunnelCorrelationQueryRunner):- funnel_correlation_runner = cast(FunnelCorrelationQueryRunner, self.source_runner)- assert isinstance(self.query, FunnelCorrelationActorsQuery)- funnel_correlation_runner.correlation_actors_query = self.query- return funnel_correlation_runner.to_actors_query()elif isinstance(self.source_runner, RetentionQueryRunner):query = cast(InsightActorsQuery, self.query)retention_runner = cast(RetentionQueryRunner, self.source_runner)@@ -164,11 +156,6 @@ class InsightActorsQueryRunner(AnalyticsQueryRunner[HogQLQueryResponse]):if isinstance(self.source_runner, RetentionQueryRunner):return cast(RetentionQueryRunner, self.source_runner).group_type_index- if isinstance(self.source_runner, FunnelCorrelationQueryRunner):- if not isinstance(self.query.source, FunnelCorrelationQuery):- raise ExposedHogQLError("Funnel correlation actors query requires a FunnelCorrelationQuery source")- return self.query.source.source.source.aggregation_group_type_index-if isinstance(self.source_runner, FunnelsQueryRunner):if not isinstance(self.query.source, FunnelsQuery):raise ExposedHogQLError("Funnels actors query requires a FunnelsQuery source")diff --git a/posthog/hogql_queries/query_metadata.py b/posthog/hogql_queries/query_metadata.pyindex a9c021bd6d4f..819b567df6f9 100644--- a/posthog/hogql_queries/query_metadata.py+++ b/posthog/hogql_queries/query_metadata.py@@ -16,8 +16,6 @@ from posthog.schema import (EntityType,EventsNode,EventsQuery,- FunnelCorrelationActorsQuery,- FunnelCorrelationQuery,FunnelExclusionActionsNode,FunnelExclusionEventsNode,FunnelsActorsQuery,@@ -99,8 +97,6 @@ class QueryEventsExtractor:events = self.extract_events(self._ensure_model_instance(query, InsightActorsQuery).source)elif kind == "FunnelsActorsQuery":events = self.extract_events(self._ensure_model_instance(query, FunnelsActorsQuery).source)- elif kind == "FunnelCorrelationActorsQuery":- events = self.extract_events(self._ensure_model_instance(query, FunnelCorrelationActorsQuery).source)elif kind == "StickinessActorsQuery":events = self.extract_events(self._ensure_model_instance(query, StickinessActorsQuery).source)elif kind == "PathsV2ActorsQuery":@@ -115,11 +111,6 @@ class QueryEventsExtractor:elif kind == "CalendarHeatmapQuery":events = self._extract_events_from_series(self._ensure_model_instance(query, CalendarHeatmapQuery).series)- elif kind == "FunnelCorrelationQuery":- events = self._extract_events_from_funnels_correlation_query(- self._ensure_model_instance(query, FunnelCorrelationQuery)- )-elif kind == "EventsQuery":events = self._extract_events_from_events_query(self._ensure_model_instance(query, EventsQuery))@@ -196,17 +187,6 @@ class QueryEventsExtractor:return ["$pageview"]return list({source.event for source in query.pathsV2Filter.stepSources})- def _extract_events_from_funnels_correlation_query(self, query: FunnelCorrelationQuery) -> list[str]:- events = self.extract_events(query.source)-- if query.funnelCorrelationEventNames:- events.extend(query.funnelCorrelationEventNames)-- if query.funnelCorrelationExcludeEventNames:- events.extend(query.funnelCorrelationExcludeEventNames)-- return list(set(events))-@staticmethoddef _is_valid_url(url: str) -> bool:try:diff --git a/posthog/hogql_queries/query_runner.py b/posthog/hogql_queries/query_runner.pyindex f6b1d2848c8b..15f43c00601a 100644--- a/posthog/hogql_queries/query_runner.py+++ b/posthog/hogql_queries/query_runner.py@@ -55,8 +55,6 @@ from posthog.schema import (EventTaxonomyQuery,ExperimentExposureQuery,FilterLogicalOperator,- FunnelCorrelationActorsQuery,- FunnelCorrelationQuery,FunnelsActorsQuery,FunnelsQuery,GenericCachedQueryResponse,@@ -628,8 +626,6 @@ RunnableQueryNode = Union[HogQLQuery,InsightActorsQuery,FunnelsActorsQuery,- FunnelCorrelationQuery,- FunnelCorrelationActorsQuery,InsightActorsQueryOptions,SessionsTimelineQuery,WebOverviewQuery,@@ -941,7 +937,6 @@ def get_query_runner(if kind in ("InsightActorsQuery","FunnelsActorsQuery",- "FunnelCorrelationActorsQuery","ExperimentActorsQuery","StickinessActorsQuery","PathsV2ActorsQuery",@@ -967,17 +962,6 @@ def get_query_runner(modifiers=modifiers,user=user,)- if kind == "FunnelCorrelationQuery":- from products.product_analytics.backend.facade.queries import FunnelCorrelationQueryRunner-- return FunnelCorrelationQueryRunner(- query=cast(FunnelCorrelationQuery | dict[str, Any], query),- team=team,- timings=timings,- limit_context=limit_context,- modifiers=modifiers,- user=user,- )if kind == "HogQLQuery":from .hogql_query_runner import HogQLQueryRunner@@ -1845,10 +1829,6 @@ def resolve_series_custom_name(series: Any, raw_label: str | None) -> str | Nonedef query_node_modifiers(query: BaseModel) -> Optional[HogQLQueryModifiers]:- # A correlation query has no modifiers field. It uses the modifiers of the funnel it analyzes,- # so that the correlation reads the same events table and person data as that funnel.- if isinstance(query, FunnelCorrelationQuery):- return query.source.source.modifiersreturn getattr(query, "modifiers", None)diff --git a/posthog/hogql_queries/test/test_query_metadata.py b/posthog/hogql_queries/test/test_query_metadata.pyindex 78b3a913c3c8..ffd488e138e4 100644--- a/posthog/hogql_queries/test/test_query_metadata.py+++ b/posthog/hogql_queries/test/test_query_metadata.py@@ -10,9 +10,6 @@ from posthog.schema import (EntityType,EventsNode,EventsQuery,- FunnelCorrelationActorsQuery,- FunnelCorrelationQuery,- FunnelCorrelationResultsType,FunnelExclusionActionsNode,FunnelExclusionEventsNode,FunnelsActorsQuery,@@ -301,23 +298,6 @@ class TestQueryEventsExtractor(TestCase):result = self.extractor.extract_events(query)self.assertCountEqual(result, ["funnel_step"])- def test_extract_events_funnel_correlation_actors_query(self):- """Test extracting events from FunnelCorrelationActorsQuery"""-- funnels_query = FunnelsQuery(- series=[EventsNode(event="funnel_event")], funnelsFilter=FunnelsFilter(exclusions=[])- )- actors_query = FunnelsActorsQuery(source=funnels_query)- source_query = FunnelCorrelationQuery(- source=actors_query,- funnelCorrelationExcludeEventNames=["exclude_event"],- funnelCorrelationEventNames=["correlation_event"],- funnelCorrelationType=FunnelCorrelationResultsType.EVENTS,- )- query = FunnelCorrelationActorsQuery(source=source_query)- result = self.extractor.extract_events(query)- self.assertCountEqual(result, ["funnel_event", "correlation_event", "exclude_event"])-def test_extract_events_stickiness_actors_query(self):"""Test extracting events from StickinessActorsQuery"""source_query = StickinessQuery(series=[EventsNode(event="sticky_event")])@@ -325,21 +305,6 @@ class TestQueryEventsExtractor(TestCase):result = self.extractor.extract_events(query)self.assertCountEqual(result, ["sticky_event"])- def test_extract_events_funnel_correlation_query(self):- """Test extracting events from FunnelCorrelationQuery"""- funnels_query = FunnelsQuery(- series=[EventsNode(event="funnel_event")], funnelsFilter=FunnelsFilter(exclusions=[])- )- actors_query = FunnelsActorsQuery(source=funnels_query)- source_query = FunnelCorrelationQuery(- source=actors_query,- funnelCorrelationExcludeEventNames=["exclude_event"],- funnelCorrelationEventNames=["correlation_event"],- funnelCorrelationType=FunnelCorrelationResultsType.EVENTS,- )- result = self.extractor.extract_events(source_query)- self.assertCountEqual(result, ["funnel_event", "correlation_event", "exclude_event"])-def test_extract_events_from_dict(self):"""Test extracting events from dictionary input"""query_dict = {diff --git a/posthog/models/team/team.py b/posthog/models/team/team.pyindex 1f0dfe5244b5..e84aa78e694e 100644--- a/posthog/models/team/team.py+++ b/posthog/models/team/team.py@@ -20,6 +20,7 @@ import pydanticfrom posthog.clickhouse.query_tagging import Feature, Product, tag_queries, tags_contextfrom posthog.cloud_utils import is_cloudfrom posthog.helpers.session_recording_playlist_templates import DEFAULT_PLAYLISTS+from posthog.migration_helpers import deprecate_fieldfrom posthog.models.filters.utils import GroupTypeIndexfrom posthog.models.instance_setting import get_instance_settingfrom posthog.models.organization import Organization, OrganizationMembership@@ -670,12 +671,7 @@ class Team(UUIDTClassicModel):def aggregate_users_by_distinct_id(self) -> bool:return str(self.pk) in get_list(get_instance_setting("AGGREGATE_BY_DISTINCT_IDS_TEAMS"))- # This correlation_config is intended to be used initially for- # `excluded_person_property_names` but will be used as a general config- # repository for correlation related settings.- # NOTE: we're not doing any schema checking here, just storing whatever is- # thrown at us. Correlation code can handle schema related issues.- correlation_config = field_access_control(models.JSONField(default=dict, null=True, blank=True), "project", "admin")+ correlation_config = deprecate_field(models.JSONField(default=dict, null=True, blank=True))# DEPRECATED, DISUSED: recordings on CH are cleared with Clickhouse's TTLsession_recording_retention_period_days = models.IntegerField(null=True, default=None, blank=True)diff --git a/posthog/schema.py b/posthog/schema.pyindex e0e0de7b73c2..8151ed4df5af 100644--- a/posthog/schema.py+++ b/posthog/schema.py@@ -81,7 +81,6 @@ from posthog.schema_enums import (ComparisonPeriod as ComparisonPeriod,ConversionRateInputType as ConversionRateInputType,CoreEventCategory as CoreEventCategory,- CorrelationType as CorrelationType,CountPerActorMathType as CountPerActorMathType,CurrencyCode as CurrencyCode,Curve as Curve,@@ -141,7 +140,6 @@ from posthog.schema_enums import (FunnelAggregateByHogQL as FunnelAggregateByHogQL,FunnelConversionMetric as FunnelConversionMetric,FunnelConversionWindowTimeUnit as FunnelConversionWindowTimeUnit,- FunnelCorrelationResultsType as FunnelCorrelationResultsType,FunnelLayout as FunnelLayout,FunnelMathType as FunnelMathType,FunnelPathType as FunnelPathType,@@ -1505,15 +1503,6 @@ class ErrorTrackingIssueImpactToolOutput(BaseModel):events: list[str]-class EventDefinition(BaseModel):- model_config = ConfigDict(- extra="forbid",- )- elements: list- event: str- properties: dict[str, Any]--class Person(BaseModel):model_config = ConfigDict(extra="forbid",@@ -3034,7 +3023,7 @@ class QueryResponseAlternative7(BaseModel):stdout: str | None = None-class QueryResponseAlternative77(BaseModel):+class QueryResponseAlternative76(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -5664,17 +5653,6 @@ class EventMetadataPropertyFilter(BaseModel):value: list[str | float | bool] | str | float | bool | None = None-class EventOddsRatioSerialized(BaseModel):- model_config = ConfigDict(- extra="forbid",- )- correlation_type: CorrelationType- event: EventDefinition- failure_count: int- odds_ratio: float- success_count: int--class EventPropertyFilter(BaseModel):model_config = ConfigDict(extra="forbid",@@ -6098,14 +6076,6 @@ class FormResumePayload(BaseModel):form_answers: dict[str, str | list[str]]-class FunnelCorrelationResult(BaseModel):- model_config = ConfigDict(- extra="forbid",- )- events: list[EventOddsRatioSerialized]- skewed: bool--class FunnelExclusionSteps(BaseModel):model_config = ConfigDict(extra="forbid",@@ -7561,7 +7531,7 @@ class QueryResponseAlternative29(BaseModel):status: ExternalQueryStatus-class QueryResponseAlternative84(BaseModel):+class QueryResponseAlternative83(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -12663,73 +12633,6 @@ class CachedExperimentExposureQueryResponse(BaseModel):)-class CachedFunnelCorrelationResponse(BaseModel):- model_config = ConfigDict(- extra="forbid",- )- cache_key: str- cache_target_age: AwareDatetime | None = None- calculation_trigger: str | None = Field(- default=None,- description=("What triggered the calculation of the query, leave empty if user/immediate"),- )- columns: list | None = None- error: str | None = Field(- default=None,- description=(- "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise."- ),- )- hasMore: bool | None = None- hogql: str | None = Field(default=None, description="Generated HogQL query.")- is_cached: bool- last_refresh: AwareDatetime- limit: int | None = None- modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")- next_allowed_client_refresh: AwareDatetime- offset: int | None = None- query_metadata: dict[str, Any] | None = None- query_scan: QueryScanSummary | None = Field(- default=None,- description=("The rows and time of the run that produced these results, with its analysis once it is stored."),- )- query_status: QueryStatus | None = Field(- default=None,- description=("Query status indicates whether next to the provided data, a query is still running."),- )- resolved_compare_date_range: ResolvedDateRangeResponse | None = Field(- default=None,- description=("The resolved previous/comparison period date range, when comparing against another period"),- )- resolved_date_range: ResolvedDateRangeResponse | None = Field(- default=None, description="The date range used for the query"- )- results: FunnelCorrelationResult- timezone: str- timings: list[QueryTiming] | None = Field(- default=None,- description=("Measured timings for different parts of the query generation process"),- )- types: list | None = None- used_data_warehouse_sources: list[DataWarehouseSourceUsage] | None = Field(- default=None,- description=("Connector-synced data warehouse sources referenced by this query, if any."),- )- warnings: list[DataWarehouseSyncWarning | AccessControlFilterWarning] | None = Field(- default=None,- description=(- "Warnings about data warehouse sources referenced by the query whose"- " latest sync failed, is paused, hit a billing limit, or is otherwise"- " stale. Results may not reflect current source data. Accumulated"- " across every HogQL execution that contributes to this response — so"- " insights backed by warehouse tables (Trends, Funnels, etc.) receive"- " the same warnings as raw HogQL queries. Also carries access control"- " warnings when a system-table query filters out objects the user can't"- " access."- ),- )--class CachedFunnelsQueryResponse(BaseModel):model_config = ConfigDict(extra="forbid",@@ -18812,58 +18715,6 @@ class ExperimentBreakdownResult(BaseModel):)-class FunnelCorrelationResponse(BaseModel):- model_config = ConfigDict(- extra="forbid",- )- columns: list | None = None- error: str | None = Field(- default=None,- description=(- "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise."- ),- )- hasMore: bool | None = None- hogql: str | None = Field(default=None, description="Generated HogQL query.")- limit: int | None = None- modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")- offset: int | None = None- query_status: QueryStatus | None = Field(- default=None,- description=("Query status indicates whether next to the provided data, a query is still running."),- )- resolved_compare_date_range: ResolvedDateRangeResponse | None = Field(- default=None,- description=("The resolved previous/comparison period date range, when comparing against another period"),- )- resolved_date_range: ResolvedDateRangeResponse | None = Field(- default=None, description="The date range used for the query"- )- results: FunnelCorrelationResult- timings: list[QueryTiming] | None = Field(- default=None,- description=("Measured timings for different parts of the query generation process"),- )- types: list | None = None- used_data_warehouse_sources: list[DataWarehouseSourceUsage] | None = Field(- default=None,- description=("Connector-synced data warehouse sources referenced by this query, if any."),- )- warnings: list[DataWarehouseSyncWarning | AccessControlFilterWarning] | None = Field(- default=None,- description=(- "Warnings about data warehouse sources referenced by the query whose"- " latest sync failed, is paused, hit a billing limit, or is otherwise"- " stale. Results may not reflect current source data. Accumulated"- " across every HogQL execution that contributes to this response — so"- " insights backed by warehouse tables (Trends, Funnels, etc.) receive"- " the same warnings as raw HogQL queries. Also carries access control"- " warnings when a system-table query filters out objects the user can't"- " access."- ),- )--class FunnelsQueryResponse(BaseModel):model_config = ConfigDict(extra="forbid",@@ -23766,59 +23617,7 @@ class QueryResponseAlternative63(BaseModel):)-class QueryResponseAlternative65(BaseModel):- model_config = ConfigDict(- extra="forbid",- )- columns: list | None = None- error: str | None = Field(- default=None,- description=(- "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise."- ),- )- hasMore: bool | None = None- hogql: str | None = Field(default=None, description="Generated HogQL query.")- limit: int | None = None- modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")- offset: int | None = None- query_status: QueryStatus | None = Field(- default=None,- description=("Query status indicates whether next to the provided data, a query is still running."),- )- resolved_compare_date_range: ResolvedDateRangeResponse | None = Field(- default=None,- description=("The resolved previous/comparison period date range, when comparing against another period"),- )- resolved_date_range: ResolvedDateRangeResponse | None = Field(- default=None, description="The date range used for the query"- )- results: FunnelCorrelationResult- timings: list[QueryTiming] | None = Field(- default=None,- description=("Measured timings for different parts of the query generation process"),- )- types: list | None = None- used_data_warehouse_sources: list[DataWarehouseSourceUsage] | None = Field(- default=None,- description=("Connector-synced data warehouse sources referenced by this query, if any."),- )- warnings: list[DataWarehouseSyncWarning | AccessControlFilterWarning] | None = Field(- default=None,- description=(- "Warnings about data warehouse sources referenced by the query whose"- " latest sync failed, is paused, hit a billing limit, or is otherwise"- " stale. Results may not reflect current source data. Accumulated"- " across every HogQL execution that contributes to this response — so"- " insights backed by warehouse tables (Trends, Funnels, etc.) receive"- " the same warnings as raw HogQL queries. Also carries access control"- " warnings when a system-table query filters out objects the user can't"- " access."- ),- )---class QueryResponseAlternative67(BaseModel):+class QueryResponseAlternative66(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -23870,7 +23669,7 @@ class QueryResponseAlternative67(BaseModel):)-class QueryResponseAlternative68(BaseModel):+class QueryResponseAlternative67(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -23922,7 +23721,7 @@ class QueryResponseAlternative68(BaseModel):)-class QueryResponseAlternative69(BaseModel):+class QueryResponseAlternative68(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -23970,7 +23769,7 @@ class QueryResponseAlternative69(BaseModel):)-class QueryResponseAlternative70(BaseModel):+class QueryResponseAlternative69(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -24017,7 +23816,7 @@ class QueryResponseAlternative70(BaseModel):)-class QueryResponseAlternative71(BaseModel):+class QueryResponseAlternative70(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -24064,7 +23863,7 @@ class QueryResponseAlternative71(BaseModel):)-class QueryResponseAlternative72(BaseModel):+class QueryResponseAlternative71(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -24117,7 +23916,7 @@ class QueryResponseAlternative72(BaseModel):)-class QueryResponseAlternative73(BaseModel):+class QueryResponseAlternative72(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -24168,7 +23967,7 @@ class QueryResponseAlternative73(BaseModel):)-class QueryResponseAlternative74(BaseModel):+class QueryResponseAlternative73(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -24219,7 +24018,7 @@ class QueryResponseAlternative74(BaseModel):)-class QueryResponseAlternative75(BaseModel):+class QueryResponseAlternative74(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -24270,7 +24069,7 @@ class QueryResponseAlternative75(BaseModel):)-class QueryResponseAlternative76(BaseModel):+class QueryResponseAlternative75(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -24321,7 +24120,7 @@ class QueryResponseAlternative76(BaseModel):)-class QueryResponseAlternative78(BaseModel):+class QueryResponseAlternative77(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -24371,7 +24170,7 @@ class QueryResponseAlternative78(BaseModel):)-class QueryResponseAlternative79(BaseModel):+class QueryResponseAlternative78(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -24421,7 +24220,7 @@ class QueryResponseAlternative79(BaseModel):)-class QueryResponseAlternative80(BaseModel):+class QueryResponseAlternative79(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -24468,7 +24267,7 @@ class QueryResponseAlternative80(BaseModel):)-class QueryResponseAlternative81(BaseModel):+class QueryResponseAlternative80(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -24519,7 +24318,7 @@ class QueryResponseAlternative81(BaseModel):)-class QueryResponseAlternative85(BaseModel):+class QueryResponseAlternative84(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -24566,7 +24365,7 @@ class QueryResponseAlternative85(BaseModel):)-class QueryResponseAlternative86(BaseModel):+class QueryResponseAlternative85(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -24613,7 +24412,7 @@ class QueryResponseAlternative86(BaseModel):)-class QueryResponseAlternative87(BaseModel):+class QueryResponseAlternative86(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -24670,7 +24469,7 @@ class QueryResponseAlternative87(BaseModel):)-class QueryResponseAlternative88(BaseModel):+class QueryResponseAlternative87(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -24725,7 +24524,7 @@ class QueryResponseAlternative88(BaseModel):)-class QueryResponseAlternative89(BaseModel):+class QueryResponseAlternative88(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -24772,7 +24571,7 @@ class QueryResponseAlternative89(BaseModel):)-class QueryResponseAlternative90(BaseModel):+class QueryResponseAlternative89(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -24824,7 +24623,7 @@ class QueryResponseAlternative90(BaseModel):)-class QueryResponseAlternative91(BaseModel):+class QueryResponseAlternative90(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -24871,7 +24670,7 @@ class QueryResponseAlternative91(BaseModel):)-class QueryResponseAlternative92(BaseModel):+class QueryResponseAlternative91(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -24918,7 +24717,7 @@ class QueryResponseAlternative92(BaseModel):)-class QueryResponseAlternative93(BaseModel):+class QueryResponseAlternative92(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -24965,7 +24764,7 @@ class QueryResponseAlternative93(BaseModel):)-class QueryResponseAlternative94(BaseModel):+class QueryResponseAlternative93(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -25012,7 +24811,7 @@ class QueryResponseAlternative94(BaseModel):)-class QueryResponseAlternative95(BaseModel):+class QueryResponseAlternative94(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -25063,7 +24862,7 @@ class QueryResponseAlternative95(BaseModel):)-class QueryResponseAlternative96(BaseModel):+class QueryResponseAlternative95(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -25110,7 +24909,7 @@ class QueryResponseAlternative96(BaseModel):)-class QueryResponseAlternative97(BaseModel):+class QueryResponseAlternative96(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -25157,7 +24956,7 @@ class QueryResponseAlternative97(BaseModel):)-class QueryResponseAlternative98(BaseModel):+class QueryResponseAlternative97(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -25204,7 +25003,7 @@ class QueryResponseAlternative98(BaseModel):)-class QueryResponseAlternative99(BaseModel):+class QueryResponseAlternative98(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -25251,7 +25050,7 @@ class QueryResponseAlternative99(BaseModel):)-class QueryResponseAlternative100(BaseModel):+class QueryResponseAlternative99(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -25301,7 +25100,7 @@ class QueryResponseAlternative100(BaseModel):)-class QueryResponseAlternative101(BaseModel):+class QueryResponseAlternative100(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -25348,7 +25147,7 @@ class QueryResponseAlternative101(BaseModel):)-class QueryResponseAlternative102(BaseModel):+class QueryResponseAlternative101(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -25410,7 +25209,7 @@ class QueryResponseAlternative102(BaseModel):)-class QueryResponseAlternative103(BaseModel):+class QueryResponseAlternative102(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -25457,7 +25256,7 @@ class QueryResponseAlternative103(BaseModel):)-class QueryResponseAlternative104(BaseModel):+class QueryResponseAlternative103(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -25504,7 +25303,7 @@ class QueryResponseAlternative104(BaseModel):)-class QueryResponseAlternative105(BaseModel):+class QueryResponseAlternative104(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -25551,7 +25350,7 @@ class QueryResponseAlternative105(BaseModel):)-class QueryResponseAlternative106(BaseModel):+class QueryResponseAlternative105(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -25598,7 +25397,7 @@ class QueryResponseAlternative106(BaseModel):)-class QueryResponseAlternative107(BaseModel):+class QueryResponseAlternative106(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -25645,7 +25444,7 @@ class QueryResponseAlternative107(BaseModel):)-class QueryResponseAlternative108(BaseModel):+class QueryResponseAlternative107(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -25692,7 +25491,7 @@ class QueryResponseAlternative108(BaseModel):)-class QueryResponseAlternative109(BaseModel):+class QueryResponseAlternative108(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -25739,7 +25538,7 @@ class QueryResponseAlternative109(BaseModel):)-class QueryResponseAlternative110(BaseModel):+class QueryResponseAlternative109(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -25787,7 +25586,7 @@ class QueryResponseAlternative110(BaseModel):)-class QueryResponseAlternative111(BaseModel):+class QueryResponseAlternative110(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -32045,7 +31844,7 @@ class PathsV2ActorsQuery(BaseModel):version: float | None = Field(default=None, description="version of the node, used for schema migrations")-class QueryResponseAlternative66(BaseModel):+class QueryResponseAlternative65(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -32478,7 +32277,7 @@ class QueryResponseAlternative(| QueryResponseAlternative78| QueryResponseAlternative79| QueryResponseAlternative80- | QueryResponseAlternative81+ | QueryResponseAlternative83| QueryResponseAlternative84| QueryResponseAlternative85| QueryResponseAlternative86@@ -32506,7 +32305,6 @@ class QueryResponseAlternative(| QueryResponseAlternative108| QueryResponseAlternative109| QueryResponseAlternative110- | QueryResponseAlternative111]):root: (@@ -32589,7 +32387,7 @@ class QueryResponseAlternative(| QueryResponseAlternative78| QueryResponseAlternative79| QueryResponseAlternative80- | QueryResponseAlternative81+ | QueryResponseAlternative83| QueryResponseAlternative84| QueryResponseAlternative85| QueryResponseAlternative86@@ -32617,7 +32415,6 @@ class QueryResponseAlternative(| QueryResponseAlternative108| QueryResponseAlternative109| QueryResponseAlternative110- | QueryResponseAlternative111)@@ -32955,22 +32752,6 @@ class ExperimentActorsQuery(BaseModel):version: float | None = Field(default=None, description="version of the node, used for schema migrations")-class FunnelCorrelationQuery(BaseModel):- model_config = ConfigDict(- extra="forbid",- )- funnelCorrelationEventExcludePropertyNames: list[str] | None = None- funnelCorrelationEventNames: list[str] | None = None- funnelCorrelationExcludeEventNames: list[str] | None = None- funnelCorrelationExcludeNames: list[str] | None = None- funnelCorrelationNames: list[str] | None = None- funnelCorrelationType: FunnelCorrelationResultsType- kind: Literal["FunnelCorrelationQuery"] = "FunnelCorrelationQuery"- response: FunnelCorrelationResponse | None = None- source: FunnelsActorsQuery- version: float | None = Field(default=None, description="version of the node, used for schema migrations")--class InsightVizNode(BaseModel):model_config = ConfigDict(extra="forbid",@@ -33086,22 +32867,6 @@ class DocumentArtifactContent(BaseModel):blocks: list[MarkdownBlock | VisualizationBlock | SessionReplayBlock | LoadingBlock | ErrorBlock]-class FunnelCorrelationActorsQuery(BaseModel):- model_config = ConfigDict(- extra="forbid",- )- funnelCorrelationPersonConverted: bool | None = None- funnelCorrelationPersonEntity: EventsNode | ActionsNode | DataWarehouseNode | None = None- funnelCorrelationPropertyValues: list[AnyPropertyFilterDiscriminated] | None = None- includeRecordings: bool | None = None- kind: Literal["FunnelCorrelationActorsQuery"] = "FunnelCorrelationActorsQuery"- modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")- response: ActorsQueryResponse | None = None- source: FunnelCorrelationQuery- tags: QueryLogTags | None = None- version: float | None = Field(default=None, description="version of the node, used for schema migrations")--class InsightActorsQuery(BaseModel):model_config = ConfigDict(extra="forbid",@@ -33140,14 +32905,7 @@ class InsightActorsQueryOptions(BaseModel):)kind: Literal["InsightActorsQueryOptions"] = "InsightActorsQueryOptions"response: InsightActorsQueryOptionsResponse | None = None- source: (- InsightActorsQuery- | FunnelsActorsQuery- | FunnelCorrelationActorsQuery- | StickinessActorsQuery- | ExperimentActorsQuery- | PathsV2ActorsQuery- )+ source: InsightActorsQuery | FunnelsActorsQuery | StickinessActorsQuery | ExperimentActorsQuery | PathsV2ActorsQueryversion: float | None = Field(default=None, description="version of the node, used for schema migrations")@@ -33261,7 +33019,6 @@ class ActorsQuery(BaseModel):source: (InsightActorsQuery| FunnelsActorsQuery- | FunnelCorrelationActorsQuery| ExperimentActorsQuery| StickinessActorsQuery| PathsV2ActorsQuery@@ -33828,7 +33585,6 @@ class MaxInsightContext(BaseModel):| PathsV2Query| StickinessQuery| LifecycleQuery- | FunnelCorrelationQuery| DatabaseSchemaQuery| RecordingsQuery| LogsQuery@@ -33971,7 +33727,6 @@ class QueryRequest(BaseModel):| PathsV2Query| StickinessQuery| LifecycleQuery- | FunnelCorrelationQuery| DatabaseSchemaQuery| RecordingsQuery| LogsQuery@@ -34107,7 +33862,6 @@ class QuerySchemaRoot(| PathsV2Query| StickinessQuery| LifecycleQuery- | FunnelCorrelationQuery| DatabaseSchemaQuery| RecordingsQuery| LogsQuery@@ -34213,7 +33967,6 @@ class QuerySchemaRoot(| PathsV2Query| StickinessQuery| LifecycleQuery- | FunnelCorrelationQuery| DatabaseSchemaQuery| RecordingsQuery| LogsQuery@@ -34324,7 +34077,6 @@ class QueryUpgradeRequest(BaseModel):| PathsV2Query| StickinessQuery| LifecycleQuery- | FunnelCorrelationQuery| DatabaseSchemaQuery| RecordingsQuery| LogsQuery@@ -34435,7 +34187,6 @@ class QueryUpgradeResponse(BaseModel):| PathsV2Query| StickinessQuery| LifecycleQuery- | FunnelCorrelationQuery| DatabaseSchemaQuery| RecordingsQuery| LogsQuery@@ -34591,7 +34342,6 @@ class VisualizationArtifactContent(BaseModel):| PathsV2Query| StickinessQuery| LifecycleQuery- | FunnelCorrelationQuery| DatabaseSchemaQuery| RecordingsQuery| LogsQuerydiff --git a/posthog/schema_enums.py b/posthog/schema_enums.pyindex 625229dff709..71e1fef5a374 100644--- a/posthog/schema_enums.py+++ b/posthog/schema_enums.py@@ -1351,11 +1351,6 @@ class EvaluationRuntime(StrEnum):SENTIMENT = "sentiment"-class CorrelationType(StrEnum):- SUCCESS = "success"- FAILURE = "failure"--class HrefMatching(Enum):CONTAINS = "contains"EXACT = "exact"@@ -1645,12 +1640,6 @@ class FunnelConversionWindowTimeUnit(StrEnum):MONTH = "month"-class FunnelCorrelationResultsType(StrEnum):- EVENTS = "events"- PROPERTIES = "properties"- EVENT_WITH_PROPERTIES = "event_with_properties"--class FunnelLayout(StrEnum):HORIZONTAL = "horizontal"VERTICAL = "vertical"@@ -2355,7 +2344,6 @@ class NodeKind(StrEnum):ACTORS_QUERY = "ActorsQuery"GROUPS_QUERY = "GroupsQuery"FUNNELS_ACTORS_QUERY = "FunnelsActorsQuery"- FUNNEL_CORRELATION_ACTORS_QUERY = "FunnelCorrelationActorsQuery"PATHS_V2_ACTORS_QUERY = "PathsV2ActorsQuery"SESSIONS_TIMELINE_QUERY = "SessionsTimelineQuery"RECORDINGS_QUERY = "RecordingsQuery"@@ -2393,7 +2381,6 @@ class NodeKind(StrEnum):LIFECYCLE_QUERY = "LifecycleQuery"INSIGHT_ACTORS_QUERY = "InsightActorsQuery"INSIGHT_ACTORS_QUERY_OPTIONS = "InsightActorsQueryOptions"- FUNNEL_CORRELATION_QUERY = "FunnelCorrelationQuery"WEB_OVERVIEW_QUERY = "WebOverviewQuery"WEB_STATS_TABLE_QUERY = "WebStatsTableQuery"WEB_EXTERNAL_CLICKS_TABLE_QUERY = "WebExternalClicksTableQuery"diff --git a/posthog/session_recordings/test/__snapshots__/test_session_recording_playlist.ambr b/posthog/session_recordings/test/__snapshots__/test_session_recording_playlist.ambrindex 72337f8b9d08..fde5bfc2b857 100644--- a/posthog/session_recordings/test/__snapshots__/test_session_recording_playlist.ambr+++ b/posthog/session_recordings/test/__snapshots__/test_session_recording_playlist.ambr@@ -151,7 +151,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -480,7 +479,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -804,7 +802,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -1454,7 +1451,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -1797,7 +1793,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -2072,7 +2067,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",diff --git a/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr b/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambrindex 75e984d2e344..1eb44a9a07d5 100644--- a/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr+++ b/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr@@ -347,7 +347,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -1009,7 +1008,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -1668,7 +1666,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -2327,7 +2324,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -2989,7 +2985,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -3651,7 +3646,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -4313,7 +4307,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -4900,7 +4893,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -5594,7 +5586,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -6323,7 +6314,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -7095,7 +7085,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -7506,7 +7495,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -7917,7 +7905,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -8642,7 +8629,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -9225,7 +9211,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -9963,7 +9948,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -10637,7 +10621,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -11424,7 +11407,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",diff --git a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambrindex 7e5056def0db..256d1841491a 100644--- a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr+++ b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr@@ -249,7 +249,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -600,7 +599,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -736,7 +734,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -1158,7 +1155,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -1529,7 +1525,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -1680,7 +1675,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",diff --git a/posthog/test/repo_invariants/dataclass_frozen_baseline.txt b/posthog/test/repo_invariants/dataclass_frozen_baseline.txtindex 1677e2dbaffc..d395a919d1d2 100644--- a/posthog/test/repo_invariants/dataclass_frozen_baseline.txt+++ b/posthog/test/repo_invariants/dataclass_frozen_baseline.txt@@ -1306,7 +1306,6 @@2 products/marketing_analytics/backend/services/campaign_field_suggester.py2 products/marketing_analytics/backend/services/event_suggestions.py2 products/notebooks/backend/collab.py-2 products/product_analytics/backend/hogql_queries/funnels/funnel_correlation_query_runner.py2 products/product_analytics/backend/hogql_queries/stickiness/test/test_stickiness_query_runner.py2 products/review_hog/backend/reviewer/progress.py2 products/review_hog/backend/reviewer/tools/select_perspectives.pydiff --git a/posthog/types.py b/posthog/types.pyindex a93b272ead0c..754e4cac6e39 100644--- a/posthog/types.py+++ b/posthog/types.py@@ -17,7 +17,6 @@ from posthog.schema import (ExperimentActorsQuery,FeaturePropertyFilter,FlagPropertyFilter,- FunnelCorrelationActorsQuery,FunnelExclusionActionsNode,FunnelExclusionEventsNode,FunnelsActorsQuery,@@ -55,7 +54,6 @@ type InsightQueryNode = Union[type InsightActorsQueryNode = Union[InsightActorsQuery,FunnelsActorsQuery,- FunnelCorrelationActorsQuery,StickinessActorsQuery,ExperimentActorsQuery,PathsV2ActorsQuery,diff --git a/products/actions/backend/api/test/__snapshots__/test_action.ambr b/products/actions/backend/api/test/__snapshots__/test_action.ambrindex 9c3dc44a39a9..7b7ef4f794ed 100644--- a/products/actions/backend/api/test/__snapshots__/test_action.ambr+++ b/products/actions/backend/api/test/__snapshots__/test_action.ambr@@ -177,7 +177,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -659,7 +658,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -798,7 +796,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",diff --git a/products/annotations/backend/api/test/__snapshots__/test_annotation.ambr b/products/annotations/backend/api/test/__snapshots__/test_annotation.ambrindex 06a5f0d2fd08..fd6d94c089c1 100644--- a/products/annotations/backend/api/test/__snapshots__/test_annotation.ambr+++ b/products/annotations/backend/api/test/__snapshots__/test_annotation.ambr@@ -177,7 +177,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -700,7 +699,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -839,7 +837,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -1362,7 +1359,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",diff --git a/products/canvas/frontend/host/canvasDataBridge.ts b/products/canvas/frontend/host/canvasDataBridge.tsindex 05c33bfe0098..d7faffa35bc7 100644--- a/products/canvas/frontend/host/canvasDataBridge.ts+++ b/products/canvas/frontend/host/canvasDataBridge.ts@@ -87,7 +87,6 @@ const UNTAGGABLE_QUERY_KINDS = new Set<string>([NodeKind.DataVisualizationNode,NodeKind.BIVisualizationNode,NodeKind.InsightActorsQueryOptions,- NodeKind.FunnelCorrelationQuery,NodeKind.WebAnalyticsExternalSummaryQuery,])diff --git a/products/dashboards/frontend/generated/api.schemas.ts b/products/dashboards/frontend/generated/api.schemas.tsindex 49a7c89c68fa..d6116a9de74c 100644--- a/products/dashboards/frontend/generated/api.schemas.ts+++ b/products/dashboards/frontend/generated/api.schemas.ts@@ -6168,126 +6168,6 @@ export interface FunnelsActorsQueryApi {version?: number | null}-export type FunnelCorrelationResultsTypeApi =- (typeof FunnelCorrelationResultsTypeApi)[keyof typeof FunnelCorrelationResultsTypeApi]--export const FunnelCorrelationResultsTypeApi = {- Events: 'events',- Properties: 'properties',- EventWithProperties: 'event_with_properties',-} as const--export type CorrelationTypeApi = (typeof CorrelationTypeApi)[keyof typeof CorrelationTypeApi]--export const CorrelationTypeApi = {- Success: 'success',- Failure: 'failure',-} as const--export type EventDefinitionApiProperties = { [key: string]: unknown }--export interface EventDefinitionApi {- elements: unknown[]- event: string- properties: EventDefinitionApiProperties-}--export interface EventOddsRatioSerializedApi {- correlation_type: CorrelationTypeApi- event: EventDefinitionApi- failure_count: number- odds_ratio: number- success_count: number-}--export interface FunnelCorrelationResultApi {- events: EventOddsRatioSerializedApi[]- skewed: boolean-}--export interface FunnelCorrelationResponseApi {- columns?: unknown[] | null- /** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */- error?: string | null- hasMore?: boolean | null- /** Generated HogQL query. */- hogql?: string | null- limit?: number | null- /** Modifiers used when performing the query */- modifiers?: HogQLQueryModifiersApi | null- offset?: number | null- /** Query status indicates whether next to the provided data, a query is still running. */- query_status?: QueryStatusApi | null- /** The resolved previous/comparison period date range, when comparing against another period */- resolved_compare_date_range?: ResolvedDateRangeResponseApi | null- /** The date range used for the query */- resolved_date_range?: ResolvedDateRangeResponseApi | null- results: FunnelCorrelationResultApi- /** Measured timings for different parts of the query generation process */- timings?: QueryTimingApi[] | null- types?: unknown[] | null- /** Connector-synced data warehouse sources referenced by this query, if any. */- used_data_warehouse_sources?: DataWarehouseSourceUsageApi[] | null- /** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. Also carries access control warnings when a system-table query filters out objects the user can't access. */- warnings?: (DataWarehouseSyncWarningApi | AccessControlFilterWarningApi)[] | null-}--export interface FunnelCorrelationQueryApi {- funnelCorrelationEventExcludePropertyNames?: string[] | null- funnelCorrelationEventNames?: string[] | null- funnelCorrelationExcludeEventNames?: string[] | null- funnelCorrelationExcludeNames?: string[] | null- funnelCorrelationNames?: string[] | null- funnelCorrelationType: FunnelCorrelationResultsTypeApi- kind?: 'FunnelCorrelationQuery'- response?: FunnelCorrelationResponseApi | null- source: FunnelsActorsQueryApi- /** version of the node, used for schema migrations */- version?: number | null-}--export interface FunnelCorrelationActorsQueryApi {- funnelCorrelationPersonConverted?: boolean | null- funnelCorrelationPersonEntity?: EventsNodeApi | ActionsNodeApi | DataWarehouseNodeApi | null- funnelCorrelationPropertyValues?:- | (- | EventPropertyFilterApi- | PersonPropertyFilterApi- | PersonMetadataPropertyFilterApi- | ElementPropertyFilterApi- | EventMetadataPropertyFilterApi- | SessionPropertyFilterApi- | CohortPropertyFilterApi- | RecordingPropertyFilterApi- | LogEntryPropertyFilterApi- | GroupPropertyFilterApi- | FeaturePropertyFilterApi- | FlagPropertyFilterApi- | HogQLPropertyFilterApi- | EmptyPropertyFilterApi- | DataWarehousePropertyFilterApi- | DataWarehousePersonPropertyFilterApi- | ErrorTrackingIssueFilterApi- | LogPropertyFilterApi- | MetricPropertyFilterApi- | SpanPropertyFilterApi- | RevenueAnalyticsPropertyFilterApi- | AccountCustomPropertyFilterApi- | WorkflowVariablePropertyFilterApi- | BehavioralPropertyFilterApi- )[]- | null- includeRecordings?: boolean | null- kind?: 'FunnelCorrelationActorsQuery'- /** Modifiers used when performing the query */- modifiers?: HogQLQueryModifiersApi | null- response?: ActorsQueryResponseApi | null- source: FunnelCorrelationQueryApi- tags?: QueryLogTagsApi | null- /** version of the node, used for schema migrations */- version?: number | null-}-export type ExperimentEventExposureConfigApiResponse = { [key: string]: unknown } | nullexport interface ExperimentEventExposureConfigApi {@@ -6957,7 +6837,6 @@ export interface ActorsQueryApi {source?:| InsightActorsQueryApi| FunnelsActorsQueryApi- | FunnelCorrelationActorsQueryApi| ExperimentActorsQueryApi| StickinessActorsQueryApi| PathsV2ActorsQueryApidiff --git a/products/desktop/packages/api-client/src/generated.ts b/products/desktop/packages/api-client/src/generated.tsindex 905c78bc8d53..0c178c3f6802 100644--- a/products/desktop/packages/api-client/src/generated.ts+++ b/products/desktop/packages/api-client/src/generated.ts@@ -3690,107 +3690,6 @@ export namespace Schemas {tags?: (QueryLogTags | null) | undefined;version?: (number | null) | undefined;};- export type FunnelCorrelationResultsType =- | "events"- | "properties"- | "event_with_properties";- export type CorrelationType = "success" | "failure";- export type EventDefinition = {- elements: Array<unknown>;- event: string;- properties: Record<string, unknown>;- };- export type EventOddsRatioSerialized = {- correlation_type: CorrelationType;- event: EventDefinition;- failure_count: number;- odds_ratio: number;- success_count: number;- };- export type FunnelCorrelationResult = {- events: Array<EventOddsRatioSerialized>;- skewed: boolean;- };- export type FunnelCorrelationResponse = {- columns?: (Array<unknown> | null) | undefined;- error?: (string | null) | undefined;- hasMore?: (boolean | null) | undefined;- hogql?: (string | null) | undefined;- limit?: (number | null) | undefined;- modifiers?: (HogQLQueryModifiers | null) | undefined;- offset?: (number | null) | undefined;- query_status?: (QueryStatus | null) | undefined;- resolved_compare_date_range?:- | (ResolvedDateRangeResponse | null)- | undefined;- resolved_date_range?: (ResolvedDateRangeResponse | null) | undefined;- results: FunnelCorrelationResult;- timings?: (Array<QueryTiming> | null) | undefined;- types?: (Array<unknown> | null) | undefined;- used_data_warehouse_sources?:- | (Array<DataWarehouseSourceUsage> | null)- | undefined;- warnings?:- | (Array<- DataWarehouseSyncWarning | AccessControlFilterWarning- > | null)- | undefined;- };- export type FunnelCorrelationQuery = {- funnelCorrelationEventExcludePropertyNames?:- | (Array<string> | null)- | undefined;- funnelCorrelationEventNames?: (Array<string> | null) | undefined;- funnelCorrelationExcludeEventNames?: (Array<string> | null) | undefined;- funnelCorrelationExcludeNames?: (Array<string> | null) | undefined;- funnelCorrelationNames?: (Array<string> | null) | undefined;- funnelCorrelationType: FunnelCorrelationResultsType;- kind?: string | undefined;- response?: (FunnelCorrelationResponse | null) | undefined;- source: FunnelsActorsQuery;- version?: (number | null) | undefined;- };- export type FunnelCorrelationActorsQuery = {- funnelCorrelationPersonConverted?: (boolean | null) | undefined;- funnelCorrelationPersonEntity?:- | (EventsNode | ActionsNode | DataWarehouseNode | null)- | undefined;- funnelCorrelationPropertyValues?:- | (Array<- | EventPropertyFilter- | PersonPropertyFilter- | PersonMetadataPropertyFilter- | ElementPropertyFilter- | EventMetadataPropertyFilter- | SessionPropertyFilter- | CohortPropertyFilter- | RecordingPropertyFilter- | LogEntryPropertyFilter- | GroupPropertyFilter- | FeaturePropertyFilter- | FlagPropertyFilter- | HogQLPropertyFilter- | EmptyPropertyFilter- | DataWarehousePropertyFilter- | DataWarehousePersonPropertyFilter- | ErrorTrackingIssueFilter- | LogPropertyFilter- | MetricPropertyFilter- | SpanPropertyFilter- | RevenueAnalyticsPropertyFilter- | AccountCustomPropertyFilter- | WorkflowVariablePropertyFilter- | BehavioralPropertyFilter- > | null)- | undefined;- includeRecordings?: (boolean | null) | undefined;- kind?: string | undefined;- modifiers?: (HogQLQueryModifiers | null) | undefined;- response?: (ActorsQueryResponse | null) | undefined;- source: FunnelCorrelationQuery;- tags?: (QueryLogTags | null) | undefined;- version?: (number | null) | undefined;- };export type ExperimentEventExposureConfig = {event: string;kind?: string | undefined;@@ -4441,7 +4340,6 @@ export namespace Schemas {source:| InsightActorsQuery| FunnelsActorsQuery- | FunnelCorrelationActorsQuery| ExperimentActorsQuery| StickinessActorsQuery| PathsV2ActorsQuery@@ -20015,13 +19913,6 @@ export namespace Schemas {* onto /api/projects/ never loses a field.*/person_display_name_properties?: (Array<string> | null) | undefined;- /**- * A project and its settings, including the settings that live on its passthrough Team.- *- * This shape is a superset of TeamSerializer's, so a request rewritten from /api/environments/- * onto /api/projects/ never loses a field.- */- correlation_config?: unknown | undefined;/*** A project and its settings, including the settings that live on its passthrough Team.*diff --git a/products/early_access_features/backend/test/__snapshots__/test_early_access_feature.ambr b/products/early_access_features/backend/test/__snapshots__/test_early_access_feature.ambrindex 67cfc2b48b92..d6286d5b8ad7 100644--- a/products/early_access_features/backend/test/__snapshots__/test_early_access_feature.ambr+++ b/products/early_access_features/backend/test/__snapshots__/test_early_access_feature.ambr@@ -129,7 +129,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -640,7 +639,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -829,7 +827,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",diff --git a/products/feature_flags/backend/api/test/__snapshots__/test_feature_flag.ambr b/products/feature_flags/backend/api/test/__snapshots__/test_feature_flag.ambrindex 0e771c764090..72644cada32e 100644--- a/products/feature_flags/backend/api/test/__snapshots__/test_feature_flag.ambr+++ b/products/feature_flags/backend/api/test/__snapshots__/test_feature_flag.ambr@@ -890,7 +890,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -1150,7 +1149,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -1289,7 +1287,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -1404,7 +1401,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -1588,7 +1584,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",diff --git a/products/feature_flags/backend/api/test/__snapshots__/test_organization_feature_flag.ambr b/products/feature_flags/backend/api/test/__snapshots__/test_organization_feature_flag.ambrindex dd8ce45e3d54..a6d93d281e93 100644--- a/products/feature_flags/backend/api/test/__snapshots__/test_organization_feature_flag.ambr+++ b/products/feature_flags/backend/api/test/__snapshots__/test_organization_feature_flag.ambr@@ -329,7 +329,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -1154,7 +1153,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -1308,7 +1306,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -1996,7 +1993,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",diff --git a/products/product_analytics/backend/facade/queries.py b/products/product_analytics/backend/facade/queries.pyindex 0833adc8038f..81fe0ff442e8 100644--- a/products/product_analytics/backend/facade/queries.py+++ b/products/product_analytics/backend/facade/queries.py@@ -26,7 +26,6 @@ _LAZY = {"BoxPlotTrendsQueryRunner": "trends.boxplot_trends_query_runner","CalendarHeatmapQueryRunner": "trends.calendar_heatmap_query_runner","CalendarHeatmapTrendsQueryRunner": "trends.calendar_heatmap_trends_query_runner",- "FunnelCorrelationQueryRunner": "funnels.funnel_correlation_query_runner","FunnelsQueryRunner": "funnels.funnels_query_runner","LifecycleQueryRunner": "lifecycle.lifecycle_query_runner","PathsQueryRunner": "paths.paths_query_runner",diff --git a/products/product_analytics/backend/hogql_queries/funnels/funnel.py b/products/product_analytics/backend/hogql_queries/funnels/funnel.pyindex f630b651e46c..3ef6b4c1281a 100644--- a/products/product_analytics/backend/hogql_queries/funnels/funnel.py+++ b/products/product_analytics/backend/hogql_queries/funnels/funnel.py@@ -429,7 +429,6 @@ class FunnelUDF(FunnelUDFMixin, FunnelBase):elif self.context.includeTimestamp:return [parse_expr(f"matched_events_array[{target_step}][1].1 AS timestamp"),- # Correlation code expects null if user hasn't made it to this stepparse_expr(f"nullIf(matched_events_array[{final_step}][1].1, 0) AS final_timestamp"),parse_expr(f"matched_events_array[{first_step}][1].1 as first_timestamp"),]@@ -440,7 +439,7 @@ class FunnelUDF(FunnelUDFMixin, FunnelBase):self,extra_fields: Optional[list[str]] = None,) -> ast.SelectQuery:- # Insight actors and correlation queries build this directly, skipping the+ # Insight actors queries build this directly, skipping the# FunnelsQueryRunner validatorsvalidate_max_funnel_steps(self.context.max_steps)diff --git a/products/product_analytics/backend/hogql_queries/funnels/funnel_correlation_query_runner.py b/products/product_analytics/backend/hogql_queries/funnels/funnel_correlation_query_runner.pydeleted file mode 100644index ed07de84a2c7..000000000000--- a/products/product_analytics/backend/hogql_queries/funnels/funnel_correlation_query_runner.py+++ /dev/null@@ -1,1062 +0,0 @@-import dataclasses-from typing import Any, Literal, Optional, TypedDict, cast--from rest_framework.exceptions import ValidationError--from posthog.schema import (- ActionsNode,- CachedFunnelCorrelationResponse,- CorrelationType,- EventDefinition,- EventOddsRatioSerialized,- EventsNode,- FunnelCorrelationActorsQuery,- FunnelCorrelationQuery,- FunnelCorrelationResponse,- FunnelCorrelationResult,- FunnelCorrelationResultsType,- FunnelsActorsQuery,- FunnelsDataWarehouseNode,- FunnelsQuery,- HogQLQueryModifiers,- HogQLQueryResponse,-)--from posthog.hogql import ast-from posthog.hogql.constants import LimitContext-from posthog.hogql.parser import parse_expr, parse_select-from posthog.hogql.property import property_to_expr-from posthog.hogql.query import execute_hogql_query-from posthog.hogql.timings import HogQLTimings--from posthog.constants import AUTOCAPTURE_EVENT-from posthog.dataclasses import frozen-from posthog.hogql_queries.query_runner import AnalyticsQueryRunner-from posthog.hogql_queries.utils.query_date_range import QueryDateRange-from posthog.hogql_queries.utils.sampling import correct_result_for_sampling-from posthog.models import Team-from posthog.models.element.element import chain_to_elements-from posthog.models.event.new_events_schema import use_new_events_schema-from posthog.models.event.util import ElementSerializer-from posthog.models.property.util import get_property_string_expr-from posthog.models.user import User--from products.actions.backend.models.action import Action-from products.product_analytics.backend.hogql_queries.funnels import FunnelUDF-from products.product_analytics.backend.hogql_queries.funnels.funnel_query_context import FunnelQueryContext-from products.product_analytics.backend.hogql_queries.funnels.utils import funnel_window_interval_unit_to_sql---class EventOddsRatio(TypedDict):- event: str-- success_count: int- failure_count: int-- odds_ratio: float- correlation_type: Literal["success", "failure"]---class EventStats:- success_count: int- failure_count: int---class EventContingencyTable:- """- Represents a contingency table for a single event. Note that this isn't a- complete contingency table, but rather only includes totals for- failure/success as opposed to including the number of successes for cases- that a persons _doesn't_ visit an event.- """-- event: str- visited: EventStats-- success_total: int- failure_total: int---PRIOR_COUNT = 1---@frozen-class CorrelationCalculation:- events: list[EventOddsRatio]- skewed_totals: bool- hogql: str- response: HogQLQueryResponse---class FunnelCorrelationQueryRunner(AnalyticsQueryRunner[FunnelCorrelationResponse]):- TOTAL_IDENTIFIER = "Total_Values_In_Query"- ELEMENTS_DIVIDER = "__~~__"- AUTOCAPTURE_EVENT_TYPE = "$event_type"- MIN_PERSON_COUNT = 25- MIN_PERSON_PERCENTAGE = 0.02-- query: FunnelCorrelationQuery- cached_response: CachedFunnelCorrelationResponse-- funnels_query: FunnelsQuery- actors_query: FunnelsActorsQuery- correlation_actors_query: Optional[FunnelCorrelationActorsQuery]-- _funnel_actors_generator: FunnelUDF-- def __init__(- self,- query: FunnelCorrelationQuery | dict[str, Any],- team: Team,- timings: Optional[HogQLTimings] = None,- modifiers: Optional[HogQLQueryModifiers] = None,- limit_context: Optional[LimitContext] = None,- user: Optional[User] = None,- ):- super().__init__(query, team=team, timings=timings, modifiers=modifiers, limit_context=limit_context, user=user)- self._use_new_events_schema = use_new_events_schema(team.pk, self.modifiers)- self.actors_query = self.query.source- self.funnels_query = self.actors_query.source-- # Funnel Step by default set to 1, to give us all people who entered the funnel- if self.actors_query.funnelStep is None:- self.actors_query.funnelStep = 1-- self.context = FunnelQueryContext(- query=self.funnels_query,- team=team,- timings=timings,- modifiers=modifiers,- limit_context=limit_context,- user=user,- # NOTE: we want to include the latest timestamp of the `target_step`,- # from this we can deduce if the person reached the end of the funnel,- # i.e. successful- include_timestamp=True,- # NOTE: we don't need these as we have all the information we need to- # deduce if the person was successful or not- include_preceding_timestamp=False,- include_properties=self.properties_to_include,- # NOTE: we always use the final matching event for the recording because this- # is the the right event for both drop off and successful funnels- include_final_matching_events=self.actors_query.includeRecordings,- )- self.context.actorsQuery = self.actors_query-- # Used for generating the funnel persons cte- self._funnel_actors_generator = FunnelUDF(context=self.context)-- def _calculate(self) -> FunnelCorrelationResponse:- """- Funnel Correlation queries take as input the same as the funnel query,- and returns the correlation of person events with a person successfully- getting to the end of the funnel. We use Odds Ratios as the correlation- metric. See https://en.wikipedia.org/wiki/Odds_ratio for more details.-- Roughly speaking, to calculate the odds ratio, we build a contingency- table https://en.wikipedia.org/wiki/Contingency_table for each- dimension, then calculate the odds ratio for each.-- For example, take for simplicity the cohort of all people, and the- success criteria of having a "signed up" event. First we would build a- contingency table like:-- | | success | failure | total |- | -----------------: | :-----: | :-----: | :---: |- | watched video | 5 | 1 | 6 |- | didn't watch video | 2 | 10 | 12 |--- Then the odds that a person signs up given they watched the video is 5 /- 1.-- And the odds that a person signs up given they didn't watch the video is- 2 / 10.-- So we say the odds ratio is 5 / 1 over 2 / 10 = 25 . The further away the- odds ratio is from 1, the greater the correlation.-- Requirements:-- - Intitially we only need to consider the names of events that a cohort- person has emitted. So we explicitly are not interested in e.g.- correlating properties, although this will be a follow-up.-- Non-functional requirements:-- - there can be perhaps millions of people in a cohort, so we should- consider this when writing the algorithm. e.g. we should probably- avoid pulling all people into across the wire.- - there can be an order of magnitude more events than people, so we- should avoid pulling all events across the wire.- - there may be a large but not huge number of distinct events, let's say- 100 different names for events. We should avoid n+1 queries for the- event names dimension-- Contincency tables are something we can pull out of the db, so we can- have a query that:-- 1. filters people by the cohort criteria- 2. groups these people by the success criteria- 3. groups people by our criterion with which we want to test- correlation, e.g. "watched video"-- ---- For each event a person that started going through the funnel, gets stats- for how many of these users are sucessful and how many are unsuccessful.-- It's a partial table as it doesn't include numbers of the negation of the- event, but does include the total success/failure numbers, which is enough- for us to calculate the odds ratio.- """- if not self.funnels_query.series:- return FunnelCorrelationResponse(- results=FunnelCorrelationResult(events=[], skewed=False), modifiers=self.modifiers- )-- if self._uses_data_warehouse_series():- # Correlation joins the events table onto the funnel actors on person_id, but a- # data-warehouse funnel aggregates actors by a warehouse column (coerced to a- # string id), so there is nothing on the events table to correlate against and- # the join would fail on a UUID/String type mismatch. Return empty rather than- # raising — correlation is a secondary panel and shouldn't crash the insight.- return FunnelCorrelationResponse(- results=FunnelCorrelationResult(events=[], skewed=False), modifiers=self.modifiers- )-- calculation = self._calculate_internal()-- return FunnelCorrelationResponse(- results=FunnelCorrelationResult(- events=[self.serialize_event_odds_ratio(odds_ratio=odds_ratio) for odds_ratio in calculation.events],- skewed=calculation.skewed_totals,- ),- timings=calculation.response.timings,- hogql=calculation.hogql,- columns=calculation.response.columns,- types=calculation.response.types,- hasMore=calculation.response.hasMore,- limit=calculation.response.limit,- offset=calculation.response.offset,- modifiers=self.modifiers,- )-- def _calculate_internal(self) -> CorrelationCalculation:- query = self.to_query()-- hogql = self.response_hogql(query)-- response = execute_hogql_query(- query_type="FunnelsQuery",- query=query,- team=self.team,- user=self.user,- context=self.build_hogql_context(use_new_events_schema=self._use_new_events_schema),- timings=self.timings,- modifiers=self.modifiers,- limit_context=self.limit_context,- )- if not response.results:- # An empty funnel yields no rows for the property/event-property correlation- # queries. Nothing to correlate — return empty rather than raising.- return CorrelationCalculation(events=[], skewed_totals=True, hogql=hogql, response=response)-- # Get the total success/failure counts from the results- results = [result for result in response.results if result[0] != self.TOTAL_IDENTIFIER]- totals_row = next(- (result for result in response.results if result[0] == self.TOTAL_IDENTIFIER),- None,- )- if totals_row is None:- # No totals row means the funnel matched no actors — the property and- # event-property correlation queries arrayJoin over the actors CTE, so an empty- # funnel produces no rows at all (including no totals). Nothing to correlate.- return CorrelationCalculation(events=[], skewed_totals=True, hogql=hogql, response=response)- _, success_total, failure_total = totals_row-- # Add a little structure, and keep it close to the query definition so it's- # obvious what's going on with result indices.- event_contingency_tables = [- EventContingencyTable(- event=result[0],- visited=EventStats(success_count=result[1], failure_count=result[2]),- success_total=success_total,- failure_total=failure_total,- )- for result in results- ]-- success_total = int(correct_result_for_sampling(success_total, self.funnels_query.samplingFactor))- failure_total = int(correct_result_for_sampling(failure_total, self.funnels_query.samplingFactor))-- if not success_total or not failure_total:- return CorrelationCalculation(events=[], skewed_totals=True, hogql=hogql, response=response)-- skewed_totals = False-- # If the ratio is greater than 1:10, then we have a skewed result, so we should- # warn the user.- if success_total / failure_total > 10 or failure_total / success_total > 10:- skewed_totals = True-- odds_ratios = [- get_entity_odds_ratio(event_stats, PRIOR_COUNT)- for event_stats in event_contingency_tables- if not self.are_results_insignificant(event_stats)- ]-- positively_correlated_events = sorted(- [odds_ratio for odds_ratio in odds_ratios if odds_ratio["correlation_type"] == "success"],- key=lambda x: x["odds_ratio"],- reverse=True,- )-- negatively_correlated_events = sorted(- [odds_ratio for odds_ratio in odds_ratios if odds_ratio["correlation_type"] == "failure"],- key=lambda x: x["odds_ratio"],- reverse=False,- )-- # Return the top ten positively correlated events, and top then negatively correlated events- events = positively_correlated_events[:10] + negatively_correlated_events[:10]- return CorrelationCalculation(events=events, skewed_totals=skewed_totals, hogql=hogql, response=response)-- def _date_range(self) -> QueryDateRange:- # daysOfWeek scopes funnel step attribution, not the correlation event scan: actors are- # already day-filtered, and "what else did they do while converting" reads over their whole- # window. Deliberate — see test_days_of_week_does_not_filter_correlation_events.- return QueryDateRange(- date_range=self.context.query.dateRange,- team=self.context.team,- interval=self.context.query.interval,- now=self.context.now,- )-- def serialize_event_odds_ratio(self, odds_ratio: EventOddsRatio) -> EventOddsRatioSerialized:- event_definition = self.serialize_event_with_property(event=odds_ratio["event"])- return EventOddsRatioSerialized(- success_count=odds_ratio["success_count"],- failure_count=odds_ratio["failure_count"],- odds_ratio=odds_ratio["odds_ratio"],- correlation_type=(- CorrelationType.SUCCESS if odds_ratio["correlation_type"] == "success" else CorrelationType.FAILURE- ),- event=event_definition,- )-- def serialize_event_with_property(self, event: str) -> EventDefinition:- """- Format the event name for display.- """- if not self.support_autocapture_elements():- return EventDefinition(event=event, properties={}, elements=[])-- event_name, property_name, property_value = event.split("::")- if event_name == AUTOCAPTURE_EVENT and property_name == "elements_chain":- event_type, elements_chain = property_value.split(self.ELEMENTS_DIVIDER)- return EventDefinition(- event=event,- properties={self.AUTOCAPTURE_EVENT_TYPE: event_type},- elements=cast(- list,- ElementSerializer(chain_to_elements(elements_chain), many=True).data,- ),- )-- return EventDefinition(event=event, properties={}, elements=[])-- def to_query(self) -> ast.SelectQuery | ast.SelectSetQuery:- """- Returns a query string and params, which are used to generate the contingency table.- The query returns success and failure count for event / property values, along with total success and failure counts.- """- if self.query.funnelCorrelationType == FunnelCorrelationResultsType.PROPERTIES:- return self.get_properties_query()-- if self.query.funnelCorrelationType == FunnelCorrelationResultsType.EVENT_WITH_PROPERTIES:- return self.get_event_property_query()-- return self.get_event_query()-- def to_actors_query(self) -> ast.SelectQuery:- assert self.correlation_actors_query is not None-- if self.query.funnelCorrelationType == FunnelCorrelationResultsType.PROPERTIES:- # Filtering on persons / groups properties can be pushed down to funnel events query- additional_properties = None- if (- self.correlation_actors_query.funnelCorrelationPropertyValues- and len(self.correlation_actors_query.funnelCorrelationPropertyValues) > 0- ):- additional_properties = [- *(self.context.query.properties or []),- *self.correlation_actors_query.funnelCorrelationPropertyValues,- ]- return self.properties_actor_query(additional_properties=additional_properties)- else:- return self.events_actor_query()-- def events_actor_query(self) -> ast.SelectQuery:- assert self.correlation_actors_query is not None-- if not self.correlation_actors_query.funnelCorrelationPersonEntity:- raise ValidationError("No entity for persons specified")-- assert isinstance(self.correlation_actors_query.funnelCorrelationPersonEntity, EventsNode)-- target_step = self.context.max_steps- target_event = self.correlation_actors_query.funnelCorrelationPersonEntity.event- funnel_step_names = self._get_funnel_step_names()- funnel_persons_query = self.get_funnel_actors_cte()- date_from = self._date_range().date_from_as_hogql()- date_to = self._date_range().date_to_as_hogql()-- properties = self.correlation_actors_query.funnelCorrelationPersonEntity.properties- prop_query = None- if properties is not None and properties != []:- prop_query = property_to_expr(properties, self.team)-- conversion_filter = (- f"AND funnel_actors.steps {'=' if self.correlation_actors_query.funnelCorrelationPersonConverted else '<>'} target_step"- if self.correlation_actors_query.funnelCorrelationPersonConverted is not None- else ""- )-- event_join_query = self._get_events_join_query()-- recording_event_select_statement = (- ", any(funnel_actors.matching_events) AS matching_events" if self.actors_query.includeRecordings else ""- )-- query = parse_select(- f"""- WITH- funnel_actors AS (- {{funnel_persons_query}}- ),- {{date_from}} AS date_from,- {{date_to}} AS date_to,- {target_step} AS target_step,- {funnel_step_names} AS funnel_step_names- SELECT- funnel_actors.actor_id AS actor_id- {recording_event_select_statement}- FROM events AS event- {event_join_query}- AND event.event = {{target_event}}- {conversion_filter}- GROUP BY actor_id- ORDER BY actor_id- """,- placeholders={- "funnel_persons_query": funnel_persons_query,- "date_from": date_from,- "date_to": date_to,- "target_event": ast.Constant(value=target_event),- **self._aggregation_join_placeholders(),- },- )- assert isinstance(query, ast.SelectQuery)-- if prop_query:- assert isinstance(query.where, ast.And)- query.where.exprs = [*query.where.exprs, prop_query]-- return query-- def properties_actor_query(- self,- additional_properties: list[Any] | None = None,- ) -> ast.SelectQuery:- assert self.correlation_actors_query is not None-- if not self.correlation_actors_query.funnelCorrelationPropertyValues:- raise ValidationError("Property Correlation expects atleast one Property to get persons for")-- target_step = self.context.max_steps- funnel_persons_query = self.get_funnel_actors_cte(additional_properties=additional_properties)-- conversion_filter = (- f"funnel_actors.steps {'=' if self.correlation_actors_query.funnelCorrelationPersonConverted else '<>'} target_step"- if self.correlation_actors_query.funnelCorrelationPersonConverted is not None- else ""- )-- recording_event_select_statement = (- ", any(funnel_actors.matching_events) AS matching_events" if self.actors_query.includeRecordings else ""- )-- query = parse_select(- f"""- WITH- funnel_actors AS (- {{funnel_persons_query}}- ),- {target_step} AS target_step- SELECT- funnel_actors.actor_id AS actor_id- {recording_event_select_statement}- FROM funnel_actors- WHERE {conversion_filter}- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id- """,- placeholders={"funnel_persons_query": funnel_persons_query},- )- assert isinstance(query, ast.SelectQuery)-- return query-- def get_event_query(self) -> ast.SelectQuery | ast.SelectSetQuery:- funnel_persons_query = self.get_funnel_actors_cte()- event_join_query = self._get_events_join_query()- target_step = self.context.max_steps- funnel_step_names = self._get_funnel_step_names()- date_from = self._date_range().date_from_as_hogql()- date_to = self._date_range().date_to_as_hogql()-- # Build exclude event names as AST array for safe escaping- exclude_event_names = self.query.funnelCorrelationExcludeEventNames or []- exclude_event_names_ast = ast.Array(exprs=[ast.Constant(value=name) for name in exclude_event_names])-- event_correlation_query = parse_select(- f"""- WITH- funnel_actors AS MATERIALIZED (- {{funnel_persons_query}}- ),- {{date_from}} AS date_from,- {{date_to}} AS date_to,- {target_step} AS target_step,- {funnel_step_names} AS funnel_step_names-- SELECT- event.event AS name,-- -- If we have a `person.steps = target_step`, we know the person- -- reached the end of the funnel- countDistinctIf(- funnel_actors.actor_id,- funnel_actors.steps = target_step- ) AS success_count,-- -- And the converse being for failures- countDistinctIf(- funnel_actors.actor_id,- funnel_actors.steps <> target_step- ) AS failure_count-- FROM events AS event- {event_join_query}- AND event.event NOT IN {{exclude_event_names}}- GROUP BY name-- -- To get the total success/failure numbers, we do an aggregation on- -- the funnel people CTE and count distinct actor_ids- UNION ALL-- SELECT- -- We're not using WITH TOTALS because the resulting queries are- -- not runnable in Metabase- {{total_identifier}} as name,-- countDistinctIf(- funnel_actors.actor_id,- funnel_actors.steps = target_step- ) AS success_count,-- countDistinctIf(- funnel_actors.actor_id,- funnel_actors.steps <> target_step- ) AS failure_count- FROM funnel_actors- """,- placeholders={- "funnel_persons_query": funnel_persons_query,- "date_from": date_from,- "date_to": date_to,- "exclude_event_names": exclude_event_names_ast,- "total_identifier": ast.Constant(value=self.TOTAL_IDENTIFIER),- **self._aggregation_join_placeholders(),- },- )-- return event_correlation_query-- def get_event_property_query(self) -> ast.SelectQuery | ast.SelectSetQuery:- if not self.query.funnelCorrelationEventNames:- raise ValidationError("Event Property Correlation expects atleast one event name to run correlation on")-- funnel_persons_query = self.get_funnel_actors_cte()- filtered_events_cte = self._get_filtered_events_cte("AND event IN {event_names}")- event_right_join_query = self._get_events_right_join_query()- target_step = self.context.max_steps- funnel_step_names = self._get_funnel_step_names()- date_from = self._date_range().date_from_as_hogql()- date_to = self._date_range().date_to_as_hogql()- event_names = self.query.funnelCorrelationEventNames- exclude_property_names = self.query.funnelCorrelationEventExcludePropertyNames or []-- if self.support_autocapture_elements():- event_type_expression, _ = get_property_string_expr(- "events",- self.AUTOCAPTURE_EVENT_TYPE,- f"'{self.AUTOCAPTURE_EVENT_TYPE}'",- "properties",- allow_denormalized_props=False,- table_alias="event_table",- )- # With join_use_nulls=0, unmatched join rows yield '' for event_table.event- # rather than NULL, so guard with empty() instead of isNull().- event_property_array_query = f"""- if(- empty(event_table.event),- [],- [tuple(event_table.event, 'elements_chain', concat({event_type_expression}, '{self.ELEMENTS_DIVIDER}', event_table.elements_chain))]- )- """- else:- properties_pairs = "JSONExtractKeysAndValues(event_table.properties, 'String')"- event_property_array_query = f"""- if(- empty(event_table.event),- [],- arrayMap(prop -> tuple(event_table.event, prop.1, prop.2), {properties_pairs})- )- """-- # Build exclude clause only if there are properties to exclude- exclude_clause = (- "AND (prop.1 = {total_identifier} OR prop.2 NOT IN {exclude_props})" if exclude_property_names else ""- )-- query = parse_select(- f"""- WITH- funnel_actors AS (- {{funnel_persons_query}}- ),- filtered_events AS (- {filtered_events_cte}- ),- {target_step} AS target_step-- SELECT- if(prop.1 = {{total_identifier}}, {{total_identifier}}, concat(prop.1, '::', prop.2, '::', prop.3)) as name,- countDistinctIf(actor_id, steps = target_step) as success_count,- countDistinctIf(actor_id, steps <> target_step) as failure_count- FROM (- SELECT- funnel_actors.actor_id as actor_id,- funnel_actors.steps as steps,- arrayJoin(arrayConcat(- [tuple({{total_identifier}}, '', '')],- {event_property_array_query}- )) as prop- FROM filtered_events AS event_table- {event_right_join_query}- )- GROUP BY name, prop- -- Discard high cardinality / low hits properties- -- This removes the long tail of random properties with empty, null, or very small values- HAVING (name = {{total_identifier}} OR (success_count + failure_count) > 2)- {exclude_clause}- """,- placeholders={- "funnel_persons_query": funnel_persons_query,- "date_from": date_from,- "date_to": date_to,- "funnel_step_names": ast.Tuple(exprs=[ast.Constant(value=e) for e in funnel_step_names]),- "event_names": ast.Tuple(exprs=[ast.Constant(value=e) for e in event_names]),- "total_identifier": ast.Constant(value=self.TOTAL_IDENTIFIER),- **(- {"exclude_props": ast.Tuple(exprs=[ast.Constant(value=name) for name in exclude_property_names])}- if exclude_property_names- else {}- ),- **self._aggregation_join_placeholders(),- },- )-- return query-- def get_properties_query(self) -> ast.SelectQuery | ast.SelectSetQuery:- if not self.query.funnelCorrelationNames:- raise ValidationError("Property Correlation expects atleast one Property to run correlation on")-- funnel_persons_query = self.get_funnel_actors_cte()- target_step = self.context.max_steps- exclude_property_names = self.query.funnelCorrelationExcludeNames or []-- prop_clause = self._get_properties_prop_clause(include_total=True)- aggregation_join_query = self._get_aggregation_join_query()-- # Build exclude names as AST array for safe escaping- exclude_names_ast = ast.Array(exprs=[ast.Constant(value=name) for name in exclude_property_names])-- query = parse_select(- f"""- WITH- funnel_actors AS (- {{funnel_persons_query}}- ),- {target_step} AS target_step- SELECT- if(prop.1 = {{total_identifier}}, {{total_identifier}}, concat(prop.1, '::', prop.2)) as name,- -- We generate a unique identifier for each property value as: PropertyName::Value- countDistinctIf(actor_id, steps = target_step) AS success_count,- countDistinctIf(actor_id, steps <> target_step) AS failure_count- FROM (- SELECT- actor_id,- funnel_actors.steps as steps,- /*- We can extract multiple property values at the same time, since we're- already querying the person table.- This gives us something like:- --------------------- person1, steps, [property_value_0, property_value_1, property_value_2]- person2, steps, [property_value_0, property_value_1, property_value_2]-- To group by property name, we need to extract the property from the array. ArrayJoin helps us do that.- It transforms the above into:-- ---------------------- person1, steps, property_value_0- person1, steps, property_value_1- person1, steps, property_value_2-- person2, steps, property_value_0- person2, steps, property_value_1- person2, steps, property_value_2-- To avoid clashes and clarify the values, we also zip with the property name, to generate- tuples like: (property_name, property_value), which we then group by- */- {{prop_clause}}- FROM funnel_actors- {aggregation_join_query}-- ) aggregation_target_with_props- -- Group by the tuple items: (property_name, property_value) generated by zip- GROUP BY prop.1, prop.2- HAVING prop.1 = {{total_identifier}} OR prop.1 NOT IN {{exclude_names}}- """,- placeholders={- "funnel_persons_query": funnel_persons_query,- "prop_clause": prop_clause,- "exclude_names": exclude_names_ast,- "total_identifier": ast.Constant(value=self.TOTAL_IDENTIFIER),- },- )-- return query-- def get_funnel_actors_cte(self, additional_properties: list[Any] | None = None) -> ast.SelectQuery:- extra_fields = ["steps"]-- for prop in self.properties_to_include:- extra_fields.append(prop)-- if additional_properties is None:- return self._funnel_actors_generator.actor_query(extra_fields=extra_fields)-- temp_funnels_query = self.funnels_query.model_copy(update={"properties": additional_properties}, deep=True)- temp_context = FunnelQueryContext(- query=temp_funnels_query,- team=self.team,- timings=self.timings,- modifiers=self.modifiers,- limit_context=self.limit_context,- user=self.user,- include_timestamp=self.context.includeTimestamp,- include_preceding_timestamp=self.context.includePrecedingTimestamp,- include_properties=self.properties_to_include,- include_final_matching_events=self.context.includeFinalMatchingEvents,- )- temp_context.actorsQuery = self.actors_query- temp_funnel_actors_generator = FunnelUDF(context=temp_context)-- return temp_funnel_actors_generator.actor_query(extra_fields=extra_fields)-- def _get_events_join_query(self) -> str:- """- This query is used to join and filter the events table corresponding to the funnel_actors CTE.- It expects the following variables to be present in the CTE expression:- - funnel_actors- - date_to- - date_from- - funnel_step_names- """- windowInterval = self.context.funnelWindowInterval- windowIntervalUnit = funnel_window_interval_unit_to_sql(self.context.funnelWindowIntervalUnit)-- return f"""- {self._get_aggregation_target_join_query()}-- -- Make sure we're only looking at events before the final step, or- -- failing that, date_to- WHERE- -- add this condition in to ensure we can filter events before- -- joining funnel_actors- toTimeZone(toDateTime(event.timestamp), 'UTC') >= date_from- AND toTimeZone(toDateTime(event.timestamp), 'UTC') < date_to-- AND event.team_id = {self.context.team.pk}-- -- Add in per actor filtering on event time range. We just want- -- to include events that happened within the bounds of the- -- actors time in the funnel.- AND toTimeZone(toDateTime(event.timestamp), 'UTC') > funnel_actors.first_timestamp- AND toTimeZone(toDateTime(event.timestamp), 'UTC') < coalesce(- funnel_actors.final_timestamp,- toTimeZone(funnel_actors.first_timestamp, 'UTC') + INTERVAL {windowInterval} {windowIntervalUnit},- date_to)- -- Ensure that the event is not outside the bounds of the funnel conversion window-- -- Exclude funnel steps- AND event.event NOT IN funnel_step_names- """-- def _get_filtered_events_cte(self, extra_event_conditions: str = "") -> str:- return f"""- SELECT *- FROM events- WHERE- team_id = {self.context.team.pk}- AND toTimeZone(toDateTime(timestamp), 'UTC') >= {{date_from}}- AND toTimeZone(toDateTime(timestamp), 'UTC') < {{date_to}}- AND event NOT IN {{funnel_step_names}}- {extra_event_conditions}- """-- def _get_events_right_join_query(self) -> str:- """Join filtered events onto funnel_actors, preserving actors without events.-- Written as `FROM filtered_events RIGHT JOIN funnel_actors` rather than- `FROM funnel_actors LEFT JOIN filtered_events`: the semantics are identical,- but the right table is ClickHouse's hash-build side, and that must be the- small funnel_actors set.- """- windowInterval = self.context.funnelWindowInterval- windowIntervalUnit = funnel_window_interval_unit_to_sql(self.context.funnelWindowIntervalUnit)-- if self.funnels_query.aggregation_group_type_index is not None:- join_condition = (- f"funnel_actors.actor_id = event_table.$group_{self.funnels_query.aggregation_group_type_index}"- )- elif self._hogql_aggregation_expr() is not None:- join_condition = "funnel_actors.actor_id = {aggregation_join_target}"- else:- join_condition = "event_table.person_id = funnel_actors.actor_id"-- return f"""- RIGHT JOIN funnel_actors- ON {join_condition}- AND toTimeZone(toDateTime(event_table.timestamp), 'UTC') > funnel_actors.first_timestamp- AND toTimeZone(toDateTime(event_table.timestamp), 'UTC') < coalesce(- funnel_actors.final_timestamp,- toTimeZone(funnel_actors.first_timestamp, 'UTC') + INTERVAL {windowInterval} {windowIntervalUnit},- {{date_to}})- """-- def _get_aggregation_target_join_query(self) -> str:- aggregation_person_join = f"""- JOIN funnel_actors- ON event.person_id = funnel_actors.actor_id- """-- aggregation_group_join = f"""- JOIN funnel_actors- ON funnel_actors.actor_id = event.$group_{self.funnels_query.aggregation_group_type_index}- """-- if self.funnels_query.aggregation_group_type_index is not None:- return aggregation_group_join-- # When the funnel aggregates by a custom HogQL expression, funnel_actors.actor_id- # holds that value — joining on event.person_id would mismatch types (UUID vs the- # expression's type). Join on the same expression instead, emitted as a placeholder- # parsed by _aggregation_join_placeholders so the user-controlled string can't- # inject query structure.- if self._hogql_aggregation_expr() is not None:- return """- JOIN funnel_actors- ON funnel_actors.actor_id = {aggregation_join_target}- """-- return aggregation_person_join-- def _hogql_aggregation_expr(self) -> ast.Expr | None:- """Parsed AST for funnelAggregateByHogQL when set and non-trivial, else None for- person/group aggregation. Parsing the user-controlled string into an AST keeps it a- single bounded expression — it cannot add joins or clauses to the query."""- if self.funnels_query.aggregation_group_type_index is not None:- return None- funnels_filter = self.funnels_query.funnelsFilter- aggregate_by_hogql = funnels_filter.funnelAggregateByHogQL if funnels_filter else None- if aggregate_by_hogql and aggregate_by_hogql != "person_id":- return parse_expr(aggregate_by_hogql)- return None-- def _aggregation_join_placeholders(self) -> dict[str, ast.Expr]:- expr = self._hogql_aggregation_expr()- return {"aggregation_join_target": expr} if expr is not None else {}-- def _get_aggregation_join_query(self):- if self.funnels_query.aggregation_group_type_index is None:- # When the funnel aggregates by a custom HogQL expression, funnel_actors.actor_id- # holds that value rather than a person UUID, so joining persons.id (UUID) against- # it mismatches types and fails with "no supertype for types UUID, String". Coerce- # both sides to string so the join runs — it simply won't match persons, which is- # expected for a non-person aggregation (the events-side join is coerced the same- # way in _get_aggregation_target_join_query).- if self._hogql_aggregation_expr() is not None:- return "JOIN (SELECT id, properties as person_props FROM persons) persons ON toString(persons.id) = toString(funnel_actors.actor_id)"- return f"JOIN (SELECT id, properties as person_props FROM persons) persons ON persons.id = funnel_actors.actor_id"- else:- group_type_index = self.funnels_query.aggregation_group_type_index- return f"""- LEFT JOIN (- SELECT- key,- properties --AS group_properties_{group_type_index}- FROM groups- WHERE index = {group_type_index}- ) groups_{group_type_index}- ON funnel_actors.actor_id == groups_{group_type_index}.key- """-- def _get_properties_prop_array(self) -> ast.Expr:- """- Build AST for property extraction, safely escaping user-provided property names.- """- assert self.query.funnelCorrelationNames is not None-- if self.funnels_query.aggregation_group_type_index is None:- properties_field = ast.Field(chain=["person_props"])- else:- group_idx = self.funnels_query.aggregation_group_type_index- properties_field = ast.Field(chain=[f"groups_{group_idx}", "properties"])-- if "$all" in self.query.funnelCorrelationNames:- return ast.Call(- name="JSONExtractKeysAndValues",- args=[properties_field, ast.Constant(value="String")],- )-- prop_names_array = ast.Array(exprs=[ast.Constant(value=name) for name in self.query.funnelCorrelationNames])- prop_values_array = ast.Array(- exprs=[- ast.Call(- name="JSONExtractString",- args=[properties_field, ast.Constant(value=name)],- )- for name in self.query.funnelCorrelationNames- ]- )- return ast.Call(name="arrayZip", args=[prop_names_array, prop_values_array])-- def _get_properties_prop_clause(self, include_total: bool = False) -> ast.Alias:- prop_array = self._get_properties_prop_array()- if include_total:- prop_array = ast.Call(- name="arrayConcat",- args=[- ast.Array(- exprs=[- ast.Tuple(- exprs=[ast.Constant(value=self.TOTAL_IDENTIFIER), ast.Constant(value="")],- )- ]- ),- prop_array,- ],- )-- return ast.Alias(alias="prop", expr=ast.Call(name="arrayJoin", args=[prop_array]))-- def _uses_data_warehouse_series(self) -> bool:- return any(isinstance(entity, FunnelsDataWarehouseNode) for entity in self.funnels_query.series)-- def _get_funnel_step_names(self) -> list[str]:- events: set[str] = set()- for entity in self.funnels_query.series:- if isinstance(entity, ActionsNode):- action = Action.objects.get(pk=int(entity.id), team__project_id=self.context.team.project_id)- events.update([x for x in action.get_step_events() if x])- elif isinstance(entity, EventsNode):- if entity.event is not None:- events.add(entity.event)- else:- raise ValidationError("Data warehouse nodes are not supported here")-- return sorted(events)-- @property- def properties_to_include(self) -> list[str]:- props_to_include: list[str] = []- # TODO: implement or remove- # if self.query.funnelCorrelationType == FunnelCorrelationResultsType.PROPERTIES:- # assert self.query.funnelCorrelationNames is not None-- # # When dealing with properties, make sure funnel response comes with properties- # # so we don't have to join on persons/groups to get these properties again-- # for property_name in self.query.funnelCorrelationNames:- # if self.funnels_query.aggregation_group_type_index is not None:- # if "$all" == property_name:- # return []- # else:- # if "$all" == property_name:- # return []-- return props_to_include-- def support_autocapture_elements(self) -> bool:- if (- self.query.funnelCorrelationType == FunnelCorrelationResultsType.EVENT_WITH_PROPERTIES- and AUTOCAPTURE_EVENT in (self.query.funnelCorrelationEventNames or [])- ):- return True- return False-- @staticmethod- def are_results_insignificant(event_contingency_table: EventContingencyTable) -> bool:- """- Check if the results are insignificant, i.e. if the success/failure counts are- significantly different from the total counts- """-- total_count = event_contingency_table.success_total + event_contingency_table.failure_total-- if event_contingency_table.visited.success_count + event_contingency_table.visited.failure_count < min(- FunnelCorrelationQueryRunner.MIN_PERSON_COUNT,- FunnelCorrelationQueryRunner.MIN_PERSON_PERCENTAGE * total_count,- ):- return True-- return False---def get_entity_odds_ratio(event_contingency_table: EventContingencyTable, prior_counts: int) -> EventOddsRatio:- # Add 1 to all values to prevent divide by zero errors, and introduce a [prior](https://en.wikipedia.org/wiki/Prior_probability)- odds_ratio = (- (event_contingency_table.visited.success_count + prior_counts)- * (event_contingency_table.failure_total - event_contingency_table.visited.failure_count + prior_counts)- ) / (- (event_contingency_table.success_total - event_contingency_table.visited.success_count + prior_counts)- * (event_contingency_table.visited.failure_count + prior_counts)- )-- return EventOddsRatio(- event=event_contingency_table.event,- success_count=event_contingency_table.visited.success_count,- failure_count=event_contingency_table.visited.failure_count,- odds_ratio=odds_ratio,- correlation_type="success" if odds_ratio > 1 else "failure",- )diff --git a/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation.ambr b/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation.ambrdeleted file mode 100644index 7e8b9ba3231e..000000000000--- a/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation.ambr+++ /dev/null@@ -1,2041 +0,0 @@-# serializer version: 1-# name: TestClickhouseFunnelCorrelation.test_action_events_are_excluded_from_correlations- '''- WITH funnel_actors AS MATERIALIZED- (SELECT aggregation_target AS actor_id, (matched_events_array[1][1]).1 AS timestamp, nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp, (matched_events_array[1][1]).1 AS first_timestamp, steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array, [''] AS prop, arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple, af_tuple.1 AS step_reached, plus(af_tuple.1, 1) AS steps, af_tuple.2 AS breakdown, af_tuple.3 AS timings, af_tuple.4 AS matched_event_uuids_array_array, groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events, mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map, arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array, af_tuple.5 AS steps_bitfield, aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp, if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id) AS aggregation_target, e.uuid AS uuid, e.`$session_id` AS `$session_id`, e.`$window_id` AS `$window_id`, if(and(equals(e.event, 'user signed up'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'key'), ''), 'null'), '^"|"$', ''), 'val'), 0)), 1, 0) AS step_0, if(and(equals(e.event, 'paid'), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'key'), ''), 'null'), '^"|"$', ''), 'val'), 0)), 1, 0) AS step_1- FROM events AS e- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up'))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')) AS date_from,- assumeNotNull(toDateTime('2020-01-14 23:59:59', 'UTC')) AS date_to,- 2 AS target_step,- ['paid', 'user signed up'] AS funnel_step_names- SELECT event.event AS name,- countDistinctIf(funnel_actors.actor_id, ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))) AS success_count,- countDistinctIf(funnel_actors.actor_id, ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))) AS failure_count- FROM events AS event- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS event__override ON equals(event.distinct_id, event__override.distinct_id)- JOIN funnel_actors ON equals(if(not(empty(event__override.distinct_id)), event__override.person_id, event.person_id), funnel_actors.actor_id)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), notIn(event.event, []))- GROUP BY name- LIMIT 100- UNION ALL- SELECT 'Total_Values_In_Query' AS name,- countDistinctIf(funnel_actors.actor_id, ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))) AS success_count,- countDistinctIf(funnel_actors.actor_id, ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))) AS failure_count- FROM funnel_actors- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_basic_funnel_correlation_with_properties- '''- WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id) AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('today', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up'))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step- SELECT if(equals((aggregation_target_with_props.prop).1, 'Total_Values_In_Query'), 'Total_Values_In_Query', concat(ifNull(toString((aggregation_target_with_props.prop).1), ''), '::', ifNull(toString((aggregation_target_with_props.prop).2), ''))) AS name,- countDistinctIf(aggregation_target_with_props.actor_id, ifNull(equals(aggregation_target_with_props.steps, target_step), isNull(aggregation_target_with_props.steps)- and isNull(target_step))) AS success_count,- countDistinctIf(aggregation_target_with_props.actor_id, ifNull(notEquals(aggregation_target_with_props.steps, target_step), isNotNull(aggregation_target_with_props.steps)- or isNotNull(target_step))) AS failure_count- FROM- (SELECT funnel_actors.actor_id AS actor_id,- funnel_actors.steps AS steps,- arrayJoin(arrayConcat([tuple('Total_Values_In_Query', '')], arrayZip(['$browser'], [JSONExtractString(persons.person_props, '$browser')]))) AS prop- FROM funnel_actors- JOIN- (SELECT persons.id AS id,- persons.properties AS person_props- FROM- (SELECT person.id AS id,- person.properties AS properties- FROM person- WHERE and(equals(person.team_id, 99999), in(tuple(person.id, person.version),- (SELECT person.id AS id, max(person.version) AS version- FROM person- WHERE equals(person.team_id, 99999)- GROUP BY person.id- HAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))))))) SETTINGS optimize_aggregation_in_order=1) AS persons) AS persons ON equals(persons.id, funnel_actors.actor_id)) AS aggregation_target_with_props- GROUP BY (aggregation_target_with_props.prop).1, (aggregation_target_with_props.prop).2- HAVING or(equals((aggregation_target_with_props.prop).1, 'Total_Values_In_Query'), notIn((aggregation_target_with_props.prop).1, []))- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_basic_funnel_correlation_with_properties.1- '''- SELECT source.id,- source.id AS id,- source.matching_events AS matching_events- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id) AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('today', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Positive'), 0)), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS id- FROM funnel_actors- WHERE ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_basic_funnel_correlation_with_properties.2- '''- SELECT session_replay_events.session_id AS session_id,- min(toTimeZone(session_replay_events.min_first_timestamp, 'UTC')) AS start_time,- max(session_replay_events.retention_period_days) AS retention_period_days,- plus(dateTrunc('DAY', start_time), toIntervalDay(coalesce(retention_period_days, 30))) AS expiry_time- FROM session_replay_events- WHERE and(equals(session_replay_events.team_id, 99999), in(session_replay_events.session_id, ['']))- GROUP BY session_replay_events.session_id- HAVING and(greaterOrEquals(expiry_time, toDateTime64('today', 6, 'UTC')), equals(max(session_replay_events.is_deleted), 0))- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_basic_funnel_correlation_with_properties.3- '''- SELECT source.id,- source.id AS id,- source.matching_events AS matching_events- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id) AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('today', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Positive'), 0)), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS id- FROM funnel_actors- WHERE ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_basic_funnel_correlation_with_properties.4- '''- SELECT session_replay_events.session_id AS session_id,- min(toTimeZone(session_replay_events.min_first_timestamp, 'UTC')) AS start_time,- max(session_replay_events.retention_period_days) AS retention_period_days,- plus(dateTrunc('DAY', start_time), toIntervalDay(coalesce(retention_period_days, 30))) AS expiry_time- FROM session_replay_events- WHERE and(equals(session_replay_events.team_id, 99999), in(session_replay_events.session_id, ['']))- GROUP BY session_replay_events.session_id- HAVING and(greaterOrEquals(expiry_time, toDateTime64('today', 6, 'UTC')), equals(max(session_replay_events.is_deleted), 0))- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_basic_funnel_correlation_with_properties.5- '''- SELECT source.id,- source.id AS id,- source.matching_events AS matching_events- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id) AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('today', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Negative'), 0)), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS id- FROM funnel_actors- WHERE ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_basic_funnel_correlation_with_properties.6- '''- SELECT session_replay_events.session_id AS session_id,- min(toTimeZone(session_replay_events.min_first_timestamp, 'UTC')) AS start_time,- max(session_replay_events.retention_period_days) AS retention_period_days,- plus(dateTrunc('DAY', start_time), toIntervalDay(coalesce(retention_period_days, 30))) AS expiry_time- FROM session_replay_events- WHERE and(equals(session_replay_events.team_id, 99999), in(session_replay_events.session_id, ['']))- GROUP BY session_replay_events.session_id- HAVING and(greaterOrEquals(expiry_time, toDateTime64('today', 6, 'UTC')), equals(max(session_replay_events.is_deleted), 0))- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_basic_funnel_correlation_with_properties.7- '''- SELECT source.id,- source.id AS id,- source.matching_events AS matching_events- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id) AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('today', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Negative'), 0)), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS id- FROM funnel_actors- WHERE ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_basic_funnel_correlation_with_properties.8- '''- SELECT session_replay_events.session_id AS session_id,- min(toTimeZone(session_replay_events.min_first_timestamp, 'UTC')) AS start_time,- max(session_replay_events.retention_period_days) AS retention_period_days,- plus(dateTrunc('DAY', start_time), toIntervalDay(coalesce(retention_period_days, 30))) AS expiry_time- FROM session_replay_events- WHERE and(equals(session_replay_events.team_id, 99999), in(session_replay_events.session_id, ['']))- GROUP BY session_replay_events.session_id- HAVING and(greaterOrEquals(expiry_time, toDateTime64('today', 6, 'UTC')), equals(max(session_replay_events.is_deleted), 0))- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_event_properties_and_groups- '''- WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.`$group_1` AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- filtered_events AS- (SELECT events.event AS event,- events.properties AS properties,- toTimeZone(events.timestamp, 'UTC') AS timestamp,- if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id,- events.`$group_1` AS `$group_1`,- accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$exception_issue_id'), ''), 'null'), '^"|"$', ''), 'UUID') AS event_issue_id,- events__fingerprint_issue_state.issue_id AS issue_id,- events__fingerprint_issue_state.issue_id AS issue_id_v2,- events__fingerprint_issue_state.issue_name AS issue_name,- events__fingerprint_issue_state.issue_description AS issue_description,- events__fingerprint_issue_state.issue_status AS issue_status,- events__fingerprint_issue_state.assigned_user_id AS issue_assigned_user_id,- events__fingerprint_issue_state.assigned_role_id AS issue_assigned_role_id,- events__fingerprint_issue_state.first_seen AS issue_first_seen- FROM events- LEFT OUTER JOIN- (SELECT cityHash64(error_tracking_fingerprint_issue_state.fingerprint) AS fp_hash,- toNullable(tupleElement(argMax(tuple(error_tracking_fingerprint_issue_state.issue_id), error_tracking_fingerprint_issue_state.version), 1)) AS issue_id,- toNullable(tupleElement(argMax(tuple(error_tracking_fingerprint_issue_state.issue_name), error_tracking_fingerprint_issue_state.version), 1)) AS issue_name,- toNullable(tupleElement(argMax(tuple(error_tracking_fingerprint_issue_state.issue_description), error_tracking_fingerprint_issue_state.version), 1)) AS issue_description,- toNullable(tupleElement(argMax(tuple(error_tracking_fingerprint_issue_state.issue_status), error_tracking_fingerprint_issue_state.version), 1)) AS issue_status,- toNullable(tupleElement(argMax(tuple(error_tracking_fingerprint_issue_state.assigned_user_id), error_tracking_fingerprint_issue_state.version), 1)) AS assigned_user_id,- toNullable(tupleElement(argMax(tuple(error_tracking_fingerprint_issue_state.assigned_role_id), error_tracking_fingerprint_issue_state.version), 1)) AS assigned_role_id,- toNullable(tupleElement(argMax(tuple(toTimeZone(error_tracking_fingerprint_issue_state.first_seen, 'UTC')), error_tracking_fingerprint_issue_state.version), 1)) AS first_seen- FROM error_tracking_fingerprint_issue_state- WHERE equals(error_tracking_fingerprint_issue_state.team_id, 99999)- GROUP BY fp_hash- HAVING equals(argMax(error_tracking_fingerprint_issue_state.is_deleted, error_tracking_fingerprint_issue_state.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__fingerprint_issue_state ON equals(cityHash64(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(events.properties, '$exception_fingerprint'), ''), 'null'), '^"|"$', '')), events__fingerprint_issue_state.fp_hash)- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), equals(events.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(events.timestamp, 'UTC'), 'UTC'), assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(toDateTime(toTimeZone(events.timestamp, 'UTC'), 'UTC'), assumeNotNull(toDateTime('2020-01-14 23:59:59', 'UTC'))), notIn(events.event, tuple('paid', 'user signed up')), in(events.event, tuple('positively_related', 'negatively_related')))),- 2 AS target_step- SELECT if(ifNull(equals((prop).1, 'Total_Values_In_Query'), 0), 'Total_Values_In_Query', concat(ifNull(toString((prop).1), ''), '::', ifNull(toString((prop).2), ''), '::', ifNull(toString((prop).3), ''))) AS name,- countDistinctIf(actor_id, ifNull(equals(steps, target_step), isNull(steps)- and isNull(target_step))) AS success_count,- countDistinctIf(actor_id, ifNull(notEquals(steps, target_step), isNotNull(steps)- or isNotNull(target_step))) AS failure_count- FROM- (SELECT funnel_actors.actor_id AS actor_id,- funnel_actors.steps AS steps,- arrayJoin(arrayConcat([tuple('Total_Values_In_Query', '', '')], if(empty(event_table.event), [], arrayMap(prop -> tuple(event_table.event, prop.1, prop.2), JSONExtractKeysAndValues(event_table.properties, 'String'))))) AS prop- FROM filtered_events AS event_table- RIGHT JOIN funnel_actors ON and(equals(funnel_actors.actor_id, event_table.`$group_1`), greater(toTimeZone(toDateTime(toTimeZone(event_table.timestamp, 'UTC'), 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toTimeZone(toDateTime(toTimeZone(event_table.timestamp, 'UTC'), 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), assumeNotNull(toDateTime('2020-01-14 23:59:59', 'UTC'))))))- GROUP BY name,- prop- HAVING or(equals(name, 'Total_Values_In_Query'), greater(plus(success_count, failure_count), 2))- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_events_and_groups- '''- WITH funnel_actors AS MATERIALIZED- (SELECT aggregation_target AS actor_id, (matched_events_array[1][1]).1 AS timestamp, nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp, (matched_events_array[1][1]).1 AS first_timestamp, steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array, [''] AS prop, arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple, af_tuple.1 AS step_reached, plus(af_tuple.1, 1) AS steps, af_tuple.2 AS breakdown, af_tuple.3 AS timings, af_tuple.4 AS matched_event_uuids_array_array, groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events, mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map, arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array, af_tuple.5 AS steps_bitfield, aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp, e.`$group_0` AS aggregation_target, e.uuid AS uuid, e.`$session_id` AS `$session_id`, e.`$window_id` AS `$window_id`, if(equals(e.event, 'user signed up'), 1, 0) AS step_0, if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')) AS date_from,- assumeNotNull(toDateTime('2020-01-14 23:59:59', 'UTC')) AS date_to,- 2 AS target_step,- ['paid', 'user signed up'] AS funnel_step_names- SELECT event.event AS name,- countDistinctIf(funnel_actors.actor_id, ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))) AS success_count,- countDistinctIf(funnel_actors.actor_id, ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))) AS failure_count- FROM events AS event- JOIN funnel_actors ON equals(funnel_actors.actor_id, event.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), notIn(event.event, []))- GROUP BY name- LIMIT 100- UNION ALL- SELECT 'Total_Values_In_Query' AS name,- countDistinctIf(funnel_actors.actor_id, ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))) AS success_count,- countDistinctIf(funnel_actors.actor_id, ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))) AS failure_count- FROM funnel_actors- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_events_and_groups.1- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')) AS date_from,- assumeNotNull(toDateTime('2020-01-14 23:59:59', 'UTC')) AS date_to,- 2 AS target_step,- ['paid', 'user signed up'] AS funnel_step_names SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM events AS event- JOIN funnel_actors ON equals(funnel_actors.actor_id, event.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'positively_related'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step)))- GROUP BY actor_id- ORDER BY actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_events_and_groups.2- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')) AS date_from,- assumeNotNull(toDateTime('2020-01-14 23:59:59', 'UTC')) AS date_to,- 2 AS target_step,- ['paid', 'user signed up'] AS funnel_step_names SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM events AS event- JOIN funnel_actors ON equals(funnel_actors.actor_id, event.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'positively_related'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step)))- GROUP BY actor_id- ORDER BY actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_events_and_groups.3- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')) AS date_from,- assumeNotNull(toDateTime('2020-01-14 23:59:59', 'UTC')) AS date_to,- 2 AS target_step,- ['paid', 'user signed up'] AS funnel_step_names SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM events AS event- JOIN funnel_actors ON equals(funnel_actors.actor_id, event.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step)))- GROUP BY actor_id- ORDER BY actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_events_and_groups.4- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')) AS date_from,- assumeNotNull(toDateTime('2020-01-14 23:59:59', 'UTC')) AS date_to,- 2 AS target_step,- ['paid', 'user signed up'] AS funnel_step_names SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM events AS event- JOIN funnel_actors ON equals(funnel_actors.actor_id, event.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step)))- GROUP BY actor_id- ORDER BY actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_events_and_groups.5- '''- WITH funnel_actors AS MATERIALIZED- (SELECT aggregation_target AS actor_id, (matched_events_array[1][1]).1 AS timestamp, nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp, (matched_events_array[1][1]).1 AS first_timestamp, steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array, [''] AS prop, arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple, af_tuple.1 AS step_reached, plus(af_tuple.1, 1) AS steps, af_tuple.2 AS breakdown, af_tuple.3 AS timings, af_tuple.4 AS matched_event_uuids_array_array, groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events, mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map, arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array, af_tuple.5 AS steps_bitfield, aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp, e.`$group_0` AS aggregation_target, e.uuid AS uuid, e.`$session_id` AS `$session_id`, e.`$window_id` AS `$window_id`, if(equals(e.event, 'user signed up'), 1, 0) AS step_0, if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- LEFT JOIN- (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(groups.group_properties, 'industry'), ''), 'null'), '^"|"$', '')), toTimeZone(groups._timestamp, 'UTC')), 1) AS properties___industry, groups.group_type_index AS index, groups.group_key AS key- FROM groups- WHERE and(equals(groups.team_id, 99999), equals(index, 0))- GROUP BY groups.group_type_index, groups.group_key) AS e__group_0 ON equals(e.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), ifNull(equals(e__group_0.properties___industry, 'finance'), 0), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')) AS date_from,- assumeNotNull(toDateTime('2020-01-14 23:59:59', 'UTC')) AS date_to,- 2 AS target_step,- ['paid', 'user signed up'] AS funnel_step_names- SELECT event.event AS name,- countDistinctIf(funnel_actors.actor_id, ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))) AS success_count,- countDistinctIf(funnel_actors.actor_id, ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))) AS failure_count- FROM events AS event- JOIN funnel_actors ON equals(funnel_actors.actor_id, event.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), notIn(event.event, []))- GROUP BY name- LIMIT 100- UNION ALL- SELECT 'Total_Values_In_Query' AS name,- countDistinctIf(funnel_actors.actor_id, ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))) AS success_count,- countDistinctIf(funnel_actors.actor_id, ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))) AS failure_count- FROM funnel_actors- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_events_and_groups.6- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')) AS date_from,- assumeNotNull(toDateTime('2020-01-14 23:59:59', 'UTC')) AS date_to,- 2 AS target_step,- ['paid', 'user signed up'] AS funnel_step_names SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM events AS event- JOIN funnel_actors ON equals(funnel_actors.actor_id, event.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step)))- GROUP BY actor_id- ORDER BY actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_events_and_groups.7- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')) AS date_from,- assumeNotNull(toDateTime('2020-01-14 23:59:59', 'UTC')) AS date_to,- 2 AS target_step,- ['paid', 'user signed up'] AS funnel_step_names SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM events AS event- JOIN funnel_actors ON equals(funnel_actors.actor_id, event.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step)))- GROUP BY actor_id- ORDER BY actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups- '''- WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step- SELECT if(equals((aggregation_target_with_props.prop).1, 'Total_Values_In_Query'), 'Total_Values_In_Query', concat(ifNull(toString((aggregation_target_with_props.prop).1), ''), '::', ifNull(toString((aggregation_target_with_props.prop).2), ''))) AS name,- countDistinctIf(aggregation_target_with_props.actor_id, ifNull(equals(aggregation_target_with_props.steps, target_step), isNull(aggregation_target_with_props.steps)- and isNull(target_step))) AS success_count,- countDistinctIf(aggregation_target_with_props.actor_id, ifNull(notEquals(aggregation_target_with_props.steps, target_step), isNotNull(aggregation_target_with_props.steps)- or isNotNull(target_step))) AS failure_count- FROM- (SELECT funnel_actors.actor_id AS actor_id,- funnel_actors.steps AS steps,- arrayJoin(arrayConcat([tuple('Total_Values_In_Query', '')], arrayZip(['industry'], [JSONExtractString(groups_0.properties, 'industry')]))) AS prop- FROM funnel_actors- LEFT JOIN- (SELECT groups.key AS key,- groups.properties AS properties- FROM- (SELECT argMax(groups.group_properties, toTimeZone(groups._timestamp, 'UTC')) AS properties,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE equals(groups.team_id, 99999)- GROUP BY groups.group_type_index,- groups.group_key) AS groups- WHERE equals(groups.index, 0)) AS groups_0 ON equals(funnel_actors.actor_id, groups_0.key)) AS aggregation_target_with_props- GROUP BY (aggregation_target_with_props.prop).1, (aggregation_target_with_props.prop).2- HAVING or(equals((aggregation_target_with_props.prop).1, 'Total_Values_In_Query'), notIn((aggregation_target_with_props.prop).1, []))- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups.1- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- LEFT JOIN- (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(groups.group_properties, 'industry'), ''), 'null'), '^"|"$', '')), toTimeZone(groups._timestamp, 'UTC')), 1) AS properties___industry,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE and(equals(groups.team_id, 99999), equals(index, 0))- GROUP BY groups.group_type_index,- groups.group_key) AS e__group_0 ON equals(e.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), ifNull(equals(e__group_0.properties___industry, 'positive'), 0), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM funnel_actors- WHERE ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups.2- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- LEFT JOIN- (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(groups.group_properties, 'industry'), ''), 'null'), '^"|"$', '')), toTimeZone(groups._timestamp, 'UTC')), 1) AS properties___industry,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE and(equals(groups.team_id, 99999), equals(index, 0))- GROUP BY groups.group_type_index,- groups.group_key) AS e__group_0 ON equals(e.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), ifNull(equals(e__group_0.properties___industry, 'positive'), 0), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM funnel_actors- WHERE ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups.3- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- LEFT JOIN- (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(groups.group_properties, 'industry'), ''), 'null'), '^"|"$', '')), toTimeZone(groups._timestamp, 'UTC')), 1) AS properties___industry,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE and(equals(groups.team_id, 99999), equals(index, 0))- GROUP BY groups.group_type_index,- groups.group_key) AS e__group_0 ON equals(e.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), ifNull(equals(e__group_0.properties___industry, 'negative'), 0), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM funnel_actors- WHERE ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups.4- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- LEFT JOIN- (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(groups.group_properties, 'industry'), ''), 'null'), '^"|"$', '')), toTimeZone(groups._timestamp, 'UTC')), 1) AS properties___industry,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE and(equals(groups.team_id, 99999), equals(index, 0))- GROUP BY groups.group_type_index,- groups.group_key) AS e__group_0 ON equals(e.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), ifNull(equals(e__group_0.properties___industry, 'negative'), 0), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM funnel_actors- WHERE ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups.5- '''- WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step- SELECT if(equals((aggregation_target_with_props.prop).1, 'Total_Values_In_Query'), 'Total_Values_In_Query', concat(ifNull(toString((aggregation_target_with_props.prop).1), ''), '::', ifNull(toString((aggregation_target_with_props.prop).2), ''))) AS name,- countDistinctIf(aggregation_target_with_props.actor_id, ifNull(equals(aggregation_target_with_props.steps, target_step), isNull(aggregation_target_with_props.steps)- and isNull(target_step))) AS success_count,- countDistinctIf(aggregation_target_with_props.actor_id, ifNull(notEquals(aggregation_target_with_props.steps, target_step), isNotNull(aggregation_target_with_props.steps)- or isNotNull(target_step))) AS failure_count- FROM- (SELECT funnel_actors.actor_id AS actor_id,- funnel_actors.steps AS steps,- arrayJoin(arrayConcat([tuple('Total_Values_In_Query', '')], JSONExtractKeysAndValues(groups_0.properties, 'String'))) AS prop- FROM funnel_actors- LEFT JOIN- (SELECT groups.key AS key,- groups.properties AS properties- FROM- (SELECT argMax(groups.group_properties, toTimeZone(groups._timestamp, 'UTC')) AS properties,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE equals(groups.team_id, 99999)- GROUP BY groups.group_type_index,- groups.group_key) AS groups- WHERE equals(groups.index, 0)) AS groups_0 ON equals(funnel_actors.actor_id, groups_0.key)) AS aggregation_target_with_props- GROUP BY (aggregation_target_with_props.prop).1, (aggregation_target_with_props.prop).2- HAVING or(equals((aggregation_target_with_props.prop).1, 'Total_Values_In_Query'), notIn((aggregation_target_with_props.prop).1, []))- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups_person_on_events- '''- WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step- SELECT if(equals((aggregation_target_with_props.prop).1, 'Total_Values_In_Query'), 'Total_Values_In_Query', concat(ifNull(toString((aggregation_target_with_props.prop).1), ''), '::', ifNull(toString((aggregation_target_with_props.prop).2), ''))) AS name,- countDistinctIf(aggregation_target_with_props.actor_id, ifNull(equals(aggregation_target_with_props.steps, target_step), isNull(aggregation_target_with_props.steps)- and isNull(target_step))) AS success_count,- countDistinctIf(aggregation_target_with_props.actor_id, ifNull(notEquals(aggregation_target_with_props.steps, target_step), isNotNull(aggregation_target_with_props.steps)- or isNotNull(target_step))) AS failure_count- FROM- (SELECT funnel_actors.actor_id AS actor_id,- funnel_actors.steps AS steps,- arrayJoin(arrayConcat([tuple('Total_Values_In_Query', '')], arrayZip(['industry'], [JSONExtractString(groups_0.properties, 'industry')]))) AS prop- FROM funnel_actors- LEFT JOIN- (SELECT groups.key AS key,- groups.properties AS properties- FROM- (SELECT argMax(groups.group_properties, toTimeZone(groups._timestamp, 'UTC')) AS properties,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE equals(groups.team_id, 99999)- GROUP BY groups.group_type_index,- groups.group_key) AS groups- WHERE equals(groups.index, 0)) AS groups_0 ON equals(funnel_actors.actor_id, groups_0.key)) AS aggregation_target_with_props- GROUP BY (aggregation_target_with_props.prop).1, (aggregation_target_with_props.prop).2- HAVING or(equals((aggregation_target_with_props.prop).1, 'Total_Values_In_Query'), notIn((aggregation_target_with_props.prop).1, []))- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups_person_on_events.1- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- LEFT JOIN- (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(groups.group_properties, 'industry'), ''), 'null'), '^"|"$', '')), toTimeZone(groups._timestamp, 'UTC')), 1) AS properties___industry,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE and(equals(groups.team_id, 99999), equals(index, 0))- GROUP BY groups.group_type_index,- groups.group_key) AS e__group_0 ON equals(e.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), ifNull(equals(e__group_0.properties___industry, 'positive'), 0), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM funnel_actors- WHERE ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups_person_on_events.2- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- LEFT JOIN- (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(groups.group_properties, 'industry'), ''), 'null'), '^"|"$', '')), toTimeZone(groups._timestamp, 'UTC')), 1) AS properties___industry,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE and(equals(groups.team_id, 99999), equals(index, 0))- GROUP BY groups.group_type_index,- groups.group_key) AS e__group_0 ON equals(e.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), ifNull(equals(e__group_0.properties___industry, 'positive'), 0), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM funnel_actors- WHERE ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups_person_on_events.3- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- LEFT JOIN- (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(groups.group_properties, 'industry'), ''), 'null'), '^"|"$', '')), toTimeZone(groups._timestamp, 'UTC')), 1) AS properties___industry,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE and(equals(groups.team_id, 99999), equals(index, 0))- GROUP BY groups.group_type_index,- groups.group_key) AS e__group_0 ON equals(e.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), ifNull(equals(e__group_0.properties___industry, 'negative'), 0), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM funnel_actors- WHERE ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups_person_on_events.4- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- LEFT JOIN- (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(groups.group_properties, 'industry'), ''), 'null'), '^"|"$', '')), toTimeZone(groups._timestamp, 'UTC')), 1) AS properties___industry,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE and(equals(groups.team_id, 99999), equals(index, 0))- GROUP BY groups.group_type_index,- groups.group_key) AS e__group_0 ON equals(e.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), ifNull(equals(e__group_0.properties___industry, 'negative'), 0), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM funnel_actors- WHERE ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups_person_on_events.5- '''- WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step- SELECT if(equals((aggregation_target_with_props.prop).1, 'Total_Values_In_Query'), 'Total_Values_In_Query', concat(ifNull(toString((aggregation_target_with_props.prop).1), ''), '::', ifNull(toString((aggregation_target_with_props.prop).2), ''))) AS name,- countDistinctIf(aggregation_target_with_props.actor_id, ifNull(equals(aggregation_target_with_props.steps, target_step), isNull(aggregation_target_with_props.steps)- and isNull(target_step))) AS success_count,- countDistinctIf(aggregation_target_with_props.actor_id, ifNull(notEquals(aggregation_target_with_props.steps, target_step), isNotNull(aggregation_target_with_props.steps)- or isNotNull(target_step))) AS failure_count- FROM- (SELECT funnel_actors.actor_id AS actor_id,- funnel_actors.steps AS steps,- arrayJoin(arrayConcat([tuple('Total_Values_In_Query', '')], JSONExtractKeysAndValues(groups_0.properties, 'String'))) AS prop- FROM funnel_actors- LEFT JOIN- (SELECT groups.key AS key,- groups.properties AS properties- FROM- (SELECT argMax(groups.group_properties, toTimeZone(groups._timestamp, 'UTC')) AS properties,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE equals(groups.team_id, 99999)- GROUP BY groups.group_type_index,- groups.group_key) AS groups- WHERE equals(groups.index, 0)) AS groups_0 ON equals(funnel_actors.actor_id, groups_0.key)) AS aggregation_target_with_props- GROUP BY (aggregation_target_with_props.prop).1, (aggregation_target_with_props.prop).2- HAVING or(equals((aggregation_target_with_props.prop).1, 'Total_Values_In_Query'), notIn((aggregation_target_with_props.prop).1, []))- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ---diff --git a/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation.new_events_schema.ambr b/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation.new_events_schema.ambrdeleted file mode 100644index da5cc80329cb..000000000000--- a/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation.new_events_schema.ambr+++ /dev/null@@ -1,2003 +0,0 @@-# serializer version: 1-# name: TestClickhouseFunnelCorrelation.test_action_events_are_excluded_from_correlations[new_events_schema]- '''- WITH funnel_actors AS MATERIALIZED- (SELECT aggregation_target AS actor_id, (matched_events_array[1][1]).1 AS timestamp, nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp, (matched_events_array[1][1]).1 AS first_timestamp, steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array, [''] AS prop, arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple, af_tuple.1 AS step_reached, plus(af_tuple.1, 1) AS steps, af_tuple.2 AS breakdown, af_tuple.3 AS timings, af_tuple.4 AS matched_event_uuids_array_array, groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events, mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map, arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array, af_tuple.5 AS steps_bitfield, aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp, if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id) AS aggregation_target, e.uuid AS uuid, e.properties.`$session_id` AS `$session_id`, e.properties.`$window_id` AS `$window_id`, if(and(equals(e.event, 'user signed up'), ifNull(equals(CAST(e.properties.key, 'Nullable(String)'), 'val'), 0)), 1, 0) AS step_0, if(and(equals(e.event, 'paid'), ifNull(equals(CAST(e.properties.key, 'Nullable(String)'), 'val'), 0)), 1, 0) AS step_1- FROM events_json AS e- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id, person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up'))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')) AS date_from,- assumeNotNull(toDateTime('2020-01-14 23:59:59', 'UTC')) AS date_to,- 2 AS target_step,- ['paid', 'user signed up'] AS funnel_step_names- SELECT event.event AS name,- countDistinctIf(funnel_actors.actor_id, ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))) AS success_count,- countDistinctIf(funnel_actors.actor_id, ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))) AS failure_count- FROM events_json AS event- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS event__override ON equals(event.distinct_id, event__override.distinct_id)- JOIN funnel_actors ON equals(if(not(empty(event__override.distinct_id)), event__override.person_id, event.person_id), funnel_actors.actor_id)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), notIn(event.event, []))- GROUP BY name- LIMIT 100- UNION ALL- SELECT 'Total_Values_In_Query' AS name,- countDistinctIf(funnel_actors.actor_id, ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))) AS success_count,- countDistinctIf(funnel_actors.actor_id, ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))) AS failure_count- FROM funnel_actors- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_basic_funnel_correlation_with_properties[new_events_schema.1]- '''- SELECT source.id,- source.id AS id,- source.matching_events AS matching_events- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id) AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('today', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), equals(e.person_properties.`$browser`, 'Positive')), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS id- FROM funnel_actors- WHERE ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_basic_funnel_correlation_with_properties[new_events_schema.2]- '''- SELECT source.id,- source.id AS id,- source.matching_events AS matching_events- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id) AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('today', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), equals(e.person_properties.`$browser`, 'Positive')), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS id- FROM funnel_actors- WHERE ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_basic_funnel_correlation_with_properties[new_events_schema.3]- '''- SELECT source.id,- source.id AS id,- source.matching_events AS matching_events- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id) AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('today', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), equals(e.person_properties.`$browser`, 'Negative')), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS id- FROM funnel_actors- WHERE ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_basic_funnel_correlation_with_properties[new_events_schema.4]- '''- SELECT source.id,- source.id AS id,- source.matching_events AS matching_events- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id) AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('today', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), equals(e.person_properties.`$browser`, 'Negative')), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS id- FROM funnel_actors- WHERE ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_basic_funnel_correlation_with_properties[new_events_schema]- '''- WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id) AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('today', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up'))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step- SELECT if(equals((aggregation_target_with_props.prop).1, 'Total_Values_In_Query'), 'Total_Values_In_Query', concat(ifNull(toString((aggregation_target_with_props.prop).1), ''), '::', ifNull(toString((aggregation_target_with_props.prop).2), ''))) AS name,- countDistinctIf(aggregation_target_with_props.actor_id, ifNull(equals(aggregation_target_with_props.steps, target_step), isNull(aggregation_target_with_props.steps)- and isNull(target_step))) AS success_count,- countDistinctIf(aggregation_target_with_props.actor_id, ifNull(notEquals(aggregation_target_with_props.steps, target_step), isNotNull(aggregation_target_with_props.steps)- or isNotNull(target_step))) AS failure_count- FROM- (SELECT funnel_actors.actor_id AS actor_id,- funnel_actors.steps AS steps,- arrayJoin(arrayConcat([tuple('Total_Values_In_Query', '')], arrayZip(['$browser'], [JSONExtractString(persons.person_props, '$browser')]))) AS prop- FROM funnel_actors- JOIN- (SELECT persons.id AS id,- persons.properties AS person_props- FROM- (SELECT person.id AS id,- person.properties AS properties- FROM person- WHERE and(equals(person.team_id, 99999), in(tuple(person.id, person.version),- (SELECT person.id AS id, max(person.version) AS version- FROM person- WHERE equals(person.team_id, 99999)- GROUP BY person.id- HAVING and(equals(argMax(person.is_deleted, person.version), 0), less(argMax(toTimeZone(person.created_at, 'UTC'), person.version), plus(now64(6, 'UTC'), toIntervalDay(1))))))) SETTINGS optimize_aggregation_in_order=1) AS persons) AS persons ON equals(persons.id, funnel_actors.actor_id)) AS aggregation_target_with_props- GROUP BY (aggregation_target_with_props.prop).1, (aggregation_target_with_props.prop).2- HAVING or(equals((aggregation_target_with_props.prop).1, 'Total_Values_In_Query'), notIn((aggregation_target_with_props.prop).1, []))- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_event_properties_and_groups[new_events_schema]- '''- WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.properties.`$group_1` AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- filtered_events AS- (SELECT events.event AS event,- concat('{', arrayStringConcat(arrayConcat(arrayMap(kv -> concat(toJSONString(kv.1), ':', kv.2), arrayFilter(kv -> not (kv.2 = '[]'- and kv.1 in ('$exception_functions', '$exception_list', '$exception_sources', '$exception_types', '$exception_values', '$mcp_listed_tool_names'))- and not (kv.2 = '""'- and kv.1 in ('$browser', '$browser_language', '$browser_version', '$config_defaults', '$device_type', '$geoip_city_name', '$geoip_continent_code', '$geoip_continent_name', '$geoip_country_code', '$geoip_country_name', '$geoip_subdivision_1_name', '$geoip_time_zone', '$group_0', '$group_1', '$group_2', '$group_3', '$group_4', '$lib', '$lib_version', '$os', '$os_version', '$session_id', '$timezone', '$window_id'))- and kv.1 != '$feature_flags', JSONExtractKeysAndValuesRaw(toJSONString(events.properties)))), arrayConcat(arrayMap((key, value) -> concat(toJSONString(concat('$feature/', key)), ':', if(value in ('true', 'false'), value, toJSONString(multiIf(value = '$false', 'false', value = '$true', 'true', value)))), mapKeys(events.properties.`$feature_flags`), mapValues(events.properties.`$feature_flags`)), if(empty(events.properties.`$feature_flags`), [], [concat('"$active_feature_flags":', toJSONString(mapKeys(mapFilter((key, value) -> value not in ('', 'false'), events.properties.`$feature_flags`))))])), arrayMap(kv -> concat(toJSONString(kv.1), ':', kv.2), JSONExtractKeysAndValuesRaw(toJSONString(events.temporary_properties)))), ','), '}') AS properties,- toTimeZone(events.timestamp, 'UTC') AS timestamp,- if(not(empty(events__override.distinct_id)), events__override.person_id, events.person_id) AS person_id,- events.properties.`$group_1` AS `$group_1`,- accurateCastOrNull(if(notEquals(toJSONString(events.properties.^`$exception_issue_id`), '{}'), toJSONString(events.properties.^`$exception_issue_id`), if(isNull(nullIf(toString(events.properties.`$exception_issue_id`), '')), NULL, if(and(in(ascii(toString(events.properties.`$exception_issue_id`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$exception_issue_id`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$exception_issue_id`), '[]'), '{}'), toString(events.properties.`$exception_issue_id`)))), 'UUID') AS event_issue_id,- events__fingerprint_issue_state.issue_id AS issue_id,- events__fingerprint_issue_state.issue_id AS issue_id_v2,- events__fingerprint_issue_state.issue_name AS issue_name,- events__fingerprint_issue_state.issue_description AS issue_description,- events__fingerprint_issue_state.issue_status AS issue_status,- events__fingerprint_issue_state.assigned_user_id AS issue_assigned_user_id,- events__fingerprint_issue_state.assigned_role_id AS issue_assigned_role_id,- events__fingerprint_issue_state.first_seen AS issue_first_seen- FROM events_json AS events- LEFT OUTER JOIN- (SELECT cityHash64(error_tracking_fingerprint_issue_state.fingerprint) AS fp_hash,- toNullable(tupleElement(argMax(tuple(error_tracking_fingerprint_issue_state.issue_id), error_tracking_fingerprint_issue_state.version), 1)) AS issue_id,- toNullable(tupleElement(argMax(tuple(error_tracking_fingerprint_issue_state.issue_name), error_tracking_fingerprint_issue_state.version), 1)) AS issue_name,- toNullable(tupleElement(argMax(tuple(error_tracking_fingerprint_issue_state.issue_description), error_tracking_fingerprint_issue_state.version), 1)) AS issue_description,- toNullable(tupleElement(argMax(tuple(error_tracking_fingerprint_issue_state.issue_status), error_tracking_fingerprint_issue_state.version), 1)) AS issue_status,- toNullable(tupleElement(argMax(tuple(error_tracking_fingerprint_issue_state.assigned_user_id), error_tracking_fingerprint_issue_state.version), 1)) AS assigned_user_id,- toNullable(tupleElement(argMax(tuple(error_tracking_fingerprint_issue_state.assigned_role_id), error_tracking_fingerprint_issue_state.version), 1)) AS assigned_role_id,- toNullable(tupleElement(argMax(tuple(toTimeZone(error_tracking_fingerprint_issue_state.first_seen, 'UTC')), error_tracking_fingerprint_issue_state.version), 1)) AS first_seen- FROM error_tracking_fingerprint_issue_state- WHERE equals(error_tracking_fingerprint_issue_state.team_id, 99999)- GROUP BY fp_hash- HAVING equals(argMax(error_tracking_fingerprint_issue_state.is_deleted, error_tracking_fingerprint_issue_state.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__fingerprint_issue_state ON equals(cityHash64(if(notEquals(toJSONString(events.properties.^`$exception_fingerprint`), '{}'), toJSONString(events.properties.^`$exception_fingerprint`), if(isNull(nullIf(toString(events.properties.`$exception_fingerprint`), '')), NULL, if(and(in(ascii(toString(events.properties.`$exception_fingerprint`)), tuple(91, 123)), in(ascii(toJSONString(events.properties.`$exception_fingerprint`)), tuple(91, 123))), nullIf(nullIf(toJSONString(events.properties.`$exception_fingerprint`), '[]'), '{}'), toString(events.properties.`$exception_fingerprint`))))), events__fingerprint_issue_state.fp_hash)- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS events__override ON equals(events.distinct_id, events__override.distinct_id)- WHERE and(equals(events.team_id, 99999), equals(events.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(events.timestamp, 'UTC'), 'UTC'), assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC'))), less(toDateTime(toTimeZone(events.timestamp, 'UTC'), 'UTC'), assumeNotNull(toDateTime('2020-01-14 23:59:59', 'UTC'))), notIn(events.event, tuple('paid', 'user signed up')), in(events.event, tuple('positively_related', 'negatively_related')))),- 2 AS target_step- SELECT if(ifNull(equals((prop).1, 'Total_Values_In_Query'), 0), 'Total_Values_In_Query', concat(ifNull(toString((prop).1), ''), '::', ifNull(toString((prop).2), ''), '::', ifNull(toString((prop).3), ''))) AS name,- countDistinctIf(actor_id, ifNull(equals(steps, target_step), isNull(steps)- and isNull(target_step))) AS success_count,- countDistinctIf(actor_id, ifNull(notEquals(steps, target_step), isNotNull(steps)- or isNotNull(target_step))) AS failure_count- FROM- (SELECT funnel_actors.actor_id AS actor_id,- funnel_actors.steps AS steps,- arrayJoin(arrayConcat([tuple('Total_Values_In_Query', '', '')], if(empty(event_table.event), [], arrayMap(prop -> tuple(event_table.event, prop.1, prop.2), JSONExtractKeysAndValues(event_table.properties, 'String'))))) AS prop- FROM filtered_events AS event_table- RIGHT JOIN funnel_actors ON and(equals(funnel_actors.actor_id, event_table.`$group_1`), greater(toTimeZone(toDateTime(toTimeZone(event_table.timestamp, 'UTC'), 'UTC'), 'UTC'), toTimeZone(funnel_actors.first_timestamp, 'UTC')), less(toTimeZone(toDateTime(toTimeZone(event_table.timestamp, 'UTC'), 'UTC'), 'UTC'), coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), assumeNotNull(toDateTime('2020-01-14 23:59:59', 'UTC'))))))- GROUP BY name,- prop- HAVING or(equals(name, 'Total_Values_In_Query'), greater(plus(success_count, failure_count), 2))- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_events_and_groups[new_events_schema.1]- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.properties.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')) AS date_from,- assumeNotNull(toDateTime('2020-01-14 23:59:59', 'UTC')) AS date_to,- 2 AS target_step,- ['paid', 'user signed up'] AS funnel_step_names SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM events_json AS event- JOIN funnel_actors ON equals(funnel_actors.actor_id, event.properties.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'positively_related'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step)))- GROUP BY actor_id- ORDER BY actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_events_and_groups[new_events_schema.2]- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.properties.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')) AS date_from,- assumeNotNull(toDateTime('2020-01-14 23:59:59', 'UTC')) AS date_to,- 2 AS target_step,- ['paid', 'user signed up'] AS funnel_step_names SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM events_json AS event- JOIN funnel_actors ON equals(funnel_actors.actor_id, event.properties.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'positively_related'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step)))- GROUP BY actor_id- ORDER BY actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_events_and_groups[new_events_schema.3]- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.properties.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')) AS date_from,- assumeNotNull(toDateTime('2020-01-14 23:59:59', 'UTC')) AS date_to,- 2 AS target_step,- ['paid', 'user signed up'] AS funnel_step_names SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM events_json AS event- JOIN funnel_actors ON equals(funnel_actors.actor_id, event.properties.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step)))- GROUP BY actor_id- ORDER BY actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_events_and_groups[new_events_schema.4]- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.properties.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')) AS date_from,- assumeNotNull(toDateTime('2020-01-14 23:59:59', 'UTC')) AS date_to,- 2 AS target_step,- ['paid', 'user signed up'] AS funnel_step_names SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM events_json AS event- JOIN funnel_actors ON equals(funnel_actors.actor_id, event.properties.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step)))- GROUP BY actor_id- ORDER BY actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_events_and_groups[new_events_schema.5]- '''- WITH funnel_actors AS MATERIALIZED- (SELECT aggregation_target AS actor_id, (matched_events_array[1][1]).1 AS timestamp, nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp, (matched_events_array[1][1]).1 AS first_timestamp, steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array, [''] AS prop, arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple, af_tuple.1 AS step_reached, plus(af_tuple.1, 1) AS steps, af_tuple.2 AS breakdown, af_tuple.3 AS timings, af_tuple.4 AS matched_event_uuids_array_array, groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events, mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map, arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array, af_tuple.5 AS steps_bitfield, aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp, e.properties.`$group_0` AS aggregation_target, e.uuid AS uuid, e.properties.`$session_id` AS `$session_id`, e.properties.`$window_id` AS `$window_id`, if(equals(e.event, 'user signed up'), 1, 0) AS step_0, if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- LEFT JOIN- (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(groups.group_properties, 'industry'), ''), 'null'), '^"|"$', '')), toTimeZone(groups._timestamp, 'UTC')), 1) AS properties___industry, groups.group_type_index AS index, groups.group_key AS key- FROM groups- WHERE and(equals(groups.team_id, 99999), equals(index, 0))- GROUP BY groups.group_type_index, groups.group_key) AS e__group_0 ON equals(e.properties.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), ifNull(equals(e__group_0.properties___industry, 'finance'), 0), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')) AS date_from,- assumeNotNull(toDateTime('2020-01-14 23:59:59', 'UTC')) AS date_to,- 2 AS target_step,- ['paid', 'user signed up'] AS funnel_step_names- SELECT event.event AS name,- countDistinctIf(funnel_actors.actor_id, ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))) AS success_count,- countDistinctIf(funnel_actors.actor_id, ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))) AS failure_count- FROM events_json AS event- JOIN funnel_actors ON equals(funnel_actors.actor_id, event.properties.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), notIn(event.event, []))- GROUP BY name- LIMIT 100- UNION ALL- SELECT 'Total_Values_In_Query' AS name,- countDistinctIf(funnel_actors.actor_id, ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))) AS success_count,- countDistinctIf(funnel_actors.actor_id, ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))) AS failure_count- FROM funnel_actors- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_events_and_groups[new_events_schema.6]- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.properties.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')) AS date_from,- assumeNotNull(toDateTime('2020-01-14 23:59:59', 'UTC')) AS date_to,- 2 AS target_step,- ['paid', 'user signed up'] AS funnel_step_names SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM events_json AS event- JOIN funnel_actors ON equals(funnel_actors.actor_id, event.properties.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step)))- GROUP BY actor_id- ORDER BY actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_events_and_groups[new_events_schema.7]- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.properties.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')) AS date_from,- assumeNotNull(toDateTime('2020-01-14 23:59:59', 'UTC')) AS date_to,- 2 AS target_step,- ['paid', 'user signed up'] AS funnel_step_names SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM events_json AS event- JOIN funnel_actors ON equals(funnel_actors.actor_id, event.properties.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'negatively_related'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step)))- GROUP BY actor_id- ORDER BY actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_events_and_groups[new_events_schema]- '''- WITH funnel_actors AS MATERIALIZED- (SELECT aggregation_target AS actor_id, (matched_events_array[1][1]).1 AS timestamp, nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp, (matched_events_array[1][1]).1 AS first_timestamp, steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array, [''] AS prop, arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple, af_tuple.1 AS step_reached, plus(af_tuple.1, 1) AS steps, af_tuple.2 AS breakdown, af_tuple.3 AS timings, af_tuple.4 AS matched_event_uuids_array_array, groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events, mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map, arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array, af_tuple.5 AS steps_bitfield, aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp, e.properties.`$group_0` AS aggregation_target, e.uuid AS uuid, e.properties.`$session_id` AS `$session_id`, e.properties.`$window_id` AS `$window_id`, if(equals(e.event, 'user signed up'), 1, 0) AS step_0, if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- assumeNotNull(toDateTime('2020-01-01 00:00:00', 'UTC')) AS date_from,- assumeNotNull(toDateTime('2020-01-14 23:59:59', 'UTC')) AS date_to,- 2 AS target_step,- ['paid', 'user signed up'] AS funnel_step_names- SELECT event.event AS name,- countDistinctIf(funnel_actors.actor_id, ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))) AS success_count,- countDistinctIf(funnel_actors.actor_id, ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))) AS failure_count- FROM events_json AS event- JOIN funnel_actors ON equals(funnel_actors.actor_id, event.properties.`$group_0`)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), notIn(event.event, []))- GROUP BY name- LIMIT 100- UNION ALL- SELECT 'Total_Values_In_Query' AS name,- countDistinctIf(funnel_actors.actor_id, ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))) AS success_count,- countDistinctIf(funnel_actors.actor_id, ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))) AS failure_count- FROM funnel_actors- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups[new_events_schema.1]- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.properties.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- LEFT JOIN- (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(groups.group_properties, 'industry'), ''), 'null'), '^"|"$', '')), toTimeZone(groups._timestamp, 'UTC')), 1) AS properties___industry,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE and(equals(groups.team_id, 99999), equals(index, 0))- GROUP BY groups.group_type_index,- groups.group_key) AS e__group_0 ON equals(e.properties.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), ifNull(equals(e__group_0.properties___industry, 'positive'), 0), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM funnel_actors- WHERE ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups[new_events_schema.2]- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.properties.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- LEFT JOIN- (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(groups.group_properties, 'industry'), ''), 'null'), '^"|"$', '')), toTimeZone(groups._timestamp, 'UTC')), 1) AS properties___industry,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE and(equals(groups.team_id, 99999), equals(index, 0))- GROUP BY groups.group_type_index,- groups.group_key) AS e__group_0 ON equals(e.properties.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), ifNull(equals(e__group_0.properties___industry, 'positive'), 0), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM funnel_actors- WHERE ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups[new_events_schema.3]- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.properties.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- LEFT JOIN- (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(groups.group_properties, 'industry'), ''), 'null'), '^"|"$', '')), toTimeZone(groups._timestamp, 'UTC')), 1) AS properties___industry,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE and(equals(groups.team_id, 99999), equals(index, 0))- GROUP BY groups.group_type_index,- groups.group_key) AS e__group_0 ON equals(e.properties.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), ifNull(equals(e__group_0.properties___industry, 'negative'), 0), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM funnel_actors- WHERE ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups[new_events_schema.4]- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.properties.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- LEFT JOIN- (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(groups.group_properties, 'industry'), ''), 'null'), '^"|"$', '')), toTimeZone(groups._timestamp, 'UTC')), 1) AS properties___industry,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE and(equals(groups.team_id, 99999), equals(index, 0))- GROUP BY groups.group_type_index,- groups.group_key) AS e__group_0 ON equals(e.properties.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), ifNull(equals(e__group_0.properties___industry, 'negative'), 0), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM funnel_actors- WHERE ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups[new_events_schema.5]- '''- WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.properties.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step- SELECT if(equals((aggregation_target_with_props.prop).1, 'Total_Values_In_Query'), 'Total_Values_In_Query', concat(ifNull(toString((aggregation_target_with_props.prop).1), ''), '::', ifNull(toString((aggregation_target_with_props.prop).2), ''))) AS name,- countDistinctIf(aggregation_target_with_props.actor_id, ifNull(equals(aggregation_target_with_props.steps, target_step), isNull(aggregation_target_with_props.steps)- and isNull(target_step))) AS success_count,- countDistinctIf(aggregation_target_with_props.actor_id, ifNull(notEquals(aggregation_target_with_props.steps, target_step), isNotNull(aggregation_target_with_props.steps)- or isNotNull(target_step))) AS failure_count- FROM- (SELECT funnel_actors.actor_id AS actor_id,- funnel_actors.steps AS steps,- arrayJoin(arrayConcat([tuple('Total_Values_In_Query', '')], JSONExtractKeysAndValues(groups_0.properties, 'String'))) AS prop- FROM funnel_actors- LEFT JOIN- (SELECT groups.key AS key,- groups.properties AS properties- FROM- (SELECT argMax(groups.group_properties, toTimeZone(groups._timestamp, 'UTC')) AS properties,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE equals(groups.team_id, 99999)- GROUP BY groups.group_type_index,- groups.group_key) AS groups- WHERE equals(groups.index, 0)) AS groups_0 ON equals(funnel_actors.actor_id, groups_0.key)) AS aggregation_target_with_props- GROUP BY (aggregation_target_with_props.prop).1, (aggregation_target_with_props.prop).2- HAVING or(equals((aggregation_target_with_props.prop).1, 'Total_Values_In_Query'), notIn((aggregation_target_with_props.prop).1, []))- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups[new_events_schema]- '''- WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.properties.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step- SELECT if(equals((aggregation_target_with_props.prop).1, 'Total_Values_In_Query'), 'Total_Values_In_Query', concat(ifNull(toString((aggregation_target_with_props.prop).1), ''), '::', ifNull(toString((aggregation_target_with_props.prop).2), ''))) AS name,- countDistinctIf(aggregation_target_with_props.actor_id, ifNull(equals(aggregation_target_with_props.steps, target_step), isNull(aggregation_target_with_props.steps)- and isNull(target_step))) AS success_count,- countDistinctIf(aggregation_target_with_props.actor_id, ifNull(notEquals(aggregation_target_with_props.steps, target_step), isNotNull(aggregation_target_with_props.steps)- or isNotNull(target_step))) AS failure_count- FROM- (SELECT funnel_actors.actor_id AS actor_id,- funnel_actors.steps AS steps,- arrayJoin(arrayConcat([tuple('Total_Values_In_Query', '')], arrayZip(['industry'], [JSONExtractString(groups_0.properties, 'industry')]))) AS prop- FROM funnel_actors- LEFT JOIN- (SELECT groups.key AS key,- groups.properties AS properties- FROM- (SELECT argMax(groups.group_properties, toTimeZone(groups._timestamp, 'UTC')) AS properties,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE equals(groups.team_id, 99999)- GROUP BY groups.group_type_index,- groups.group_key) AS groups- WHERE equals(groups.index, 0)) AS groups_0 ON equals(funnel_actors.actor_id, groups_0.key)) AS aggregation_target_with_props- GROUP BY (aggregation_target_with_props.prop).1, (aggregation_target_with_props.prop).2- HAVING or(equals((aggregation_target_with_props.prop).1, 'Total_Values_In_Query'), notIn((aggregation_target_with_props.prop).1, []))- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups_person_on_events[new_events_schema.1]- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.properties.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- LEFT JOIN- (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(groups.group_properties, 'industry'), ''), 'null'), '^"|"$', '')), toTimeZone(groups._timestamp, 'UTC')), 1) AS properties___industry,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE and(equals(groups.team_id, 99999), equals(index, 0))- GROUP BY groups.group_type_index,- groups.group_key) AS e__group_0 ON equals(e.properties.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), ifNull(equals(e__group_0.properties___industry, 'positive'), 0), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM funnel_actors- WHERE ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups_person_on_events[new_events_schema.2]- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.properties.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- LEFT JOIN- (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(groups.group_properties, 'industry'), ''), 'null'), '^"|"$', '')), toTimeZone(groups._timestamp, 'UTC')), 1) AS properties___industry,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE and(equals(groups.team_id, 99999), equals(index, 0))- GROUP BY groups.group_type_index,- groups.group_key) AS e__group_0 ON equals(e.properties.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), ifNull(equals(e__group_0.properties___industry, 'positive'), 0), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM funnel_actors- WHERE ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups_person_on_events[new_events_schema.3]- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.properties.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- LEFT JOIN- (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(groups.group_properties, 'industry'), ''), 'null'), '^"|"$', '')), toTimeZone(groups._timestamp, 'UTC')), 1) AS properties___industry,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE and(equals(groups.team_id, 99999), equals(index, 0))- GROUP BY groups.group_type_index,- groups.group_key) AS e__group_0 ON equals(e.properties.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), ifNull(equals(e__group_0.properties___industry, 'negative'), 0), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM funnel_actors- WHERE ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups_person_on_events[new_events_schema.4]- '''- SELECT source.actor_id AS actor_id- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.properties.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- LEFT JOIN- (SELECT tupleElement(argMax(tuple(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(groups.group_properties, 'industry'), ''), 'null'), '^"|"$', '')), toTimeZone(groups._timestamp, 'UTC')), 1) AS properties___industry,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE and(equals(groups.team_id, 99999), equals(index, 0))- GROUP BY groups.group_type_index,- groups.group_key) AS e__group_0 ON equals(e.properties.`$group_0`, e__group_0.key)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), ifNull(equals(e__group_0.properties___industry, 'negative'), 0), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS key- FROM funnel_actors- WHERE ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.actor_id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups_person_on_events[new_events_schema.5]- '''- WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.properties.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step- SELECT if(equals((aggregation_target_with_props.prop).1, 'Total_Values_In_Query'), 'Total_Values_In_Query', concat(ifNull(toString((aggregation_target_with_props.prop).1), ''), '::', ifNull(toString((aggregation_target_with_props.prop).2), ''))) AS name,- countDistinctIf(aggregation_target_with_props.actor_id, ifNull(equals(aggregation_target_with_props.steps, target_step), isNull(aggregation_target_with_props.steps)- and isNull(target_step))) AS success_count,- countDistinctIf(aggregation_target_with_props.actor_id, ifNull(notEquals(aggregation_target_with_props.steps, target_step), isNotNull(aggregation_target_with_props.steps)- or isNotNull(target_step))) AS failure_count- FROM- (SELECT funnel_actors.actor_id AS actor_id,- funnel_actors.steps AS steps,- arrayJoin(arrayConcat([tuple('Total_Values_In_Query', '')], JSONExtractKeysAndValues(groups_0.properties, 'String'))) AS prop- FROM funnel_actors- LEFT JOIN- (SELECT groups.key AS key,- groups.properties AS properties- FROM- (SELECT argMax(groups.group_properties, toTimeZone(groups._timestamp, 'UTC')) AS properties,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE equals(groups.team_id, 99999)- GROUP BY groups.group_type_index,- groups.group_key) AS groups- WHERE equals(groups.index, 0)) AS groups_0 ON equals(funnel_actors.actor_id, groups_0.key)) AS aggregation_target_with_props- GROUP BY (aggregation_target_with_props.prop).1, (aggregation_target_with_props.prop).2- HAVING or(equals((aggregation_target_with_props.prop).1, 'Total_Values_In_Query'), notIn((aggregation_target_with_props.prop).1, []))- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestClickhouseFunnelCorrelation.test_funnel_correlation_with_properties_and_groups_person_on_events[new_events_schema]- '''- WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- e.properties.`$group_0` AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, 'user signed up'), 1, 0) AS step_0,- if(equals(e.event, 'paid'), 1, 0) AS step_1- FROM events_json AS e- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('2020-01-01 00:00:00.000000', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('2020-01-14 23:59:59.999999', 6, 'UTC'))), in(e.event, tuple('paid', 'user signed up')), and(notEquals(toString(aggregation_target), ''), isNotNull(aggregation_target))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step- SELECT if(equals((aggregation_target_with_props.prop).1, 'Total_Values_In_Query'), 'Total_Values_In_Query', concat(ifNull(toString((aggregation_target_with_props.prop).1), ''), '::', ifNull(toString((aggregation_target_with_props.prop).2), ''))) AS name,- countDistinctIf(aggregation_target_with_props.actor_id, ifNull(equals(aggregation_target_with_props.steps, target_step), isNull(aggregation_target_with_props.steps)- and isNull(target_step))) AS success_count,- countDistinctIf(aggregation_target_with_props.actor_id, ifNull(notEquals(aggregation_target_with_props.steps, target_step), isNotNull(aggregation_target_with_props.steps)- or isNotNull(target_step))) AS failure_count- FROM- (SELECT funnel_actors.actor_id AS actor_id,- funnel_actors.steps AS steps,- arrayJoin(arrayConcat([tuple('Total_Values_In_Query', '')], arrayZip(['industry'], [JSONExtractString(groups_0.properties, 'industry')]))) AS prop- FROM funnel_actors- LEFT JOIN- (SELECT groups.key AS key,- groups.properties AS properties- FROM- (SELECT argMax(groups.group_properties, toTimeZone(groups._timestamp, 'UTC')) AS properties,- groups.group_type_index AS index,- groups.group_key AS key- FROM groups- WHERE equals(groups.team_id, 99999)- GROUP BY groups.group_type_index,- groups.group_key) AS groups- WHERE equals(groups.index, 0)) AS groups_0 ON equals(funnel_actors.actor_id, groups_0.key)) AS aggregation_target_with_props- GROUP BY (aggregation_target_with_props.prop).1, (aggregation_target_with_props.prop).2- HAVING or(equals((aggregation_target_with_props.prop).1, 'Total_Values_In_Query'), notIn((aggregation_target_with_props.prop).1, []))- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ---diff --git a/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation_actors.ambr b/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation_actors.ambrdeleted file mode 100644index 5d969373bdad..000000000000--- a/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation_actors.ambr+++ /dev/null@@ -1,318 +0,0 @@-# serializer version: 1-# name: TestFunnelCorrelationActors.test_funnel_correlation_on_event_with_recordings- '''- SELECT source.id,- source.id AS id,- source.matching_events AS matching_events- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id) AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, '$pageview'), 1, 0) AS step_0,- if(equals(e.event, 'insight analyzed'), 1, 0) AS step_1- FROM events AS e- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(e.event, tuple('$pageview', 'insight analyzed'))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- assumeNotNull(toDateTime('2021-01-01 00:00:00', 'UTC')) AS date_from,- assumeNotNull(toDateTime('2021-01-08 23:59:59', 'UTC')) AS date_to,- 2 AS target_step,- ['$pageview', 'insight analyzed'] AS funnel_step_names SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS id- FROM events AS event- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS event__override ON equals(event.distinct_id, event__override.distinct_id)- JOIN funnel_actors ON equals(if(not(empty(event__override.distinct_id)), event__override.person_id, event.person_id), funnel_actors.actor_id)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'insight loaded'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step)))- GROUP BY actor_id- ORDER BY actor_id ASC) AS source- ORDER BY source.id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestFunnelCorrelationActors.test_funnel_correlation_on_event_with_recordings.1- '''- SELECT session_replay_events.session_id AS session_id,- min(toTimeZone(session_replay_events.min_first_timestamp, 'UTC')) AS start_time,- max(session_replay_events.retention_period_days) AS retention_period_days,- plus(dateTrunc('DAY', start_time), toIntervalDay(coalesce(retention_period_days, 30))) AS expiry_time- FROM session_replay_events- WHERE and(equals(session_replay_events.team_id, 99999), in(session_replay_events.session_id, ['s2']))- GROUP BY session_replay_events.session_id- HAVING and(greaterOrEquals(expiry_time, toDateTime64('2021-01-02 00:00:00.000000', 6, 'UTC')), equals(max(session_replay_events.is_deleted), 0))- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestFunnelCorrelationActors.test_funnel_correlation_on_event_with_recordings.2- '''- SELECT source.id,- source.id AS id,- source.matching_events AS matching_events- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[3][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(3, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id) AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, '$pageview'), 1, 0) AS step_0,- if(equals(e.event, 'insight analyzed'), 1, 0) AS step_1,- if(equals(e.event, 'insight updated'), 1, 0) AS step_2- FROM events AS e- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(e.event, tuple('$pageview', 'insight analyzed', 'insight updated'))), or(equals(step_0, 1), equals(step_1, 1), equals(step_2, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- assumeNotNull(toDateTime('2021-01-01 00:00:00', 'UTC')) AS date_from,- assumeNotNull(toDateTime('2021-01-08 23:59:59', 'UTC')) AS date_to,- 3 AS target_step,- ['$pageview', 'insight analyzed', 'insight updated'] AS funnel_step_names SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS id- FROM events AS event- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS event__override ON equals(event.distinct_id, event__override.distinct_id)- JOIN funnel_actors ON equals(if(not(empty(event__override.distinct_id)), event__override.person_id, event.person_id), funnel_actors.actor_id)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'insight loaded'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step)))- GROUP BY actor_id- ORDER BY actor_id ASC) AS source- ORDER BY source.id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestFunnelCorrelationActors.test_funnel_correlation_on_event_with_recordings.3- '''- SELECT session_replay_events.session_id AS session_id,- min(toTimeZone(session_replay_events.min_first_timestamp, 'UTC')) AS start_time,- max(session_replay_events.retention_period_days) AS retention_period_days,- plus(dateTrunc('DAY', start_time), toIntervalDay(coalesce(retention_period_days, 30))) AS expiry_time- FROM session_replay_events- WHERE and(equals(session_replay_events.team_id, 99999), in(session_replay_events.session_id, ['s2']))- GROUP BY session_replay_events.session_id- HAVING and(greaterOrEquals(expiry_time, toDateTime64('2021-01-02 00:00:00.000000', 6, 'UTC')), equals(max(session_replay_events.is_deleted), 0))- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestFunnelCorrelationActors.test_funnel_correlation_on_properties_with_recordings- '''- SELECT source.id,- source.id AS id,- source.matching_events AS matching_events- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id) AS aggregation_target,- e.uuid AS uuid,- e.`$session_id` AS `$session_id`,- e.`$window_id` AS `$window_id`,- if(equals(e.event, '$pageview'), 1, 0) AS step_0,- if(equals(e.event, 'insight analyzed'), 1, 0) AS step_1- FROM events AS e- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(e.event, tuple('$pageview', 'insight analyzed')), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, 'foo'), ''), 'null'), '^"|"$', ''), 'bar'), 0)), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS id- FROM funnel_actors- WHERE ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ----# name: TestFunnelCorrelationActors.test_funnel_correlation_on_properties_with_recordings.1- '''- SELECT session_replay_events.session_id AS session_id,- min(toTimeZone(session_replay_events.min_first_timestamp, 'UTC')) AS start_time,- max(session_replay_events.retention_period_days) AS retention_period_days,- plus(dateTrunc('DAY', start_time), toIntervalDay(coalesce(retention_period_days, 30))) AS expiry_time- FROM session_replay_events- WHERE and(equals(session_replay_events.team_id, 99999), in(session_replay_events.session_id, ['s2']))- GROUP BY session_replay_events.session_id- HAVING and(greaterOrEquals(expiry_time, toDateTime64('2021-01-02 00:00:00.000000', 6, 'UTC')), equals(max(session_replay_events.is_deleted), 0))- LIMIT 100 SETTINGS readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0- '''-# ---diff --git a/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation_actors.new_events_schema.ambr b/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation_actors.new_events_schema.ambrdeleted file mode 100644index 0e2333b3b528..000000000000--- a/products/product_analytics/backend/hogql_queries/funnels/test/__snapshots__/test_funnel_correlation_actors.new_events_schema.ambr+++ /dev/null@@ -1,252 +0,0 @@-# serializer version: 1-# name: TestFunnelCorrelationActors.test_funnel_correlation_on_event_with_recordings[new_events_schema.1]- '''- SELECT source.id,- source.id AS id,- source.matching_events AS matching_events- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[3][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1), multiply(3, step_2)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(3, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id) AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, '$pageview'), 1, 0) AS step_0,- if(equals(e.event, 'insight analyzed'), 1, 0) AS step_1,- if(equals(e.event, 'insight updated'), 1, 0) AS step_2- FROM events_json AS e- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(e.event, tuple('$pageview', 'insight analyzed', 'insight updated'))), or(equals(step_0, 1), equals(step_1, 1), equals(step_2, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- assumeNotNull(toDateTime('2021-01-01 00:00:00', 'UTC')) AS date_from,- assumeNotNull(toDateTime('2021-01-08 23:59:59', 'UTC')) AS date_to,- 3 AS target_step,- ['$pageview', 'insight analyzed', 'insight updated'] AS funnel_step_names SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS id- FROM events_json AS event- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS event__override ON equals(event.distinct_id, event__override.distinct_id)- JOIN funnel_actors ON equals(if(not(empty(event__override.distinct_id)), event__override.person_id, event.person_id), funnel_actors.actor_id)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'insight loaded'), ifNull(notEquals(funnel_actors.steps, target_step), isNotNull(funnel_actors.steps)- or isNotNull(target_step)))- GROUP BY actor_id- ORDER BY actor_id ASC) AS source- ORDER BY source.id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestFunnelCorrelationActors.test_funnel_correlation_on_event_with_recordings[new_events_schema]- '''- SELECT source.id,- source.id AS id,- source.matching_events AS matching_events- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id) AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, '$pageview'), 1, 0) AS step_0,- if(equals(e.event, 'insight analyzed'), 1, 0) AS step_1- FROM events_json AS e- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(e.event, tuple('$pageview', 'insight analyzed'))), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- assumeNotNull(toDateTime('2021-01-01 00:00:00', 'UTC')) AS date_from,- assumeNotNull(toDateTime('2021-01-08 23:59:59', 'UTC')) AS date_to,- 2 AS target_step,- ['$pageview', 'insight analyzed'] AS funnel_step_names SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS id- FROM events_json AS event- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS event__override ON equals(event.distinct_id, event__override.distinct_id)- JOIN funnel_actors ON equals(if(not(empty(event__override.distinct_id)), event__override.person_id, event.person_id), funnel_actors.actor_id)- WHERE and(equals(event.team_id, 99999), greaterOrEquals(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_from, 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(date_to, 6, 'UTC')), equals(event.team_id, 99999), greater(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 6, 'UTC')), less(toDateTime(toTimeZone(event.timestamp, 'UTC'), 'UTC'), toDateTime64(coalesce(toTimeZone(funnel_actors.final_timestamp, 'UTC'), plus(toTimeZone(toTimeZone(funnel_actors.first_timestamp, 'UTC'), 'UTC'), toIntervalDay(14)), date_to), 6, 'UTC')), notIn(event.event, funnel_step_names), equals(event.event, 'insight loaded'), ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step)))- GROUP BY actor_id- ORDER BY actor_id ASC) AS source- ORDER BY source.id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ----# name: TestFunnelCorrelationActors.test_funnel_correlation_on_properties_with_recordings[new_events_schema]- '''- SELECT source.id,- source.id AS id,- source.matching_events AS matching_events- FROM- (WITH funnel_actors AS- (SELECT aggregation_target AS actor_id,- matched_events_array[plus(step_reached, 1)] AS matching_events,- (matched_events_array[1][1]).1 AS timestamp,- nullIf((matched_events_array[2][1]).1, 0) AS final_timestamp,- (matched_events_array[1][1]).1 AS first_timestamp,- steps AS steps- FROM- (SELECT arraySort(t -> t.1, groupArray(tuple(accurateCastOrNull(timestamp, 'Float64'), uuid, '', arrayFilter(x -> ifNull(notEquals(x, 0), 1), [multiply(1, step_0), multiply(2, step_1)])))) AS events_array,- [''] AS prop,- arrayJoin(aggregate_funnel(2, 1209600, 'first_touch', 'ordered', prop, [], arrayFilter((x, x_before, x_after) -> not(and(lessOrEquals(length(x.4), 1), equals(x.4, x_before.4), equals(x.4, x_after.4), equals(x.3, x_before.3), equals(x.3, x_after.3), ifNull(greater(x.1, x_before.1), 0), ifNull(less(x.1, x_after.1), 0))), events_array, arrayRotateRight(events_array, 1), arrayRotateLeft(events_array, 1)))) AS af_tuple,- af_tuple.1 AS step_reached,- plus(af_tuple.1, 1) AS steps,- af_tuple.2 AS breakdown,- af_tuple.3 AS timings,- af_tuple.4 AS matched_event_uuids_array_array,- groupArray(tuple(timestamp, uuid, `$session_id`, `$window_id`)) AS user_events,- mapFromArrays(arrayMap(x -> x.2, user_events), user_events) AS user_events_map,- arrayMap(matched_event_uuids_array -> arrayMap(event_uuid -> user_events_map[event_uuid], arrayDistinct(matched_event_uuids_array)), matched_event_uuids_array_array) AS matched_events_array,- af_tuple.5 AS steps_bitfield,- aggregation_target AS aggregation_target- FROM- (SELECT toTimeZone(e.timestamp, 'UTC') AS timestamp,- if(not(empty(e__override.distinct_id)), e__override.person_id, e.person_id) AS aggregation_target,- e.uuid AS uuid,- e.properties.`$session_id` AS `$session_id`,- e.properties.`$window_id` AS `$window_id`,- if(equals(e.event, '$pageview'), 1, 0) AS step_0,- if(equals(e.event, 'insight analyzed'), 1, 0) AS step_1- FROM events_json AS e- LEFT OUTER JOIN- (SELECT argMax(person_distinct_id_overrides.person_id, person_distinct_id_overrides.version) AS person_id,- person_distinct_id_overrides.distinct_id AS distinct_id- FROM person_distinct_id_overrides- WHERE equals(person_distinct_id_overrides.team_id, 99999)- GROUP BY person_distinct_id_overrides.distinct_id- HAVING equals(argMax(person_distinct_id_overrides.is_deleted, person_distinct_id_overrides.version), 0) SETTINGS optimize_aggregation_in_order=1) AS e__override ON equals(e.distinct_id, e__override.distinct_id)- WHERE and(equals(e.team_id, 99999), and(and(greaterOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC')), lessOrEquals(e.timestamp, toDateTime64('explicit_redacted_timestamp', 6, 'UTC'))), in(e.event, tuple('$pageview', 'insight analyzed')), ifNull(equals(CAST(e.person_properties.foo, 'Nullable(String)'), 'bar'), 0)), or(equals(step_0, 1), equals(step_1, 1))))- GROUP BY aggregation_target- HAVING ifNull(greaterOrEquals(step_reached, 0), 0))- WHERE bitTest(steps_bitfield, 0)- ORDER BY aggregation_target ASC SETTINGS join_algorithm='auto'),- 2 AS target_step SELECT funnel_actors.actor_id AS actor_id,- any(funnel_actors.matching_events) AS matching_events,- actor_id AS id- FROM funnel_actors- WHERE ifNull(equals(funnel_actors.steps, target_step), isNull(funnel_actors.steps)- and isNull(target_step))- GROUP BY funnel_actors.actor_id- ORDER BY funnel_actors.actor_id ASC) AS source- ORDER BY source.id ASC- LIMIT 101- OFFSET 0 SETTINGS optimize_aggregation_in_order=1,- join_algorithm='auto',- readonly=2,- max_execution_time=60,- allow_experimental_object_type=1,- max_ast_elements=4000000,- max_expanded_ast_elements=4000000,- max_bytes_before_external_group_by=0,- transform_null_in=1,- optimize_min_equality_disjunction_chain_length=4294967295,- optimize_rewrite_aggregate_function_with_if=0,- optimize_min_inequality_conjunction_chain_length=4294967295,- allow_experimental_join_condition=1,- use_hive_partitioning=0,- json_type_escape_dots_in_keys=1,- output_format_json_escape_forward_slashes=0- '''-# ---diff --git a/products/product_analytics/backend/hogql_queries/funnels/test/test_funnel_correlation.py b/products/product_analytics/backend/hogql_queries/funnels/test/test_funnel_correlation.pydeleted file mode 100644index 2ff4ccbc5fb8..000000000000--- a/products/product_analytics/backend/hogql_queries/funnels/test/test_funnel_correlation.py+++ /dev/null@@ -1,2499 +0,0 @@-import unittest-import time_machine-from posthog.test.base import (- APIBaseTest,- ClickhouseTestMixin,- _create_action,- _create_event,- _create_person,- also_test_with_materialized_columns,- also_test_with_person_on_events_v2,- flush_persons_and_events,- snapshot_clickhouse_queries,-)-from unittest import skip--from parameterized import parameterized-from rest_framework.exceptions import ValidationError--from posthog.schema import (- ActionsNode,- DateRange,- EventPropertyFilter,- EventsNode,- FunnelConversionWindowTimeUnit,- FunnelCorrelationQuery,- FunnelCorrelationResultsType,- FunnelsActorsQuery,- FunnelsDataWarehouseNode,- FunnelsFilter,- FunnelsQuery,- GroupPropertyFilter,- PersonPropertyFilter,- PropertyOperator,-)--from posthog.models.element import Element-from posthog.models.group.util import create_group-from posthog.models.instance_setting import override_instance_config-from posthog.test.test_journeys import journeys_for-from posthog.test.test_utils import create_group_type_mapping_without_created_at--from products.product_analytics.backend.hogql_queries.funnels.funnel_correlation_query_runner import (- EventContingencyTable,- EventStats,- FunnelCorrelationQueryRunner,-)-from products.product_analytics.backend.hogql_queries.funnels.test.test_funnel_correlation_actors import get_actors---class TestClickhouseFunnelCorrelation(ClickhouseTestMixin, APIBaseTest):- maxDiff = None-- def _get_events_for_query(- self,- funnels_query: FunnelsQuery,- funnelCorrelationType=FunnelCorrelationResultsType.EVENTS,- funnelCorrelationNames=None,- funnelCorrelationExcludeNames=None,- funnelCorrelationExcludeEventNames=None,- funnelCorrelationEventNames=None,- funnelCorrelationEventExcludePropertyNames=None,- ):- actors_query = FunnelsActorsQuery(source=funnels_query)- correlation_query = FunnelCorrelationQuery(- source=actors_query,- funnelCorrelationType=funnelCorrelationType,- funnelCorrelationNames=funnelCorrelationNames,- funnelCorrelationExcludeNames=funnelCorrelationExcludeNames,- funnelCorrelationExcludeEventNames=funnelCorrelationExcludeEventNames,- funnelCorrelationEventNames=funnelCorrelationEventNames,- funnelCorrelationEventExcludePropertyNames=funnelCorrelationEventExcludePropertyNames,- )- calculation = FunnelCorrelationQueryRunner(query=correlation_query, team=self.team)._calculate_internal()- return calculation.events, calculation.skewed_totals-- def _get_actors_for_event(self, funnels_query: FunnelsQuery, event_name: str, properties=None, success=True):- serialized_actors = get_actors(- funnels_query,- self.team,- funnelCorrelationPersonConverted=success,- funnelCorrelationPersonEntity=EventsNode(event=event_name, properties=properties),- )- return [str(row[0]) for row in serialized_actors]-- def _get_actors_for_property(- self, funnels_query: FunnelsQuery, property_values: list, success=True, funnelCorrelationNames=None- ):- funnelCorrelationPropertyValues = [- (- PersonPropertyFilter(key=prop, value=value, operator=PropertyOperator.EXACT)- if type == "person"- else GroupPropertyFilter(- key=prop, value=value, group_type_index=group_type_index, operator=PropertyOperator.EXACT- )- )- for prop, value, type, group_type_index in property_values- ]-- serialized_actors = get_actors(- funnels_query,- self.team,- funnelCorrelationType=FunnelCorrelationResultsType.PROPERTIES,- funnelCorrelationNames=funnelCorrelationNames,- funnelCorrelationPersonConverted=success,- funnelCorrelationPropertyValues=funnelCorrelationPropertyValues,- )- return [str(row[0]) for row in serialized_actors]-- def test_funnel_correlation_with_events_and_hogql_aggregation(self):- # When the funnel aggregates by a custom HogQL expression, the correlation- # event join must use that expression — joining on event.person_id would- # mismatch types (UUID vs the string actor id) and fail the query.- query = FunnelsQuery(- series=[EventsNode(event="user signed up"), EventsNode(event="paid")],- dateRange=DateRange(date_from="2020-01-01", date_to="2020-01-14"),- funnelsFilter=FunnelsFilter(funnelAggregateByHogQL="properties.session_id"),- )-- # Converting sessions (reach "paid") that also fire "positively_related".- for i in range(5):- _create_person(distinct_ids=[f"user_{i}"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- properties={"session_id": f"session_{i}"},- )- _create_event(- team=self.team,- event="positively_related",- distinct_id=f"user_{i}",- timestamp="2020-01-03T14:00:00Z",- properties={"session_id": f"session_{i}"},- )- _create_event(- team=self.team,- event="paid",- distinct_id=f"user_{i}",- timestamp="2020-01-04T14:00:00Z",- properties={"session_id": f"session_{i}"},- )-- # Non-converting sessions (never reach "paid"), needed so odds ratios are- # computable rather than the totals being skewed to 100% conversion.- for i in range(5, 10):- _create_person(distinct_ids=[f"user_{i}"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- properties={"session_id": f"session_{i}"},- )-- # Before the fix this raised TYPE_MISMATCH (joining event.person_id, a UUID,- # against the string actor id). The join must now run and actually match rows.- result, _ = self._get_events_for_query(query)- events = {item["event"]: item for item in result}- self.assertIn("positively_related", events)- self.assertEqual(events["positively_related"]["success_count"], 5)- self.assertEqual(events["positively_related"]["correlation_type"], "success")-- def test_days_of_week_does_not_filter_correlation_events(self):- # daysOfWeek scopes funnel step attribution, not the correlation event scan. Actors are- # already day-filtered, so correlation answers "what else did these people do while- # converting" over their whole window — a Saturday event still counts as a correlate.- # 2020-01-10 is a Friday, 2020-01-11 a Saturday, 2020-01-13 a Monday.- query = FunnelsQuery(- series=[EventsNode(event="user signed up"), EventsNode(event="paid")],- dateRange=DateRange(date_from="2020-01-06", date_to="2020-01-20", daysOfWeek=[1, 2, 3, 4, 5]),- )-- # Converters: both steps on included weekdays, spanning a weekend, plus a Saturday event.- for i in range(5):- _create_person(distinct_ids=[f"converter_{i}"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"converter_{i}",- timestamp="2020-01-10T14:00:00Z",- )- _create_event(- team=self.team,- event="weekend_thing",- distinct_id=f"converter_{i}",- timestamp="2020-01-11T14:00:00Z",- )- _create_event(team=self.team, event="paid", distinct_id=f"converter_{i}", timestamp="2020-01-13T14:00:00Z")-- # Non-converters, so failure_total is non-zero and odds ratios are computable.- for i in range(5):- _create_person(distinct_ids=[f"dropper_{i}"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"dropper_{i}",- timestamp="2020-01-10T14:00:00Z",- )-- flush_persons_and_events()-- result, _ = self._get_events_for_query(query)- events = {item["event"]: item for item in result}- self.assertIn("weekend_thing", events)- self.assertEqual(events["weekend_thing"]["success_count"], 5)-- def test_funnel_correlation_hogql_aggregation_rejects_injection(self):- # funnelAggregateByHogQL is user-controlled — a value that isn't a single- # bounded expression (e.g. an attempt to inject an extra JOIN) must be- # rejected by the parser, not interpolated into the query.- query = FunnelsQuery(- series=[EventsNode(event="user signed up"), EventsNode(event="paid")],- dateRange=DateRange(date_from="2020-01-01", date_to="2020-01-14"),- funnelsFilter=FunnelsFilter(funnelAggregateByHogQL="properties.session_id JOIN persons ON 1=1"),- )- with self.assertRaises(Exception):- self._get_events_for_query(query)-- def test_funnel_correlation_with_properties_and_hogql_aggregation(self):- # Property correlation joins funnel_actors onto the persons table on actor_id. When- # the funnel aggregates by a HogQL expression, actor_id holds that value (a string)- # rather than a person UUID, so the join used to fail with "no supertype for types- # UUID, String". It must now run without raising rather than crashing the panel.- # Every actor converts here, so failure_total is 0 and the runner short-circuits to [].- query = FunnelsQuery(- series=[EventsNode(event="user signed up"), EventsNode(event="paid")],- dateRange=DateRange(date_from="2020-01-01", date_to="2020-01-14"),- funnelsFilter=FunnelsFilter(funnelAggregateByHogQL="properties.session_id"),- )-- for i in range(10):- _create_person(distinct_ids=[f"user_{i}"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- properties={"session_id": f"session_{i}"},- )- _create_event(- team=self.team,- event="paid",- distinct_id=f"user_{i}",- timestamp="2020-01-04T14:00:00Z",- properties={"session_id": f"session_{i}"},- )- flush_persons_and_events()-- result, _ = self._get_events_for_query(- query,- funnelCorrelationType=FunnelCorrelationResultsType.PROPERTIES,- funnelCorrelationNames=["$browser"],- )- self.assertEqual(result, [])-- @parameterized.expand(- [- ("properties", FunnelCorrelationResultsType.PROPERTIES, {"funnelCorrelationNames": ["$browser"]}),- (- "event_with_properties",- FunnelCorrelationResultsType.EVENT_WITH_PROPERTIES,- {"funnelCorrelationEventNames": ["rick"]},- ),- ]- )- def test_correlation_on_empty_funnel_returns_empty(self, _name, correlation_type, kwargs):- # A funnel matching no actors produces zero rows for the property and event-property- # correlation queries (they arrayJoin over the actors CTE), so there's no totals row.- # This used to raise StopIteration / AssertionError; it should return empty instead.- query = FunnelsQuery(- series=[EventsNode(event="user signed up"), EventsNode(event="paid")],- dateRange=DateRange(date_from="2020-01-01", date_to="2020-01-14"),- )- flush_persons_and_events()-- result, _ = self._get_events_for_query(query, funnelCorrelationType=correlation_type, **kwargs)- self.assertEqual(result, [])-- def test_correlation_on_data_warehouse_funnel_returns_empty(self):- # Correlation joins the events table onto the funnel actors on person_id, but a- # data-warehouse funnel aggregates actors by a warehouse column (a string id), so- # there's nothing to correlate against — it used to raise ValidationError ("Data- # warehouse nodes are not supported here") or a UUID/String join error. It should- # now return empty gracefully rather than crashing the panel.- funnels_query = FunnelsQuery(- series=[- FunnelsDataWarehouseNode(- id="stripe.invoices",- id_field="id",- table_name="stripe.invoices",- timestamp_field="created_at",- aggregation_target_field="customer_id",- ),- EventsNode(event="paid"),- ],- dateRange=DateRange(date_from="2020-01-01", date_to="2020-01-14"),- )- correlation_query = FunnelCorrelationQuery(- source=FunnelsActorsQuery(source=funnels_query),- funnelCorrelationType=FunnelCorrelationResultsType.EVENTS,- )-- response = FunnelCorrelationQueryRunner(query=correlation_query, team=self.team)._calculate()- self.assertEqual(response.results.events, [])-- def test_basic_funnel_correlation_with_events(self):- query = FunnelsQuery(- series=[EventsNode(event="user signed up"), EventsNode(event="paid")],- dateRange=DateRange(date_from="2020-01-01", date_to="2020-01-14"),- )-- for i in range(10):- _create_person(distinct_ids=[f"user_{i}"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- )- if i % 2 == 0:- _create_event(- team=self.team,- event="positively_related",- distinct_id=f"user_{i}",- timestamp="2020-01-03T14:00:00Z",- )- _create_event(- team=self.team,- event="paid",- distinct_id=f"user_{i}",- timestamp="2020-01-04T14:00:00Z",- )-- for i in range(10, 20):- _create_person(distinct_ids=[f"user_{i}"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- )- if i % 2 == 0:- _create_event(- team=self.team,- event="negatively_related",- distinct_id=f"user_{i}",- timestamp="2020-01-03T14:00:00Z",- )-- result, _ = self._get_events_for_query(query, funnelCorrelationType=FunnelCorrelationResultsType.EVENTS)-- odds_ratios = [item.pop("odds_ratio") for item in result]- expected_odds_ratios = [11, 1 / 11]-- for odds, expected_odds in zip(odds_ratios, expected_odds_ratios):- self.assertAlmostEqual(odds, expected_odds)-- self.assertEqual(- result,- [- {- "event": "positively_related",- "success_count": 5,- "failure_count": 0,- # "odds_ratio": 11.0,- "correlation_type": "success",- },- {- "event": "negatively_related",- "success_count": 0,- "failure_count": 5,- # "odds_ratio": 1 / 11,- "correlation_type": "failure",- },- ],- )-- self.assertEqual(len(self._get_actors_for_event(query, "positively_related")), 5)- self.assertEqual(- len(self._get_actors_for_event(query, "positively_related", success=False)),- 0,- )- self.assertEqual(- len(self._get_actors_for_event(query, "negatively_related", success=False)),- 5,- )- self.assertEqual(len(self._get_actors_for_event(query, "negatively_related")), 0)-- # Now exclude positively_related- result, _ = self._get_events_for_query(- query,- funnelCorrelationType=FunnelCorrelationResultsType.EVENTS,- funnelCorrelationExcludeEventNames=["positively_related"],- )-- odds_ratio = result[0].pop("odds_ratio")- expected_odds_ratio = 1 / 11-- self.assertAlmostEqual(odds_ratio, expected_odds_ratio)-- self.assertEqual(- result,- [- {- "event": "negatively_related",- "success_count": 0,- "failure_count": 5,- # "odds_ratio": 1 / 11,- "correlation_type": "failure",- }- ],- )- # Getting specific people isn't affected by exclude_events- self.assertEqual(len(self._get_actors_for_event(query, "positively_related")), 5)- self.assertEqual(- len(self._get_actors_for_event(query, "positively_related", success=False)),- 0,- )- self.assertEqual(- len(self._get_actors_for_event(query, "negatively_related", success=False)),- 5,- )- self.assertEqual(len(self._get_actors_for_event(query, "negatively_related")), 0)-- @snapshot_clickhouse_queries- def test_action_events_are_excluded_from_correlations(self):- journey = {}-- for i in range(3):- person_id = f"user_{i}"- events = [- {- "event": "user signed up",- "timestamp": "2020-01-02T14:00:00",- "properties": {"key": "val"},- },- # same event, but missing property, so not part of action.- {"event": "user signed up", "timestamp": "2020-01-02T14:10:00"},- ]- if i % 2 == 0:- events.append({"event": "positively_related", "timestamp": "2020-01-03T14:00:00"})- events.append(- {- "event": "paid",- "timestamp": "2020-01-04T14:00:00",- "properties": {"key": "val"},- }- )-- journey[person_id] = events-- # one failure needed- journey["failure"] = [- {- "event": "user signed up",- "timestamp": "2020-01-02T14:00:00",- "properties": {"key": "val"},- }- ]-- journeys_for(events_by_person=journey, team=self.team) # type: ignore-- sign_up_action = _create_action(- name="user signed up",- team=self.team,- properties=[{"key": "key", "type": "event", "value": ["val"], "operator": "exact"}],- )-- paid_action = _create_action(- name="paid",- team=self.team,- properties=[{"key": "key", "type": "event", "value": ["val"], "operator": "exact"}],- )- query = FunnelsQuery(- series=[ActionsNode(id=sign_up_action.id), ActionsNode(id=paid_action.id)],- dateRange=DateRange(date_from="2020-01-01", date_to="2020-01-14"),- )-- result, _ = self._get_events_for_query(query)-- # missing user signed up and paid from result set, as expected- self.assertEqual(- result,- [- {- "event": "positively_related",- "success_count": 2,- "failure_count": 0,- "odds_ratio": 3,- "correlation_type": "success",- }- ],- )-- @also_test_with_person_on_events_v2- @snapshot_clickhouse_queries- def test_funnel_correlation_with_events_and_groups(self):- create_group_type_mapping_without_created_at(- team=self.team, project_id=self.team.project_id, group_type="organization", group_type_index=0- )- create_group(- team_id=self.team.pk,- group_type_index=0,- group_key="org:5",- properties={"industry": "finance"},- )- create_group(- team_id=self.team.pk,- group_type_index=0,- group_key="org:7",- properties={"industry": "finance"},- )-- for i in range(10, 20):- create_group(- team_id=self.team.pk,- group_type_index=0,- group_key=f"org:{i}",- properties={},- )- _create_person(distinct_ids=[f"user_{i}"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- properties={"$group_0": f"org:{i}"},- )- if i % 2 == 0:- _create_event(- team=self.team,- event="positively_related",- distinct_id=f"user_{i}",- timestamp="2020-01-03T14:00:00Z",- properties={"$group_0": f"org:{i}"},- )- # this event shouldn't show up when dealing with groups- _create_event(- team=self.team,- event="positively_related_without_group",- distinct_id=f"user_{i}",- timestamp="2020-01-03T14:00:00Z",- )- _create_event(- team=self.team,- event="paid",- distinct_id=f"user_{i}",- timestamp="2020-01-04T14:00:00Z",- properties={"$group_0": f"org:{i}"},- )-- # one fail group- _create_person(distinct_ids=[f"user_fail"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_fail",- timestamp="2020-01-02T14:00:00Z",- properties={"$group_0": f"org:5"},- )- _create_event(- team=self.team,- event="negatively_related",- distinct_id=f"user_{i}",- timestamp="2020-01-03T14:00:00Z",- properties={"$group_0": f"org:5"},- )-- # one success group with same filter property- _create_person(distinct_ids=[f"user_succ"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_succ",- timestamp="2020-01-02T14:00:00Z",- properties={"$group_0": f"org:7"},- )- _create_event(- team=self.team,- event="negatively_related",- distinct_id=f"user_{i}",- timestamp="2020-01-03T14:00:00Z",- properties={"$group_0": f"org:7"},- )- _create_event(- team=self.team,- event="paid",- distinct_id=f"user_succ",- timestamp="2020-01-04T14:00:00Z",- properties={"$group_0": f"org:7"},- )-- query = FunnelsQuery(- series=[EventsNode(event="user signed up"), EventsNode(event="paid")],- dateRange=DateRange(date_from="2020-01-01", date_to="2020-01-14"),- aggregation_group_type_index=0,- )-- result, _ = self._get_events_for_query(query, funnelCorrelationType=FunnelCorrelationResultsType.EVENTS)-- odds_ratios = [item.pop("odds_ratio") for item in result]- expected_odds_ratios = [12 / 7, 1 / 11]-- for odds, expected_odds in zip(odds_ratios, expected_odds_ratios):- self.assertAlmostEqual(odds, expected_odds)-- self.assertEqual(- result,- [- {- "event": "positively_related",- "success_count": 5,- "failure_count": 0,- # "odds_ratio": 12/7,- "correlation_type": "success",- },- {- "event": "negatively_related",- "success_count": 1,- "failure_count": 1,- # "odds_ratio": 1 / 11,- "correlation_type": "failure",- },- ],- )-- self.assertEqual(len(self._get_actors_for_event(query, "positively_related")), 5)- self.assertEqual(- len(self._get_actors_for_event(query, "positively_related", success=False)),- 0,- )- self.assertEqual(len(self._get_actors_for_event(query, "negatively_related")), 1)- self.assertEqual(- len(self._get_actors_for_event(query, "negatively_related", success=False)),- 1,- )-- # Now exclude all groups in positive- query_with_excludes = query.model_copy(- update={- "properties": [- GroupPropertyFilter(- operator=PropertyOperator.EXACT,- key="industry",- value="finance",- group_type_index=0,- ),- ],- }- )- result, _ = self._get_events_for_query(query_with_excludes)-- odds_ratio = result[0].pop("odds_ratio")- expected_odds_ratio = 1- # success total and failure totals remove other groups too-- self.assertAlmostEqual(odds_ratio, expected_odds_ratio)-- self.assertEqual(- result,- [- {- "event": "negatively_related",- "success_count": 1,- "failure_count": 1,- # "odds_ratio": 1,- "correlation_type": "failure",- }- ],- )-- self.assertEqual(len(self._get_actors_for_event(query, "negatively_related")), 1)- self.assertEqual(- len(self._get_actors_for_event(query, "negatively_related", success=False)),- 1,- )-- @also_test_with_materialized_columns(- event_properties=[], person_properties=["$browser"], verify_no_jsonextract=False- )- @time_machine.travel("2019-12-31", tick=False)- @snapshot_clickhouse_queries- def test_basic_funnel_correlation_with_properties(self):- query = FunnelsQuery(- series=[- EventsNode(event="user signed up"),- EventsNode(event="paid"),- ],- dateRange=DateRange(date_from="2020-01-01", date_to="2020-01-14"),- )-- for i in range(10):- _create_person(- distinct_ids=[f"user_{i}"],- team_id=self.team.pk,- properties={"$browser": "Positive"},- )- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- )- _create_event(- team=self.team,- event="paid",- distinct_id=f"user_{i}",- timestamp="2020-01-04T14:00:00Z",- )-- for i in range(10, 20):- _create_person(- distinct_ids=[f"user_{i}"],- team_id=self.team.pk,- properties={"$browser": "Negative"},- )- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- )- if i % 2 == 0:- _create_event(- team=self.team,- event="negatively_related",- distinct_id=f"user_{i}",- timestamp="2020-01-03T14:00:00Z",- )-- # One Positive with failure- _create_person(- distinct_ids=[f"user_fail"],- team_id=self.team.pk,- properties={"$browser": "Positive"},- )- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_fail",- timestamp="2020-01-02T14:00:00Z",- )-- # One Negative with success- _create_person(- distinct_ids=[f"user_succ"],- team_id=self.team.pk,- properties={"$browser": "Negative"},- )- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_succ",- timestamp="2020-01-02T14:00:00Z",- )- _create_event(- team=self.team,- event="paid",- distinct_id=f"user_succ",- timestamp="2020-01-04T14:00:00Z",- )-- result, _ = self._get_events_for_query(- query, funnelCorrelationType=FunnelCorrelationResultsType.PROPERTIES, funnelCorrelationNames=["$browser"]- )-- odds_ratios = [item.pop("odds_ratio") for item in result]-- # Success Total = 11, Failure Total = 11- #- # Browser::Positive- # Success: 10- # Failure: 1-- # Browser::Negative- # Success: 1- # Failure: 10-- prior_count = 1- expected_odds_ratios = [- ((10 + prior_count) / (1 + prior_count)) * ((11 - 1 + prior_count) / (11 - 10 + prior_count)),- ((1 + prior_count) / (10 + prior_count)) * ((11 - 10 + prior_count) / (11 - 1 + prior_count)),- ]-- for odds, expected_odds in zip(odds_ratios, expected_odds_ratios):- self.assertAlmostEqual(odds, expected_odds)-- self.assertEqual(- result,- [- {- "event": "$browser::Positive",- "success_count": 10,- "failure_count": 1,- # "odds_ratio": 121/4,- "correlation_type": "success",- },- {- "event": "$browser::Negative",- "success_count": 1,- "failure_count": 10,- # "odds_ratio": 4/121,- "correlation_type": "failure",- },- ],- )-- self.assertEqual(- len(- self._get_actors_for_property(- query, [("$browser", "Positive", "person", None)], funnelCorrelationNames=["$browser"]- )- ),- 10,- )- self.assertEqual(- len(- self._get_actors_for_property(- query, [("$browser", "Positive", "person", None)], False, funnelCorrelationNames=["$browser"]- )- ),- 1,- )- self.assertEqual(- len(- self._get_actors_for_property(- query, [("$browser", "Negative", "person", None)], funnelCorrelationNames=["$browser"]- )- ),- 1,- )- self.assertEqual(- len(- self._get_actors_for_property(- query, [("$browser", "Negative", "person", None)], False, funnelCorrelationNames=["$browser"]- )- ),- 10,- )-- # TODO: Delete this test when moved to person-on-events- @also_test_with_materialized_columns(- event_properties=[], person_properties=["$browser"], verify_no_jsonextract=False- )- @snapshot_clickhouse_queries- def test_funnel_correlation_with_properties_and_groups(self):- create_group_type_mapping_without_created_at(- team=self.team, project_id=self.team.project_id, group_type="organization", group_type_index=0- )-- for i in range(10):- create_group(- team_id=self.team.pk,- group_type_index=0,- group_key=f"org:{i}",- properties={"industry": "positive"},- )- _create_person(- distinct_ids=[f"user_{i}"],- team_id=self.team.pk,- properties={"$browser": "Positive"},- )- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- properties={"$group_0": f"org:{i}"},- )- _create_event(- team=self.team,- event="paid",- distinct_id=f"user_{i}",- timestamp="2020-01-04T14:00:00Z",- properties={"$group_0": f"org:{i}"},- )-- for i in range(10, 20):- create_group(- team_id=self.team.pk,- group_type_index=0,- group_key=f"org:{i}",- properties={"industry": "negative"},- )- _create_person(- distinct_ids=[f"user_{i}"],- team_id=self.team.pk,- properties={"$browser": "Negative"},- )- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- properties={"$group_0": f"org:{i}"},- )- if i % 2 == 0:- _create_event(- team=self.team,- event="negatively_related",- distinct_id=f"user_{i}",- timestamp="2020-01-03T14:00:00Z",- properties={"$group_0": f"org:{i}"},- )-- # One Positive with failure- create_group(- team_id=self.team.pk,- group_type_index=0,- group_key=f"org:fail",- properties={"industry": "positive"},- )- _create_person(- distinct_ids=[f"user_fail"],- team_id=self.team.pk,- properties={"$browser": "Positive"},- )- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_fail",- timestamp="2020-01-02T14:00:00Z",- properties={"$group_0": f"org:fail"},- )-- # One Negative with success- create_group(- team_id=self.team.pk,- group_type_index=0,- group_key=f"org:succ",- properties={"industry": "negative"},- )- _create_person(- distinct_ids=[f"user_succ"],- team_id=self.team.pk,- properties={"$browser": "Negative"},- )- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_succ",- timestamp="2020-01-02T14:00:00Z",- properties={"$group_0": f"org:succ"},- )- _create_event(- team=self.team,- event="paid",- distinct_id=f"user_succ",- timestamp="2020-01-04T14:00:00Z",- properties={"$group_0": f"org:succ"},- )-- query = FunnelsQuery(- series=[- EventsNode(event="user signed up"),- EventsNode(event="paid"),- ],- dateRange=DateRange(date_from="2020-01-01", date_to="2020-01-14"),- aggregation_group_type_index=0,- )-- result, _ = self._get_events_for_query(- query, funnelCorrelationType=FunnelCorrelationResultsType.PROPERTIES, funnelCorrelationNames=["industry"]- )-- odds_ratios = [item.pop("odds_ratio") for item in result]-- # Success Total = 11, Failure Total = 11- #- # Industry::Positive- # Success: 10- # Failure: 1-- # Industry::Negative- # Success: 1- # Failure: 10-- prior_count = 1- expected_odds_ratios = [- ((10 + prior_count) / (1 + prior_count)) * ((11 - 1 + prior_count) / (11 - 10 + prior_count)),- ((1 + prior_count) / (10 + prior_count)) * ((11 - 10 + prior_count) / (11 - 1 + prior_count)),- ]-- for odds, expected_odds in zip(odds_ratios, expected_odds_ratios):- self.assertAlmostEqual(odds, expected_odds)-- self.assertEqual(- result,- [- {- "event": "industry::positive",- "success_count": 10,- "failure_count": 1,- # "odds_ratio": 121/4,- "correlation_type": "success",- },- {- "event": "industry::negative",- "success_count": 1,- "failure_count": 10,- # "odds_ratio": 4/121,- "correlation_type": "failure",- },- ],- )-- self.assertEqual(- len(- self._get_actors_for_property(- query, [("industry", "positive", "group", 0)], funnelCorrelationNames=["industry"]- )- ),- 10,- )- self.assertEqual(- len(self._get_actors_for_property(query, [("industry", "positive", "group", 0)], False)),- 1,- )- self.assertEqual(- len(self._get_actors_for_property(query, [("industry", "negative", "group", 0)])),- 1,- )- self.assertEqual(- len(self._get_actors_for_property(query, [("industry", "negative", "group", 0)], False)),- 10,- )-- # test with `$all` as property- # _run property correlation with filter on all properties- new_result, _ = self._get_events_for_query(- query, funnelCorrelationType=FunnelCorrelationResultsType.PROPERTIES, funnelCorrelationNames=["$all"]- )-- odds_ratios = [item.pop("odds_ratio") for item in new_result]-- for odds, expected_odds in zip(odds_ratios, expected_odds_ratios):- self.assertAlmostEqual(odds, expected_odds)-- self.assertEqual(new_result, result)-- @also_test_with_materialized_columns(- event_properties=[],- person_properties=["$browser"],- verify_no_jsonextract=False,- )- @also_test_with_person_on_events_v2- @snapshot_clickhouse_queries- def test_funnel_correlation_with_properties_and_groups_person_on_events(self):- create_group_type_mapping_without_created_at(- team=self.team, project_id=self.team.project_id, group_type="organization", group_type_index=0- )-- for i in range(10):- create_group(- team_id=self.team.pk,- group_type_index=0,- group_key=f"org:{i}",- properties={"industry": "positive"},- )- _create_person(- distinct_ids=[f"user_{i}"],- team_id=self.team.pk,- properties={"$browser": "Positive"},- )- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- properties={"$group_0": f"org:{i}"},- )- _create_event(- team=self.team,- event="paid",- distinct_id=f"user_{i}",- timestamp="2020-01-04T14:00:00Z",- properties={"$group_0": f"org:{i}"},- )-- for i in range(10, 20):- create_group(- team_id=self.team.pk,- group_type_index=0,- group_key=f"org:{i}",- properties={"industry": "negative"},- )- _create_person(- distinct_ids=[f"user_{i}"],- team_id=self.team.pk,- properties={"$browser": "Negative"},- )- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- properties={"$group_0": f"org:{i}"},- )- if i % 2 == 0:- _create_event(- team=self.team,- event="negatively_related",- distinct_id=f"user_{i}",- timestamp="2020-01-03T14:00:00Z",- properties={"$group_0": f"org:{i}"},- )-- # One Positive with failure- create_group(- team_id=self.team.pk,- group_type_index=0,- group_key=f"org:fail",- properties={"industry": "positive"},- )- _create_person(- distinct_ids=[f"user_fail"],- team_id=self.team.pk,- properties={"$browser": "Positive"},- )- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_fail",- timestamp="2020-01-02T14:00:00Z",- properties={"$group_0": f"org:fail"},- )-- # One Negative with success- create_group(- team_id=self.team.pk,- group_type_index=0,- group_key=f"org:succ",- properties={"industry": "negative"},- )- _create_person(- distinct_ids=[f"user_succ"],- team_id=self.team.pk,- properties={"$browser": "Negative"},- )- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_succ",- timestamp="2020-01-02T14:00:00Z",- properties={"$group_0": f"org:succ"},- )- _create_event(- team=self.team,- event="paid",- distinct_id=f"user_succ",- timestamp="2020-01-04T14:00:00Z",- properties={"$group_0": f"org:succ"},- )-- query = FunnelsQuery(- series=[- EventsNode(event="user signed up"),- EventsNode(event="paid"),- ],- dateRange=DateRange(date_from="2020-01-01", date_to="2020-01-14"),- aggregation_group_type_index=0,- )-- with override_instance_config("PERSON_ON_EVENTS_ENABLED", True):- result, _ = self._get_events_for_query(- query,- funnelCorrelationType=FunnelCorrelationResultsType.PROPERTIES,- funnelCorrelationNames=["industry"],- )-- odds_ratios = [item.pop("odds_ratio") for item in result]-- # Success Total = 11, Failure Total = 11- #- # Industry::Positive- # Success: 10- # Failure: 1-- # Industry::Negative- # Success: 1- # Failure: 10-- prior_count = 1- expected_odds_ratios = [- ((10 + prior_count) / (1 + prior_count)) * ((11 - 1 + prior_count) / (11 - 10 + prior_count)),- ((1 + prior_count) / (10 + prior_count)) * ((11 - 10 + prior_count) / (11 - 1 + prior_count)),- ]-- for odds, expected_odds in zip(odds_ratios, expected_odds_ratios):- self.assertAlmostEqual(odds, expected_odds)-- self.assertEqual(- result,- [- {- "event": "industry::positive",- "success_count": 10,- "failure_count": 1,- # "odds_ratio": 121/4,- "correlation_type": "success",- },- {- "event": "industry::negative",- "success_count": 1,- "failure_count": 10,- # "odds_ratio": 4/121,- "correlation_type": "failure",- },- ],- )-- self.assertEqual(- len(self._get_actors_for_property(query, [("industry", "positive", "group", 0)])),- 10,- )- self.assertEqual(- len(self._get_actors_for_property(query, [("industry", "positive", "group", 0)], False)),- 1,- )- self.assertEqual(- len(self._get_actors_for_property(query, [("industry", "negative", "group", 0)])),- 1,- )- self.assertEqual(- len(self._get_actors_for_property(query, [("industry", "negative", "group", 0)], False)),- 10,- )-- # test with `$all` as property- # _run property correlation with filter on all properties- new_result, _ = self._get_events_for_query(- query,- funnelCorrelationType=FunnelCorrelationResultsType.PROPERTIES,- funnelCorrelationNames=["$all"],- )-- odds_ratios = [item.pop("odds_ratio") for item in new_result]-- for odds, expected_odds in zip(odds_ratios, expected_odds_ratios):- self.assertAlmostEqual(odds, expected_odds)-- self.assertEqual(new_result, result)-- def test_no_divide_by_zero_errors(self):- query = FunnelsQuery(- series=[- EventsNode(event="user signed up"),- EventsNode(event="paid"),- ],- dateRange=DateRange(date_from="2020-01-01", date_to="2020-01-14"),- )-- for i in range(2):- _create_person(- distinct_ids=[f"user_{i}"],- team_id=self.team.pk,- properties={"$browser": "Positive"},- )- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- )- # failure count for this event is 0- _create_event(- team=self.team,- event="positive",- distinct_id=f"user_{i}",- timestamp="2020-01-03T14:00:00Z",- )- _create_event(- team=self.team,- event="paid",- distinct_id=f"user_{i}",- timestamp="2020-01-04T14:00:00Z",- )-- for i in range(2, 4):- _create_person(- distinct_ids=[f"user_{i}"],- team_id=self.team.pk,- properties={"$browser": "Negative"},- )- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- )- if i % 2 == 0:- # success count for this event is 0- _create_event(- team=self.team,- event="negatively_related",- distinct_id=f"user_{i}",- timestamp="2020-01-03T14:00:00Z",- )-- result, skewed_totals = self._get_events_for_query(query)-- self.assertFalse(skewed_totals)-- odds_ratios = [item.pop("odds_ratio") for item in result]- expected_odds_ratios = [9, 1 / 3]-- for odds, expected_odds in zip(odds_ratios, expected_odds_ratios):- self.assertAlmostEqual(odds, expected_odds)-- self.assertEqual(- result,- [- {- "event": "positive",- "success_count": 2,- "failure_count": 0,- # "odds_ratio": 9.0,- "correlation_type": "success",- },- {- "event": "negatively_related",- "success_count": 0,- "failure_count": 1,- # "odds_ratio": 1 / 3,- "correlation_type": "failure",- },- ],- )-- def test_correlation_with_properties_raises_validation_error(self):- query = FunnelsQuery(- series=[- EventsNode(event="user signed up"),- EventsNode(event="paid"),- ],- dateRange=DateRange(date_from="2020-01-01", date_to="2020-01-14"),- )-- _create_person(- distinct_ids=[f"user_1"],- team_id=self.team.pk,- properties={"$browser": "Positive"},- )- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_1",- timestamp="2020-01-02T14:00:00Z",- )- _create_event(- team=self.team,- event="rick",- distinct_id=f"user_1",- timestamp="2020-01-03T14:00:00Z",- )- _create_event(- team=self.team,- event="paid",- distinct_id=f"user_1",- timestamp="2020-01-04T14:00:00Z",- )- flush_persons_and_events()-- with self.assertRaises(ValidationError):- self._get_events_for_query(- query,- funnelCorrelationType=FunnelCorrelationResultsType.PROPERTIES,- # funnelCorrelationNames=["$browser"] -- missing- )-- with self.assertRaises(ValidationError):- self._get_events_for_query(- query,- funnelCorrelationType=FunnelCorrelationResultsType.EVENT_WITH_PROPERTIES,- # "funnelCorrelationEventNames": ["rick"] -- missing- )-- @also_test_with_materialized_columns(- event_properties=[], person_properties=["$browser"], verify_no_jsonextract=False- )- @skip("Works locally and works after you tmate onto github actions and run it, but fails in CI")- def test_correlation_with_multiple_properties(self):- query = FunnelsQuery(- series=[- EventsNode(event="user signed up"),- EventsNode(event="paid"),- ],- dateRange=DateRange(date_from="2020-01-01", date_to="2020-01-14"),- )-- # 5 successful people with both properties- for i in range(5):- _create_person(- distinct_ids=[f"user_{i}"],- team_id=self.team.pk,- properties={"$browser": "Positive", "$nice": "very"},- )- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- )- _create_event(- team=self.team,- event="paid",- distinct_id=f"user_{i}",- timestamp="2020-01-04T14:00:00Z",- )-- # 10 successful people with some different properties- for i in range(5, 15):- _create_person(- distinct_ids=[f"user_{i}"],- team_id=self.team.pk,- properties={"$browser": "Positive", "$nice": "not"},- )- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- )- _create_event(- team=self.team,- event="paid",- distinct_id=f"user_{i}",- timestamp="2020-01-04T14:00:00Z",- )-- # 5 Unsuccessful people with some common properties- for i in range(15, 20):- _create_person(- distinct_ids=[f"user_{i}"],- team_id=self.team.pk,- properties={"$browser": "Negative", "$nice": "smh"},- )- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- )-- # One Positive with failure, no $nice property- _create_person(- distinct_ids=[f"user_fail"],- team_id=self.team.pk,- properties={"$browser": "Positive"},- )- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_fail",- timestamp="2020-01-02T14:00:00Z",- )-- # One Negative with success, no $nice property- _create_person(- distinct_ids=[f"user_succ"],- team_id=self.team.pk,- properties={"$browser": "Negative"},- )- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_succ",- timestamp="2020-01-02T14:00:00Z",- )- _create_event(- team=self.team,- event="paid",- distinct_id=f"user_succ",- timestamp="2020-01-04T14:00:00Z",- )-- result, _ = self._get_events_for_query(- query,- funnelCorrelationType=FunnelCorrelationResultsType.PROPERTIES,- funnelCorrelationNames=["$browser", "$nice"],- )-- # Success Total = 5 + 10 + 1 = 16- # Failure Total = 5 + 1 = 6- # Add 1 for priors-- odds_ratios = [item.pop("odds_ratio") for item in result]- expected_odds_ratios = [- (16 / 2) * ((7 - 1) / (17 - 15)),- (11 / 1) * ((7 - 0) / (17 - 10)),- (6 / 1) * ((7 - 0) / (17 - 5)),- (1 / 6) * ((7 - 5) / (17 - 0)),- (2 / 6) * ((7 - 5) / (17 - 1)),- (2 / 2) * ((7 - 1) / (17 - 1)),- ]- # (success + 1) / (failure + 1)-- for odds, expected_odds in zip(odds_ratios, expected_odds_ratios):- self.assertAlmostEqual(odds, expected_odds)-- expected_result = [- {- "event": "$browser::Positive",- "success_count": 15,- "failure_count": 1,- # "odds_ratio": 24,- "correlation_type": "success",- },- {- "event": "$nice::not",- "success_count": 10,- "failure_count": 0,- # "odds_ratio": 11,- "correlation_type": "success",- },- {- "event": "$nice::very",- "success_count": 5,- "failure_count": 0,- # "odds_ratio": 3.5,- "correlation_type": "success",- },- {- "event": "$nice::smh",- "success_count": 0,- "failure_count": 5,- # "odds_ratio": 0.0196078431372549,- "correlation_type": "failure",- },- {- "event": "$browser::Negative",- "success_count": 1,- "failure_count": 5,- # "odds_ratio": 0.041666666666666664,- "correlation_type": "failure",- },- {- "event": "$nice::",- "success_count": 1,- "failure_count": 1,- # "odds_ratio": 0.375,- "correlation_type": "failure",- },- ]-- self.assertEqual(result, expected_result)-- # _run property correlation with filter on all properties- new_result, _ = self._get_events_for_query(- query, funnelCorrelationType=FunnelCorrelationResultsType.PROPERTIES, funnelCorrelationNames=["$all"]- )-- odds_ratios = [item.pop("odds_ratio") for item in new_result]-- new_expected_odds_ratios = expected_odds_ratios[:-1]- new_expected_result = expected_result[:-1]- # When querying all properties, we don't consider properties that don't exist for part of the data- # since users aren't explicitly asking for that property. Thus,- # We discard $nice:: because it's an empty result set-- for odds, expected_odds in zip(odds_ratios, new_expected_odds_ratios):- self.assertAlmostEqual(odds, expected_odds)-- self.assertEqual(new_result, new_expected_result)-- # search for $all but exclude $browser- new_result, _ = self._get_events_for_query(- query,- funnelCorrelationType=FunnelCorrelationResultsType.PROPERTIES,- funnelCorrelationNames=["$all"],- funnelCorrelationExcludeNames=["$browser"],- )-- odds_ratios = [item.pop("odds_ratio") for item in new_result]-- new_expected_odds_ratios = expected_odds_ratios[1:4] # choosing the $nice property values- new_expected_result = expected_result[1:4]-- for odds, expected_odds in zip(odds_ratios, new_expected_odds_ratios):- self.assertAlmostEqual(odds, expected_odds)-- self.assertEqual(new_result, new_expected_result)-- self.assertEqual(- len(- self._get_actors_for_property(- query, [("$nice", "not", "person", None)], funnelCorrelationNames=["$browser", "$nice"]- )- ),- 10,- )- # self.assertEqual(- # len(- # self._get_actors_for_property(- # query, [("$nice", "", "person", None)], False, funnelCorrelationNames=["$browser", "$nice"]- # )- # ),- # 1,- # )- self.assertEqual(- len(- self._get_actors_for_property(- query, [("$nice", "very", "person", None)], funnelCorrelationNames=["$browser", "$nice"]- )- ),- 5,- )-- def test_discarding_insignificant_events(self):- query = FunnelsQuery(- series=[- EventsNode(event="user signed up"),- EventsNode(event="paid"),- ],- dateRange=DateRange(date_from="2020-01-01", date_to="2020-01-14"),- )-- for i in range(10):- _create_person(distinct_ids=[f"user_{i}"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- )- if i % 2 == 0:- _create_event(- team=self.team,- event="positively_related",- distinct_id=f"user_{i}",- timestamp="2020-01-03T14:00:00Z",- )- if i % 10 == 0:- _create_event(- team=self.team,- event="low_sig_positively_related",- distinct_id=f"user_{i}",- timestamp="2020-01-03T14:20:00Z",- )- _create_event(- team=self.team,- event="paid",- distinct_id=f"user_{i}",- timestamp="2020-01-04T14:00:00Z",- )-- for i in range(10, 20):- _create_person(distinct_ids=[f"user_{i}"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- )- if i % 2 == 0:- _create_event(- team=self.team,- event="negatively_related",- distinct_id=f"user_{i}",- timestamp="2020-01-03T14:00:00Z",- )- if i % 5 == 0:- _create_event(- team=self.team,- event="low_sig_negatively_related",- distinct_id=f"user_{i}",- timestamp="2020-01-03T14:00:00Z",- )-- # Total 10 positive, 10 negative- # low sig count = 1 and 2, high sig count >= 5- # Thus, to discard the low sig count, % needs to be >= 10%, or count >= 2-- # Discard both due to %- FunnelCorrelationQueryRunner.MIN_PERSON_PERCENTAGE = 0.11- FunnelCorrelationQueryRunner.MIN_PERSON_COUNT = 25- result, _ = self._get_events_for_query(query, funnelCorrelationType=FunnelCorrelationResultsType.EVENTS)-- self.assertEqual(len(result), 2)-- def test_events_within_conversion_window_for_correlation(self):- query = FunnelsQuery(- series=[- EventsNode(event="user signed up"),- EventsNode(event="paid"),- ],- dateRange=DateRange(date_from="2020-01-01", date_to="2020-01-14"),- funnelsFilter=FunnelsFilter(- funnelWindowInterval=10,- funnelWindowIntervalUnit=FunnelConversionWindowTimeUnit.MINUTE,- ),- )-- _create_person(distinct_ids=["user_successful"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id="user_successful",- timestamp="2020-01-02T14:00:00Z",- )- _create_event(- team=self.team,- event="positively_related",- distinct_id="user_successful",- timestamp="2020-01-02T14:02:00Z",- )- _create_event(- team=self.team,- event="paid",- distinct_id="user_successful",- timestamp="2020-01-02T14:06:00Z",- )-- _create_person(distinct_ids=["user_dropoff"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id="user_dropoff",- timestamp="2020-01-02T14:00:00Z",- )- _create_event(- team=self.team,- event="NOT_negatively_related",- distinct_id="user_dropoff",- timestamp="2020-01-02T14:15:00Z", # event happened outside conversion window- )-- result, _ = self._get_events_for_query(query, funnelCorrelationType=FunnelCorrelationResultsType.EVENTS)-- odds_ratios = [item.pop("odds_ratio") for item in result]- expected_odds_ratios = [4]-- for odds, expected_odds in zip(odds_ratios, expected_odds_ratios):- self.assertAlmostEqual(odds, expected_odds)-- self.assertEqual(- result,- [- {- "event": "positively_related",- "success_count": 1,- "failure_count": 0,- # "odds_ratio": 4.0,- "correlation_type": "success",- }- ],- )-- @also_test_with_materialized_columns(["blah", "signup_source"], verify_no_jsonextract=False)- def test_funnel_correlation_with_event_properties(self):- query = FunnelsQuery(- series=[- EventsNode(event="user signed up"),- EventsNode(event="paid"),- ],- dateRange=DateRange(date_from="2020-01-01", date_to="2020-01-14"),- )-- for i in range(10):- _create_person(distinct_ids=[f"user_{i}"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- )- if i % 2 == 0:- _create_event(- team=self.team,- event="positively_related",- distinct_id=f"user_{i}",- timestamp="2020-01-03T14:00:00Z",- properties={- "signup_source": "facebook" if i % 4 == 0 else "email",- "blah": "value_bleh",- },- )- # source: email occurs only twice, so would be discarded from result set- _create_event(- team=self.team,- event="paid",- distinct_id=f"user_{i}",- timestamp="2020-01-04T14:00:00Z",- )-- for i in range(10, 20):- _create_person(distinct_ids=[f"user_{i}"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- )- if i % 2 == 0:- _create_event(- team=self.team,- event="negatively_related",- distinct_id=f"user_{i}",- timestamp="2020-01-03T14:00:00Z",- properties={"signup_source": "shazam" if i % 6 == 0 else "email"},- )- # source: shazam occurs only once, so would be discarded from result set-- result, _ = self._get_events_for_query(- query,- funnelCorrelationType=FunnelCorrelationResultsType.EVENT_WITH_PROPERTIES,- funnelCorrelationEventNames=[- "positively_related",- "negatively_related",- ],- )-- odds_ratios = [item.pop("odds_ratio") for item in result]- expected_odds_ratios = [11, 5.5, 2 / 11]-- for odds, expected_odds in zip(odds_ratios, expected_odds_ratios):- self.assertAlmostEqual(odds, expected_odds)-- self.assertEqual(- result,- [- {- "event": "positively_related::blah::value_bleh",- "success_count": 5,- "failure_count": 0,- # "odds_ratio": 11.0,- "correlation_type": "success",- },- {- "event": "positively_related::signup_source::facebook",- "success_count": 3,- "failure_count": 0,- # "odds_ratio": 5.5,- "correlation_type": "success",- },- {- "event": "negatively_related::signup_source::email",- "success_count": 0,- "failure_count": 3,- # "odds_ratio": 0.18181818181818182,- "correlation_type": "failure",- },- ],- )-- self.assertEqual(- len(- self._get_actors_for_event(- query,- "positively_related",- [EventPropertyFilter(operator=PropertyOperator.EXACT, key="blah", value="value_bleh")],- )- ),- 5,- )- self.assertEqual(- len(- self._get_actors_for_event(- query,- "positively_related",- [EventPropertyFilter(operator=PropertyOperator.EXACT, key="signup_source", value="facebook")],- )- ),- 3,- )- self.assertEqual(- len(- self._get_actors_for_event(- query,- "positively_related",- [EventPropertyFilter(operator=PropertyOperator.EXACT, key="signup_source", value="facebook")],- False,- )- ),- 0,- )- self.assertEqual(- len(- self._get_actors_for_event(- query,- "negatively_related",- [EventPropertyFilter(operator=PropertyOperator.EXACT, key="signup_source", value="email")],- False,- )- ),- 3,- )-- @also_test_with_materialized_columns(["blah", "signup_source"], verify_no_jsonextract=False)- @snapshot_clickhouse_queries- def test_funnel_correlation_with_event_properties_and_groups(self):- # same test as test_funnel_correlation_with_event_properties but with events attached to groups- create_group_type_mapping_without_created_at(- team=self.team, project_id=self.team.project_id, group_type="organization", group_type_index=1- )-- for i in range(10):- create_group(- team_id=self.team.pk,- group_type_index=1,- group_key=f"org:{i}",- properties={"industry": "positive"},- )- _create_person(distinct_ids=[f"user_{i}"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- properties={"$group_1": f"org:{i}"},- )- if i % 2 == 0:- _create_event(- team=self.team,- event="positively_related",- distinct_id=f"user_{i}",- timestamp="2020-01-03T14:00:00Z",- properties={- "signup_source": "facebook" if i % 4 == 0 else "email",- "blah": "value_bleh",- "$group_1": f"org:{i}",- },- )- # source: email occurs only twice, so would be discarded from result set- _create_event(- team=self.team,- event="paid",- distinct_id=f"user_{i}",- timestamp="2020-01-04T14:00:00Z",- properties={"$group_1": f"org:{i}"},- )-- for i in range(10, 20):- create_group(- team_id=self.team.pk,- group_type_index=1,- group_key=f"org:{i}",- properties={"industry": "positive"},- )- _create_person(distinct_ids=[f"user_{i}"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- properties={"$group_1": f"org:{i}"},- )- if i % 2 == 0:- _create_event(- team=self.team,- event="negatively_related",- distinct_id=f"user_{i}",- timestamp="2020-01-03T14:00:00Z",- properties={- "signup_source": "shazam" if i % 6 == 0 else "email",- "$group_1": f"org:{i}",- },- )- # source: shazam occurs only once, so would be discarded from result set-- query = FunnelsQuery(- series=[- EventsNode(event="user signed up"),- EventsNode(event="paid"),- ],- dateRange=DateRange(date_from="2020-01-01", date_to="2020-01-14"),- aggregation_group_type_index=1,- )-- result, _ = self._get_events_for_query(- query,- funnelCorrelationType=FunnelCorrelationResultsType.EVENT_WITH_PROPERTIES,- funnelCorrelationEventNames=[- "positively_related",- "negatively_related",- ],- )-- odds_ratios = [item.pop("odds_ratio") for item in result]- expected_odds_ratios = [11, 5.5, 2 / 11]-- for odds, expected_odds in zip(odds_ratios, expected_odds_ratios):- self.assertAlmostEqual(odds, expected_odds)-- self.assertEqual(- result,- [- {- "event": "positively_related::blah::value_bleh",- "success_count": 5,- "failure_count": 0,- # "odds_ratio": 11.0,- "correlation_type": "success",- },- {- "event": "positively_related::signup_source::facebook",- "success_count": 3,- "failure_count": 0,- # "odds_ratio": 5.5,- "correlation_type": "success",- },- {- "event": "negatively_related::signup_source::email",- "success_count": 0,- "failure_count": 3,- # "odds_ratio": 0.18181818181818182,- "correlation_type": "failure",- },- ],- )-- def test_funnel_correlation_with_event_properties_exclusions(self):- query = FunnelsQuery(- series=[- EventsNode(event="user signed up"),- EventsNode(event="paid"),- ],- dateRange=DateRange(date_from="2020-01-01", date_to="2020-01-14"),- )-- # Need more than 2 events to get a correlation- for i in range(3):- _create_person(distinct_ids=[f"user_{i}"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- )- _create_event(- team=self.team,- event="positively_related",- distinct_id=f"user_{i}",- timestamp="2020-01-03T14:00:00Z",- properties={"signup_source": "facebook", "blah": "value_bleh"},- )- _create_event(- team=self.team,- event="paid",- distinct_id=f"user_{i}",- timestamp="2020-01-04T14:00:00Z",- )-- # Atleast one person that fails, to ensure we get results- _create_person(distinct_ids=[f"user_fail"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_fail",- timestamp="2020-01-02T14:00:00Z",- )-- result, _ = self._get_events_for_query(- query,- funnelCorrelationType=FunnelCorrelationResultsType.EVENT_WITH_PROPERTIES,- funnelCorrelationEventNames=["positively_related"],- funnelCorrelationEventExcludePropertyNames=["signup_source"],- )-- self.assertEqual(- result,- [- {- "event": "positively_related::blah::value_bleh",- "success_count": 3,- "failure_count": 0,- "odds_ratio": 8,- "correlation_type": "success",- },- # missing signup_source, as expected- ],- )-- self.assertEqual(- len(- self._get_actors_for_event(- query,- "positively_related",- [EventPropertyFilter(operator=PropertyOperator.EXACT, key="blah", value="value_bleh")],- )- ),- 3,- )-- # If you search for persons with a specific property, even if excluded earlier, you should get them- self.assertEqual(- len(- self._get_actors_for_event(- query,- "positively_related",- [EventPropertyFilter(operator=PropertyOperator.EXACT, key="signup_source", value="facebook")],- )- ),- 3,- )-- # :FIXME: This should also work with materialized columns- # @also_test_with_materialized_columns(["$event_type", "signup_source"])- def test_funnel_correlation_with_event_properties_autocapture(self):- query = FunnelsQuery(- series=[- EventsNode(event="user signed up"),- EventsNode(event="paid"),- ],- dateRange=DateRange(date_from="2020-01-01", date_to="2020-01-14"),- )-- # Need a minimum of 3 hits to get a correlation result- for i in range(6):- _create_person(distinct_ids=[f"user_{i}"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- )- _create_event(- team=self.team,- event="$autocapture",- distinct_id=f"user_{i}",- elements=[Element(nth_of_type=1, nth_child=0, tag_name="a", href="/movie")],- timestamp="2020-01-03T14:00:00Z",- properties={"signup_source": "email", "$event_type": "click"},- )- # Test two different types of autocapture elements, with different counts, so we can accurately test results- if i % 2 == 0:- _create_event(- team=self.team,- event="$autocapture",- distinct_id=f"user_{i}",- elements=[- Element(- nth_of_type=1,- nth_child=0,- tag_name="button",- text="Pay $10",- )- ],- timestamp="2020-01-03T14:00:00Z",- properties={"signup_source": "facebook", "$event_type": "submit"},- )-- _create_event(- team=self.team,- event="paid",- distinct_id=f"user_{i}",- timestamp="2020-01-04T14:00:00Z",- )-- # Atleast one person that fails, to ensure we get results- _create_person(distinct_ids=[f"user_fail"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_fail",- timestamp="2020-01-02T14:00:00Z",- )-- result, _ = self._get_events_for_query(- query,- funnelCorrelationType=FunnelCorrelationResultsType.EVENT_WITH_PROPERTIES,- funnelCorrelationEventNames=["$autocapture"],- )-- # $autocapture results only return elements chain- self.assertEqual(- result,- [- {- "event": '$autocapture::elements_chain::click__~~__a:href="/movie"nth-child="0"nth-of-type="1"',- "success_count": 6,- "failure_count": 0,- "odds_ratio": 14.0,- "correlation_type": "success",- },- {- "event": '$autocapture::elements_chain::submit__~~__button:nth-child="0"nth-of-type="1"text="Pay $10"',- "success_count": 3,- "failure_count": 0,- "odds_ratio": 2.0,- "correlation_type": "success",- },- ],- )-- # self.assertEqual(- # len(self._get_actors_for_event(filter, "$autocapture", {"signup_source": "facebook"})),- # 3,- # )- # self.assertEqual(- # len(self._get_actors_for_event(filter, "$autocapture", {"$event_type": "click"})),- # 6,- # )- # self.assertEqual(- # len(- # self._get_actors_for_event(- # filter,- # "$autocapture",- # [- # {- # "key": "tag_name",- # "operator": "exact",- # "type": "element",- # "value": "button",- # },- # {- # "key": "text",- # "operator": "exact",- # "type": "element",- # "value": "Pay $10",- # },- # ],- # )- # ),- # 3,- # )- # self.assertEqual(- # len(- # self._get_actors_for_event(- # filter,- # "$autocapture",- # [- # {- # "key": "tag_name",- # "operator": "exact",- # "type": "element",- # "value": "a",- # },- # {- # "key": "href",- # "operator": "exact",- # "type": "element",- # "value": "/movie",- # },- # ],- # )- # ),- # 6,- # )-- def test_funnel_correlation_with_event_properties_autocapture_no_rows_for_actors_without_events(self):- query = FunnelsQuery(- series=[- EventsNode(event="user signed up"),- EventsNode(event="paid"),- ],- dateRange=DateRange(date_from="2020-01-01", date_to="2020-01-14"),- )-- for i in range(6):- _create_person(distinct_ids=[f"user_{i}"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_{i}",- timestamp="2020-01-02T14:00:00Z",- )- _create_event(- team=self.team,- event="$autocapture",- distinct_id=f"user_{i}",- elements=[Element(nth_of_type=1, nth_child=0, tag_name="a", href="/movie")],- timestamp="2020-01-03T14:00:00Z",- properties={"$event_type": "click"},- )- _create_event(- team=self.team,- event="paid",- distinct_id=f"user_{i}",- timestamp="2020-01-04T14:00:00Z",- )-- # Enough non-converting users without any $autocapture events to pass the- # significance filters, so a synthesized correlation row would show up.- for i in range(3):- _create_person(distinct_ids=[f"user_fail_{i}"], team_id=self.team.pk)- _create_event(- team=self.team,- event="user signed up",- distinct_id=f"user_fail_{i}",- timestamp="2020-01-02T14:00:00Z",- )-- result, _ = self._get_events_for_query(- query,- funnelCorrelationType=FunnelCorrelationResultsType.EVENT_WITH_PROPERTIES,- funnelCorrelationEventNames=["$autocapture"],- )-- self.assertEqual(- result,- [- {- "event": '$autocapture::elements_chain::click__~~__a:href="/movie"nth-child="0"nth-of-type="1"',- "success_count": 6,- "failure_count": 0,- "odds_ratio": 28.0,- "correlation_type": "success",- },- ],- )---class TestCorrelationFunctions(unittest.TestCase):- def test_are_results_insignificant(self):- # Same setup as above test: test_discarding_insignificant_events- contingency_tables = [- EventContingencyTable(- event="negatively_related",- visited=EventStats(success_count=0, failure_count=5),- success_total=10,- failure_total=10,- ),- EventContingencyTable(- event="positively_related",- visited=EventStats(success_count=5, failure_count=0),- success_total=10,- failure_total=10,- ),- EventContingencyTable(- event="low_sig_negatively_related",- visited=EventStats(success_count=0, failure_count=2),- success_total=10,- failure_total=10,- ),- EventContingencyTable(- event="low_sig_positively_related",- visited=EventStats(success_count=1, failure_count=0),- success_total=10,- failure_total=10,- ),- ]-- # Discard both low_sig due to %- FunnelCorrelationQueryRunner.MIN_PERSON_PERCENTAGE = 0.11- FunnelCorrelationQueryRunner.MIN_PERSON_COUNT = 25- result = [- 1- for contingency_table in contingency_tables- if not FunnelCorrelationQueryRunner.are_results_insignificant(contingency_table)- ]- self.assertEqual(len(result), 2)-- # Discard one low_sig due to %- FunnelCorrelationQueryRunner.MIN_PERSON_PERCENTAGE = 0.051- FunnelCorrelationQueryRunner.MIN_PERSON_COUNT = 25- result = [- 1- for contingency_table in contingency_tables- if not FunnelCorrelationQueryRunner.are_results_insignificant(contingency_table)- ]- self.assertEqual(len(result), 3)-- # Discard both due to count- FunnelCorrelationQueryRunner.MIN_PERSON_PERCENTAGE = 0.5- FunnelCorrelationQueryRunner.MIN_PERSON_COUNT = 3- result = [- 1- for contingency_table in contingency_tables- if not FunnelCorrelationQueryRunner.are_results_insignificant(contingency_table)- ]- self.assertEqual(len(result), 2)-- # Discard one due to count- FunnelCorrelationQueryRunner.MIN_PERSON_PERCENTAGE = 0.5- FunnelCorrelationQueryRunner.MIN_PERSON_COUNT = 2- result = [- 1- for contingency_table in contingency_tables- if not FunnelCorrelationQueryRunner.are_results_insignificant(contingency_table)- ]- self.assertEqual(len(result), 3)-- # Discard everything due to %- FunnelCorrelationQueryRunner.MIN_PERSON_PERCENTAGE = 0.5- FunnelCorrelationQueryRunner.MIN_PERSON_COUNT = 100- result = [- 1- for contingency_table in contingency_tables- if not FunnelCorrelationQueryRunner.are_results_insignificant(contingency_table)- ]- self.assertEqual(len(result), 0)-- # Discard everything due to count- FunnelCorrelationQueryRunner.MIN_PERSON_PERCENTAGE = 0.5- FunnelCorrelationQueryRunner.MIN_PERSON_COUNT = 6- result = [- 1- for contingency_table in contingency_tables- if not FunnelCorrelationQueryRunner.are_results_insignificant(contingency_table)- ]- self.assertEqual(len(result), 0)---class TestFunnelCorrelationSQLInjection(ClickhouseTestMixin, APIBaseTest):- """- Security tests to verify SQL injection payloads in funnelCorrelationNames- and related parameters are safely escaped.- """-- def _setup_basic_funnel(self) -> FunnelsQuery:- """Create minimal funnel data for testing."""- _create_person(distinct_ids=["person1"], team_id=self.team.pk, properties={"email": "[email protected]"})- _create_event(team=self.team, event="$pageview", distinct_id="person1")- _create_event(team=self.team, event="$pageleave", distinct_id="person1")- flush_persons_and_events()- return FunnelsQuery(- series=[EventsNode(event="$pageview"), EventsNode(event="$pageleave")],- dateRange=DateRange(date_from="2020-01-01", date_to="2020-01-14"),- )-- def _run_correlation_with_names(self, query: FunnelsQuery, correlation_names):- """Helper to run correlation query with given names."""- actors_query = FunnelsActorsQuery(source=query)- correlation_query = FunnelCorrelationQuery(- source=actors_query,- funnelCorrelationType=FunnelCorrelationResultsType.PROPERTIES,- funnelCorrelationNames=correlation_names,- )- return FunnelCorrelationQueryRunner(query=correlation_query, team=self.team)._calculate_internal()-- def _run_event_correlation_with_exclude(self, query: FunnelsQuery, exclude_names):- """Helper to run event correlation with exclude names."""- actors_query = FunnelsActorsQuery(source=query)- correlation_query = FunnelCorrelationQuery(- source=actors_query,- funnelCorrelationType=FunnelCorrelationResultsType.EVENTS,- funnelCorrelationExcludeEventNames=exclude_names,- )- return FunnelCorrelationQueryRunner(query=correlation_query, team=self.team)._calculate_internal()-- @time_machine.travel("2020-01-14", tick=False)- def test_sql_injection_quote_breakout_in_correlation_names(self):- """Verify SQL injection via quote breakout in funnelCorrelationNames is escaped."""- query = self._setup_basic_funnel()-- malicious_inputs = [- "x') as a, version() as b --",- "'; DROP TABLE events; --",- "x\\' OR 1=1 --",- 'x" OR 1=1 --',- "x' || (SELECT 1) || '",- ]-- for payload in malicious_inputs:- # Should not raise a SQL syntax error from injection- # (may raise other errors like empty results, but NOT from injected SQL executing)- try:- self._run_correlation_with_names(query, [payload])- # If we get here, the query executed safely (payload was escaped)- except Exception as e:- # Acceptable errors: validation errors, empty results- # Not acceptable: SQL syntax errors indicating injection worked- error_msg = str(e).lower()- self.assertNotIn("syntax error", error_msg, f"SQL injection may have worked with payload: {payload}")- self.assertNotIn("unexpected", error_msg, f"SQL injection may have worked with payload: {payload}")-- @time_machine.travel("2020-01-14", tick=False)- def test_sql_injection_in_exclude_event_names(self):- """Verify SQL injection via funnelCorrelationExcludeEventNames is escaped."""- query = self._setup_basic_funnel()-- malicious_inputs = [- "'; DROP TABLE events; --",- "x' OR '1'='1",- ]-- for payload in malicious_inputs:- try:- self._run_event_correlation_with_exclude(query, [payload])- except Exception as e:- error_msg = str(e).lower()- self.assertNotIn("syntax error", error_msg, f"SQL injection may have worked with payload: {payload}")-- @time_machine.travel("2020-01-14", tick=False)- def test_special_characters_in_property_names_are_handled(self):- """Verify special characters in property names don't cause SQL errors."""- query = self._setup_basic_funnel()-- special_chars = [- "property with spaces",- "property'with'quotes",- 'property"with"doublequotes',- "property\\with\\backslashes",- "property\nwith\nnewlines",- "property\twith\ttabs",- "$special$chars$",- "unicode_émoji_🎉",- ]-- for prop_name in special_chars:- try:- self._run_correlation_with_names(query, [prop_name])- # Query should execute without SQL errors- except Exception as e:- error_msg = str(e).lower()- # Should not be a SQL syntax error- self.assertNotIn("syntax error", error_msg, f"Special character handling failed for: {repr(prop_name)}")diff --git a/products/product_analytics/backend/hogql_queries/funnels/test/test_funnel_correlation_actors.py b/products/product_analytics/backend/hogql_queries/funnels/test/test_funnel_correlation_actors.pydeleted file mode 100644index 6baf2079b0be..000000000000--- a/products/product_analytics/backend/hogql_queries/funnels/test/test_funnel_correlation_actors.py+++ /dev/null@@ -1,610 +0,0 @@-from datetime import datetime, timedelta-from typing import Optional-from uuid import UUID--import time_machine-from posthog.test.base import (- APIBaseTest,- ClickhouseTestMixin,- _create_event,- _create_person,- snapshot_clickhouse_queries,-)-from unittest import skip--from django.utils import timezone--from parameterized import parameterized--from posthog.schema import (- ActorsQuery,- DateRange,- EventsNode,- FunnelCorrelationActorsQuery,- FunnelCorrelationQuery,- FunnelCorrelationResultsType,- FunnelsActorsQuery,- FunnelsFilter,- FunnelsQuery,- HogQLQueryModifiers,- InsightActorsQueryOptions,- StepOrderValue,-)--from posthog.hogql_queries.actors_query_runner import ActorsQueryRunner-from posthog.hogql_queries.query_runner import get_query_runner-from posthog.models.team.team import Team-from posthog.session_recordings.queries.test.session_replay_sql import produce_replay_summary-from posthog.test.test_journeys import journeys_for---def get_actors(- funnels_query: FunnelsQuery,- team: Team,- funnelCorrelationType: Optional[FunnelCorrelationResultsType] = FunnelCorrelationResultsType.EVENTS,- funnelCorrelationNames=None,- funnelCorrelationPersonConverted: Optional[bool] = None,- funnelCorrelationPersonEntity: Optional[EventsNode] = None,- funnelCorrelationPropertyValues=None,- includeRecordings: Optional[bool] = True,-):- funnel_actors_query = FunnelsActorsQuery(source=funnels_query, includeRecordings=includeRecordings)- correlation_query = FunnelCorrelationQuery(- source=funnel_actors_query,- funnelCorrelationType=(funnelCorrelationType or FunnelCorrelationResultsType.EVENTS),- funnelCorrelationNames=funnelCorrelationNames,- )- correlation_actors_query = FunnelCorrelationActorsQuery(- source=correlation_query,- funnelCorrelationPersonConverted=funnelCorrelationPersonConverted,- funnelCorrelationPersonEntity=funnelCorrelationPersonEntity,- funnelCorrelationPropertyValues=funnelCorrelationPropertyValues,- )- persons_select = ["id", "person", *(["matched_recordings"] if includeRecordings else [])]- groups_select = ["actor_id"]- actors_query = ActorsQuery(- source=correlation_actors_query,- select=persons_select if funnels_query.aggregation_group_type_index is None else groups_select,- )- response = ActorsQueryRunner(query=actors_query, team=team).calculate()- return response.results---class TestFunnelCorrelationActors(ClickhouseTestMixin, APIBaseTest):- maxDiff = None-- @parameterized.expand([("correlation",), ("correlation_actors",), ("actors_options",)])- def test_wrapper_queries_use_source_funnel_modifiers(self, wrapper):- funnel = FunnelsQuery(- series=[EventsNode(event="$pageview"), EventsNode(event="$pageview")],- modifiers=HogQLQueryModifiers(useNewEventsSchema=True),- )- correlation = FunnelCorrelationQuery(- source=FunnelsActorsQuery(source=funnel), funnelCorrelationType=FunnelCorrelationResultsType.EVENTS- )- query = {- "correlation": correlation,- "correlation_actors": FunnelCorrelationActorsQuery(source=correlation),- "actors_options": InsightActorsQueryOptions(source=FunnelsActorsQuery(source=funnel)),- }[wrapper]-- runner = get_query_runner(query, self.team)- self.assertTrue(runner.modifiers.useNewEventsSchema)-- def _setup_basic_test(self):- query = FunnelsQuery(- series=[- EventsNode(event="user signed up"),- EventsNode(event="paid"),- ],- dateRange=DateRange(- date_from="2020-01-01",- date_to="2020-01-14",- ),- )-- success_target_persons = []- failure_target_persons = []- events_by_person = {}- for i in range(10):- person_id = f"user_{i}"- person = _create_person(distinct_ids=[person_id], team_id=self.team.pk)- events_by_person[person_id] = [{"event": "user signed up", "timestamp": datetime(2020, 1, 2, 14)}]-- if i % 2 == 0:- events_by_person[person_id].append(- {- "event": "positively_related",- "timestamp": datetime(2020, 1, 3, 14),- }- )-- success_target_persons.append(str(person.uuid))-- events_by_person[person_id].append({"event": "paid", "timestamp": datetime(2020, 1, 4, 14)})-- for i in range(10, 20):- person_id = f"user_{i}"- person = _create_person(distinct_ids=[person_id], team_id=self.team.pk)- events_by_person[person_id] = [{"event": "user signed up", "timestamp": datetime(2020, 1, 2, 14)}]- if i % 2 == 0:- events_by_person[person_id].append(- {- "event": "negatively_related",- "timestamp": datetime(2020, 1, 3, 14),- }- )- failure_target_persons.append(str(person.uuid))-- # One positively_related as failure- person_fail_id = "user_fail"- person_fail = _create_person(distinct_ids=[person_fail_id], team_id=self.team.pk)- events_by_person[person_fail_id] = [- {"event": "user signed up", "timestamp": datetime(2020, 1, 2, 14)},- {"event": "positively_related", "timestamp": datetime(2020, 1, 3, 14)},- ]-- # One negatively_related as success- person_success_id = "user_succ"- person_succ = _create_person(distinct_ids=[person_success_id], team_id=self.team.pk)- events_by_person[person_success_id] = [- {"event": "user signed up", "timestamp": datetime(2020, 1, 2, 14)},- {"event": "negatively_related", "timestamp": datetime(2020, 1, 3, 14)},- {"event": "paid", "timestamp": datetime(2020, 1, 4, 14)},- ]- journeys_for(events_by_person, self.team, create_people=False)-- return (- query,- success_target_persons,- failure_target_persons,- person_fail,- person_succ,- )-- def test_basic_funnel_correlation_with_events(self):- (- query,- success_target_persons,- failure_target_persons,- person_fail,- person_succ,- ) = self._setup_basic_test()-- # test positively_related successes- serialized_actors = get_actors(- query,- self.team,- funnelCorrelationPersonConverted=True,- funnelCorrelationPersonEntity=EventsNode(event="positively_related"),- )-- self.assertCountEqual([str(val[1]["id"]) for val in serialized_actors], success_target_persons)-- # test negatively_related failures- serialized_actors = get_actors(- query,- self.team,- funnelCorrelationPersonConverted=False,- funnelCorrelationPersonEntity=EventsNode(event="negatively_related"),- )-- self.assertCountEqual([str(val[1]["id"]) for val in serialized_actors], failure_target_persons)-- # test positively_related failures- serialized_actors = get_actors(- query,- self.team,- funnelCorrelationPersonConverted=False,- funnelCorrelationPersonEntity=EventsNode(event="positively_related"),- )-- self.assertCountEqual([str(val[1]["id"]) for val in serialized_actors], [str(person_fail.uuid)])-- # test negatively_related successes- serialized_actors = get_actors(- query,- self.team,- funnelCorrelationPersonConverted=True,- funnelCorrelationPersonEntity=EventsNode(event="negatively_related"),- )-- self.assertCountEqual([str(val[1]["id"]) for val in serialized_actors], [str(person_succ.uuid)])-- # test all positively_related- serialized_actors = get_actors(- query,- self.team,- funnelCorrelationPersonConverted=None,- funnelCorrelationPersonEntity=EventsNode(event="positively_related"),- )-- self.assertCountEqual(- [str(val[1]["id"]) for val in serialized_actors],- [*success_target_persons, str(person_fail.uuid)],- )-- # test all negatively_related- serialized_actors = get_actors(- query,- self.team,- funnelCorrelationPersonConverted=None,- funnelCorrelationPersonEntity=EventsNode(event="negatively_related"),- )-- self.assertCountEqual(- [str(val[1]["id"]) for val in serialized_actors],- [*failure_target_persons, str(person_succ.uuid)],- )-- def test_people_arent_returned_multiple_times(self):- people = journeys_for(- {- "user_1": [- {"event": "user signed up", "timestamp": datetime(2020, 1, 2, 14)},- {- "event": "positively_related",- "timestamp": datetime(2020, 1, 3, 14),- },- # duplicate event- {- "event": "positively_related",- "timestamp": datetime(2020, 1, 3, 14),- },- {"event": "paid", "timestamp": datetime(2020, 1, 4, 14)},- ]- },- self.team,- )-- query = FunnelsQuery(- series=[- EventsNode(event="user signed up"),- EventsNode(event="paid"),- ],- dateRange=DateRange(- date_from="2020-01-01",- date_to="2020-01-14",- ),- )-- serialized_actors = get_actors(- query,- self.team,- funnelCorrelationPersonConverted=True,- funnelCorrelationPersonEntity=EventsNode(event="positively_related"),- )-- self.assertCountEqual([str(val[1]["id"]) for val in serialized_actors], [str(people["user_1"].uuid)])-- @snapshot_clickhouse_queries- @time_machine.travel("2021-01-02 00:00:00.000Z", tick=False)- def test_funnel_correlation_on_event_with_recordings(self):- p1 = _create_person(distinct_ids=["user_1"], team=self.team, properties={"foo": "bar"})- _create_event(- event="$pageview",- distinct_id="user_1",- team=self.team,- timestamp=timezone.now(),- properties={"$session_id": "s2", "$window_id": "w1"},- event_uuid="11111111-1111-1111-1111-111111111111",- )- _create_event(- event="insight loaded",- distinct_id="user_1",- team=self.team,- timestamp=(timezone.now() + timedelta(minutes=2)),- properties={"$session_id": "s2", "$window_id": "w2"},- event_uuid="31111111-1111-1111-1111-111111111111",- )- _create_event(- event="insight analyzed",- distinct_id="user_1",- team=self.team,- timestamp=(timezone.now() + timedelta(minutes=3)),- properties={"$session_id": "s2", "$window_id": "w2"},- event_uuid="21111111-1111-1111-1111-111111111111",- )-- timestamp = datetime(2021, 1, 2, 0, 0, 0)- produce_replay_summary(- team_id=self.team.pk,- session_id="s2",- distinct_id="user_1",- first_timestamp=timestamp,- last_timestamp=timestamp,- )-- # Success filter- query = FunnelsQuery(- series=[- EventsNode(event="$pageview"),- EventsNode(event="insight analyzed"),- ],- dateRange=DateRange(- date_from="2021-01-01",- date_to="2021-01-08",- ),- )-- results = get_actors(- query,- self.team,- funnelCorrelationPersonConverted=True,- funnelCorrelationPersonEntity=EventsNode(event="insight loaded"),- )-- self.assertEqual(results[0][1]["id"], p1.uuid)- self.assertEqual(- list(results[0][2]),- [- {- "events": [- {- "timestamp": timezone.now() + timedelta(minutes=3),- "uuid": UUID("21111111-1111-1111-1111-111111111111"),- "window_id": "w2",- }- ],- "session_id": "s2",- }- ],- )-- # Drop off filter- query = FunnelsQuery(- series=[- EventsNode(event="$pageview"),- EventsNode(event="insight analyzed"),- EventsNode(event="insight updated"),- ],- dateRange=DateRange(- date_from="2021-01-01",- date_to="2021-01-08",- ),- )- results = get_actors(- query,- self.team,- funnelCorrelationPersonConverted=False,- funnelCorrelationPersonEntity=EventsNode(event="insight loaded"),- )-- self.assertEqual(results[0][1]["id"], p1.uuid)- self.assertEqual(- list(results[0][2]),- [- {- "events": [- {- "timestamp": timezone.now() + timedelta(minutes=3),- "uuid": UUID("21111111-1111-1111-1111-111111111111"),- "window_id": "w2",- }- ],- "session_id": "s2",- }- ],- )-- @snapshot_clickhouse_queries- @time_machine.travel("2021-01-02 00:00:00.000Z", tick=False)- def test_funnel_correlation_on_properties_with_recordings(self):- p1 = _create_person(distinct_ids=["user_1"], team=self.team, properties={"foo": "bar"})- _create_event(- event="$pageview",- distinct_id="user_1",- team=self.team,- timestamp=timezone.now(),- properties={"$session_id": "s2", "$window_id": "w1"},- event_uuid="11111111-1111-1111-1111-111111111111",- )- _create_event(- event="insight analyzed",- distinct_id="user_1",- team=self.team,- timestamp=(timezone.now() + timedelta(minutes=3)),- properties={"$session_id": "s2", "$window_id": "w2"},- event_uuid="21111111-1111-1111-1111-111111111111",- )-- timestamp = datetime(2021, 1, 2, 0, 0, 0)- produce_replay_summary(- team_id=self.team.pk,- session_id="s2",- distinct_id="user_1",- first_timestamp=timestamp,- last_timestamp=timestamp,- )-- # Success filter- query = FunnelsQuery(- series=[- EventsNode(event="$pageview"),- EventsNode(event="insight analyzed"),- ],- dateRange=DateRange(- date_from="2021-01-01",- date_to="2021-01-08",- ),- )- results = get_actors(- query,- self.team,- funnelCorrelationType=FunnelCorrelationResultsType.PROPERTIES,- funnelCorrelationPersonConverted=True,- funnelCorrelationPropertyValues=[- {- "key": "foo",- "value": "bar",- "operator": "exact",- "type": "person",- }- ],- )-- self.assertEqual(results[0][1]["id"], p1.uuid)- self.assertEqual(- list(results[0][2]),- [- {- "events": [- {- "timestamp": timezone.now() + timedelta(minutes=3),- "uuid": UUID("21111111-1111-1111-1111-111111111111"),- "window_id": "w2",- }- ],- "session_id": "s2",- }- ],- )-- @snapshot_clickhouse_queries- @time_machine.travel("2021-01-02 00:00:00.000Z", tick=False)- @skip("Works locally and works after you tmate onto github actions and run it, but fails in CI")- def test_strict_funnel_correlation_with_recordings(self):- # First use that successfully completes the strict funnel- p1 = _create_person(distinct_ids=["user_1"], team=self.team, properties={"foo": "bar"})- _create_event(- event="$pageview",- distinct_id="user_1",- team=self.team,- timestamp=timezone.now(),- properties={"$session_id": "s2", "$window_id": "w1"},- event_uuid="11111111-1111-1111-1111-111111111111",- )- _create_event(- event="insight analyzed",- distinct_id="user_1",- team=self.team,- timestamp=(timezone.now() + timedelta(minutes=3)),- properties={"$session_id": "s2", "$window_id": "w2"},- event_uuid="31111111-1111-1111-1111-111111111111",- )- _create_event(- event="insight analyzed", # Second event should not be returned- distinct_id="user_1",- team=self.team,- timestamp=(timezone.now() + timedelta(minutes=4)),- properties={"$session_id": "s2", "$window_id": "w2"},- event_uuid="41111111-1111-1111-1111-111111111111",- )-- produce_replay_summary(- team_id=self.team.pk,- session_id="s2",- distinct_id="user_1",- )-- # Second user with strict funnel drop off, but completed the step events for a normal funnel- p2 = _create_person(distinct_ids=["user_2"], team=self.team, properties={"foo": "bar"})- _create_event(- event="$pageview",- distinct_id="user_2",- team=self.team,- timestamp=timezone.now(),- properties={"$session_id": "s3", "$window_id": "w1"},- event_uuid="51111111-1111-1111-1111-111111111111",- )- _create_event(- event="insight loaded", # Interupting event- distinct_id="user_2",- team=self.team,- timestamp=(timezone.now() + timedelta(minutes=3)),- properties={"$session_id": "s3", "$window_id": "w2"},- event_uuid="61111111-1111-1111-1111-111111111111",- )- _create_event(- event="insight analyzed",- distinct_id="user_2",- team=self.team,- timestamp=(timezone.now() + timedelta(minutes=4)),- properties={"$session_id": "s3", "$window_id": "w2"},- event_uuid="71111111-1111-1111-1111-111111111111",- )-- produce_replay_summary(- team_id=self.team.pk,- session_id="s3",- distinct_id="user_2",- )-- # Success filter- query = FunnelsQuery(- series=[- EventsNode(event="$pageview"),- EventsNode(event="insight analyzed"),- ],- dateRange=DateRange(- date_from="2021-01-01",- date_to="2021-01-08",- ),- funnelsFilter=FunnelsFilter(funnelOrderType=StepOrderValue.STRICT),- )-- results = get_actors(- query,- self.team,- funnelCorrelationType=FunnelCorrelationResultsType.PROPERTIES,- funnelCorrelationPersonConverted=True,- funnelCorrelationPropertyValues=[- {- "key": "foo",- "value": "bar",- "operator": "exact",- "type": "person",- }- ],- )-- self.assertEqual(len(results), 1)- self.assertEqual(results[0][1]["id"], p1.uuid)- self.assertEqual(- list(results[0][2]),- [- {- "events": [- {- "timestamp": timezone.now() + timedelta(minutes=3),- "uuid": UUID("31111111-1111-1111-1111-111111111111"),- "window_id": "w2",- }- ],- "session_id": "s2",- }- ],- )-- # Drop off filter- results = get_actors(- query,- self.team,- funnelCorrelationType=FunnelCorrelationResultsType.PROPERTIES,- funnelCorrelationPersonConverted=False,- funnelCorrelationPropertyValues=[- {- "key": "foo",- "value": "bar",- "operator": "exact",- "type": "person",- }- ],- )-- self.assertEqual(results[0][1]["id"], p2.uuid)- self.assertEqual(- list(results[0][2]),- [- {- "events": [- {- "timestamp": timezone.now(),- "uuid": UUID("51111111-1111-1111-1111-111111111111"),- "window_id": "w1",- }- ],- "session_id": "s3",- }- ],- )diff --git a/products/product_analytics/backend/hogql_queries/funnels/test/test_funnel_validation_rules.py b/products/product_analytics/backend/hogql_queries/funnels/test/test_funnel_validation_rules.pyindex 446b3a048a34..9d580e23604e 100644--- a/products/product_analytics/backend/hogql_queries/funnels/test/test_funnel_validation_rules.py+++ b/products/product_analytics/backend/hogql_queries/funnels/test/test_funnel_validation_rules.py@@ -6,10 +6,7 @@ from rest_framework.exceptions import ValidationErrorfrom posthog.schema import (EventsNode,- FunnelCorrelationQuery,- FunnelCorrelationResultsType,FunnelExclusionEventsNode,- FunnelsActorsQuery,FunnelsFilter,FunnelsQuery,FunnelVizType,@@ -18,9 +15,6 @@ from posthog.schema import (from posthog.hogql_queries.validation.validation import QueryValidationContext-from products.product_analytics.backend.hogql_queries.funnels.funnel_correlation_query_runner import (- FunnelCorrelationQueryRunner,-)from products.product_analytics.backend.hogql_queries.funnels.funnel_validation_rules import (MAX_FUNNEL_STEPS,RequireAtLeastTwoFunnelSteps,@@ -67,18 +61,6 @@ class TestFunnelValidationRules(BaseTest):FunnelsQueryRunner(query=query, team=self.team).validate()- def test_rejects_correlation_on_funnels_beyond_max_steps(self):- funnels_query = FunnelsQuery(series=[EventsNode(event=f"step {i}") for i in range(MAX_FUNNEL_STEPS + 1)])- query = FunnelCorrelationQuery(- source=FunnelsActorsQuery(source=funnels_query),- funnelCorrelationType=FunnelCorrelationResultsType.EVENTS,- )-- with self.assertRaises(ValidationError) as context:- FunnelCorrelationQueryRunner(query=query, team=self.team).to_query()-- self.assertEqual(context.exception.get_codes(), ["funnel_max_steps_exceeded"])-@parameterized.expand([(diff --git a/products/product_analytics/backend/tests/api/__snapshots__/test_insight.ambr b/products/product_analytics/backend/tests/api/__snapshots__/test_insight.ambrindex 729e4437f7db..36365900e570 100644--- a/products/product_analytics/backend/tests/api/__snapshots__/test_insight.ambr+++ b/products/product_analytics/backend/tests/api/__snapshots__/test_insight.ambr@@ -273,7 +273,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -600,7 +599,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -973,7 +971,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -1321,7 +1318,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -1498,7 +1494,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -1764,7 +1759,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -1971,7 +1965,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -2285,7 +2278,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -2691,7 +2683,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -2830,7 +2821,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -3138,7 +3128,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -3283,7 +3272,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -3700,7 +3688,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -4014,7 +4001,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -4496,7 +4482,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -4810,7 +4795,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -5216,7 +5200,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -5610,7 +5593,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -5755,7 +5737,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -5955,7 +5936,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -6268,7 +6248,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -6637,7 +6616,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."plugins_opt_in","posthog_team"."opt_out_capture",@@ -7020,7 +6998,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -7421,7 +7398,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",@@ -7566,7 +7542,6 @@"posthog_team"."default_data_theme","posthog_team"."extra_settings","posthog_team"."modifiers",- "posthog_team"."correlation_config","posthog_team"."session_recording_retention_period_days","posthog_team"."external_data_workspace_id","posthog_team"."external_data_workspace_last_synced_at",diff --git a/products/product_analytics/frontend/generated/api.schemas.ts b/products/product_analytics/frontend/generated/api.schemas.tsindex 17353b75d05e..a21ca2f25b3a 100644--- a/products/product_analytics/frontend/generated/api.schemas.ts+++ b/products/product_analytics/frontend/generated/api.schemas.ts@@ -5215,126 +5215,6 @@ export interface FunnelsActorsQueryApi {version?: number | null}-export type FunnelCorrelationResultsTypeApi =- (typeof FunnelCorrelationResultsTypeApi)[keyof typeof FunnelCorrelationResultsTypeApi]--export const FunnelCorrelationResultsTypeApi = {- Events: 'events',- Properties: 'properties',- EventWithProperties: 'event_with_properties',-} as const--export type CorrelationTypeApi = (typeof CorrelationTypeApi)[keyof typeof CorrelationTypeApi]--export const CorrelationTypeApi = {- Success: 'success',- Failure: 'failure',-} as const--export type EventDefinitionApiProperties = { [key: string]: unknown }--export interface EventDefinitionApi {- elements: unknown[]- event: string- properties: EventDefinitionApiProperties-}--export interface EventOddsRatioSerializedApi {- correlation_type: CorrelationTypeApi- event: EventDefinitionApi- failure_count: number- odds_ratio: number- success_count: number-}--export interface FunnelCorrelationResultApi {- events: EventOddsRatioSerializedApi[]- skewed: boolean-}--export interface FunnelCorrelationResponseApi {- columns?: unknown[] | null- /** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */- error?: string | null- hasMore?: boolean | null- /** Generated HogQL query. */- hogql?: string | null- limit?: number | null- /** Modifiers used when performing the query */- modifiers?: HogQLQueryModifiersApi | null- offset?: number | null- /** Query status indicates whether next to the provided data, a query is still running. */- query_status?: QueryStatusApi | null- /** The resolved previous/comparison period date range, when comparing against another period */- resolved_compare_date_range?: ResolvedDateRangeResponseApi | null- /** The date range used for the query */- resolved_date_range?: ResolvedDateRangeResponseApi | null- results: FunnelCorrelationResultApi- /** Measured timings for different parts of the query generation process */- timings?: QueryTimingApi[] | null- types?: unknown[] | null- /** Connector-synced data warehouse sources referenced by this query, if any. */- used_data_warehouse_sources?: DataWarehouseSourceUsageApi[] | null- /** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. Also carries access control warnings when a system-table query filters out objects the user can't access. */- warnings?: (DataWarehouseSyncWarningApi | AccessControlFilterWarningApi)[] | null-}--export interface FunnelCorrelationQueryApi {- funnelCorrelationEventExcludePropertyNames?: string[] | null- funnelCorrelationEventNames?: string[] | null- funnelCorrelationExcludeEventNames?: string[] | null- funnelCorrelationExcludeNames?: string[] | null- funnelCorrelationNames?: string[] | null- funnelCorrelationType: FunnelCorrelationResultsTypeApi- kind?: 'FunnelCorrelationQuery'- response?: FunnelCorrelationResponseApi | null- source: FunnelsActorsQueryApi- /** version of the node, used for schema migrations */- version?: number | null-}--export interface FunnelCorrelationActorsQueryApi {- funnelCorrelationPersonConverted?: boolean | null- funnelCorrelationPersonEntity?: EventsNodeApi | ActionsNodeApi | DataWarehouseNodeApi | null- funnelCorrelationPropertyValues?:- | (- | EventPropertyFilterApi- | PersonPropertyFilterApi- | PersonMetadataPropertyFilterApi- | ElementPropertyFilterApi- | EventMetadataPropertyFilterApi- | SessionPropertyFilterApi- | CohortPropertyFilterApi- | RecordingPropertyFilterApi- | LogEntryPropertyFilterApi- | GroupPropertyFilterApi- | FeaturePropertyFilterApi- | FlagPropertyFilterApi- | HogQLPropertyFilterApi- | EmptyPropertyFilterApi- | DataWarehousePropertyFilterApi- | DataWarehousePersonPropertyFilterApi- | ErrorTrackingIssueFilterApi- | LogPropertyFilterApi- | MetricPropertyFilterApi- | SpanPropertyFilterApi- | RevenueAnalyticsPropertyFilterApi- | AccountCustomPropertyFilterApi- | WorkflowVariablePropertyFilterApi- | BehavioralPropertyFilterApi- )[]- | null- includeRecordings?: boolean | null- kind?: 'FunnelCorrelationActorsQuery'- /** Modifiers used when performing the query */- modifiers?: HogQLQueryModifiersApi | null- response?: ActorsQueryResponseApi | null- source: FunnelCorrelationQueryApi- tags?: QueryLogTagsApi | null- /** version of the node, used for schema migrations */- version?: number | null-}-export type ExperimentEventExposureConfigApiResponse = { [key: string]: unknown } | nullexport interface ExperimentEventExposureConfigApi {@@ -6004,7 +5884,6 @@ export interface ActorsQueryApi {source?:| InsightActorsQueryApi| FunnelsActorsQueryApi- | FunnelCorrelationActorsQueryApi| ExperimentActorsQueryApi| StickinessActorsQueryApi| PathsV2ActorsQueryApidiff --git a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/CorrelationActionsCell.tsx b/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/CorrelationActionsCell.tsxdeleted file mode 100644index 08242d52bbb7..000000000000--- a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/CorrelationActionsCell.tsx+++ /dev/null@@ -1,103 +0,0 @@-import { useActions, useValues } from 'kea'-import { useState } from 'react'--import { IconEllipsis } from '@posthog/icons'--import { LemonButton, LemonButtonProps } from 'lib/lemon-ui/LemonButton'-import { Popover } from 'lib/lemon-ui/Popover/Popover'-import { insightLogic } from 'scenes/insights/insightLogic'--import { FunnelCorrelation, FunnelCorrelationResultsType } from '~/types'--import { funnelCorrelationDetailsLogic } from './funnelCorrelationDetailsLogic'-import { funnelCorrelationLogic } from './funnelCorrelationLogic'-import { funnelPropertyCorrelationLogic } from './funnelPropertyCorrelationLogic'--type CorrelationActionsCellComponentButtonProps = Pick<LemonButtonProps, 'onClick' | 'children' | 'title' | 'disabled'>--type CorrelationActionsCellComponentProps = {- buttons: CorrelationActionsCellComponentButtonProps[]-}--export const EventCorrelationActionsCell = ({ record }: { record: FunnelCorrelation }): JSX.Element => {- const { insightProps } = useValues(insightLogic)- const { isEventExcluded, isEventPropertyExcluded } = useValues(funnelCorrelationLogic(insightProps))- const { excludeEventFromProject, excludeEventPropertyFromProject } = useActions(- funnelCorrelationLogic(insightProps)- )- const { openCorrelationDetailsModal } = useActions(funnelCorrelationDetailsLogic(insightProps))- const components = record.event.event.split('::')-- const buttons: CorrelationActionsCellComponentButtonProps[] = [- ...(record.result_type === FunnelCorrelationResultsType.Events- ? [- {- children: 'View correlation details',- onClick: () => openCorrelationDetailsModal(record),- },- ]- : []),- {- children: 'Exclude event from project',- title: 'Remove this event from any correlation analysis report in this project.',- onClick: () => {- record.result_type === FunnelCorrelationResultsType.EventWithProperties- ? excludeEventPropertyFromProject(components[0], components[1])- : excludeEventFromProject(components[0])- },- disabled:- record.result_type === FunnelCorrelationResultsType.EventWithProperties- ? isEventPropertyExcluded(components[1])- : isEventExcluded(components[0]),- },- ]-- return <CorrelationActionsCellComponent buttons={buttons} />-}--export const PropertyCorrelationActionsCell = ({ record }: { record: FunnelCorrelation }): JSX.Element => {- const { insightProps } = useValues(insightLogic)- const { isPropertyExcludedFromProject } = useValues(funnelPropertyCorrelationLogic(insightProps))- const { excludePropertyFromProject } = useActions(funnelPropertyCorrelationLogic(insightProps))- const { openCorrelationDetailsModal } = useActions(funnelCorrelationDetailsLogic(insightProps))- const propertyName = (record.event.event || '').split('::')[0]-- const buttons: CorrelationActionsCellComponentButtonProps[] = [- {- children: 'View correlation details',- onClick: () => openCorrelationDetailsModal(record),- },- {- children: 'Exclude property from project',- title: 'Remove this property from any correlation analysis report in this project.',- onClick: () => excludePropertyFromProject(propertyName),- disabled: isPropertyExcludedFromProject(propertyName),- },- ]-- return <CorrelationActionsCellComponent buttons={buttons} />-}--const CorrelationActionsCellComponent = ({ buttons }: CorrelationActionsCellComponentProps): JSX.Element => {- const [popoverOpen, setPopoverOpen] = useState(false)- return (- <Popover- visible={popoverOpen}- actionable- onClickOutside={() => setPopoverOpen(false)}- overlay={buttons.map(({ onClick, ...props }, index) => (- <LemonButton- key={index}- fullWidth- onClick={(e) => {- setPopoverOpen(false)- onClick && onClick(e)- }}- {...props}- />- ))}- >- <LemonButton icon={<IconEllipsis />} onClick={() => setPopoverOpen(!popoverOpen)} />- </Popover>- )-}diff --git a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/CorrelationMatrix.scss b/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/CorrelationMatrix.scssdeleted file mode 100644index aff3c707a35a..000000000000--- a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/CorrelationMatrix.scss+++ /dev/null@@ -1,47 +0,0 @@-.correlation-table-wrapper {- table {- margin: 0 auto;- border-spacing: 0;- border-collapse: separate;- border: 1px solid var(--color-border-primary);- border-radius: var(--radius);-- td {- padding: 0.5rem 1rem;- text-align: center;- border-top: 1px solid var(--color-border-primary);- border-left: 1px solid var(--color-border-primary);-- .percentage {- padding-bottom: 0.25rem;- font-weight: bold;- }-- &:first-child {- border-left: none;- }- }-- .table-title {- color: var(--color-text-secondary);-- td {- border-top: none;- }- }-- thead,- .horizontal-header {- font-weight: bold;- color: var(--color-text-secondary);- text-transform: uppercase;- background-color: var(--color-bg-primary);- }-- tbody {- td:not(.horizontal-header) {- text-align: right;- }- }- }-}diff --git a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/CorrelationMatrix.tsx b/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/CorrelationMatrix.tsxdeleted file mode 100644index 92abf310506c..000000000000--- a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/CorrelationMatrix.tsx+++ /dev/null@@ -1,232 +0,0 @@-import './CorrelationMatrix.scss'--import clsx from 'clsx'-import { useActions, useValues } from 'kea'--import { IconCheckCircle } from '@posthog/icons'-import { LemonButton, LemonModal } from '@posthog/lemon-ui'--import { PropertyKeyInfo } from 'lib/components/PropertyKeyInfo'-import { IconCancel, IconErrorOutline, IconTrendingFlat, IconTrendingFlatDown } from 'lib/lemon-ui/icons'-import { LemonBanner } from 'lib/lemon-ui/LemonBanner'-import { Link } from 'lib/lemon-ui/Link'-import { Spinner } from 'lib/lemon-ui/Spinner/Spinner'-import { Tooltip } from 'lib/lemon-ui/Tooltip'-import { percentage } from 'lib/utils/numbers'-import { capitalizeFirstLetter, pluralize } from 'lib/utils/strings'-import { insightLogic } from 'scenes/insights/insightLogic'--import { FunnelCorrelationResultsType, FunnelCorrelationType } from '~/types'--import { funnelPersonsModalLogic } from '../funnelPersonsModalLogic'-import { parseDisplayNameForCorrelation } from '../funnelUtils'-import { funnelCorrelationDetailsLogic } from './funnelCorrelationDetailsLogic'-import { funnelCorrelationLogic } from './funnelCorrelationLogic'--export function CorrelationMatrix(): JSX.Element {- const { insightProps } = useValues(insightLogic)- const { correlationsLoading } = useValues(funnelCorrelationLogic(insightProps))- const { correlationDetailsModalOpen, correlationDetails, correlationMatrixAndScore } = useValues(- funnelCorrelationDetailsLogic(insightProps)- )- const { closeCorrelationDetailsModal } = useActions(funnelCorrelationDetailsLogic(insightProps))- const { openCorrelationPersonsModal } = useActions(funnelPersonsModalLogic(insightProps))-- const actor = correlationDetails?.result_type === FunnelCorrelationResultsType.Events ? 'event' : 'property'- const action =- correlationDetails?.result_type === FunnelCorrelationResultsType.Events ? 'performed event' : 'have property'-- let displayName = <></>-- if (correlationDetails) {- const { first_value, second_value } = parseDisplayNameForCorrelation(correlationDetails)- displayName = (- <>- <PropertyKeyInfo value={first_value} />- {second_value !== undefined && (- <>- {' :: '}- <PropertyKeyInfo value={second_value} disablePopover />- </>- )}- </>- )- }-- const { correlationScore, truePositive, falsePositive, trueNegative, falseNegative, correlationScoreStrength } =- correlationMatrixAndScore-- const scoreIcon =- correlationScoreStrength === 'strong' ? (- <IconCheckCircle className="text-success" />- ) : correlationScoreStrength === 'moderate' ? (- <IconCancel className="text-warning" />- ) : (- <IconErrorOutline className="text-danger" />- )-- return (- <LemonModal- isOpen={correlationDetailsModalOpen}- onClose={closeCorrelationDetailsModal}- footer={<LemonButton onClick={closeCorrelationDetailsModal}>Dismiss</LemonButton>}- title="Correlation details"- >- <div className="correlation-table-wrapper">- {correlationsLoading ? (- <div className="mt-4 text-center">- <Spinner className="text-4xl" />- </div>- ) : correlationDetails ? (- <>- <p className="text-secondary mb-4">- The table below displays the correlation details for users who {action} <b>{displayName}</b>- .- </p>- <table>- <thead>- <tr className="table-title">- <td colSpan={3}>Results matrix</td>- </tr>- <tr>- <td>- {correlationDetails?.result_type === FunnelCorrelationResultsType.Events- ? 'Performed event'- : 'Has property'}- </td>- <td>Success</td>- <td>Dropped off</td>- </tr>- </thead>- <tbody>- <tr>- <td className="horizontal-header">Yes</td>- <td>- <Tooltip- title={`True positive (TP) - Percentage of users who ${action} and completed the funnel.`}- >- <div className="percentage">- {truePositive- ? percentage(truePositive / (truePositive + falsePositive))- : '0.00%'}- </div>- </Tooltip>- {truePositive === 0 ? (- '0 users'- ) : (- <Link- onClick={() => {- openCorrelationPersonsModal(correlationDetails, true)- }}- >- {pluralize(truePositive, 'user', undefined, true)}- </Link>- )}- </td>- <td>- <Tooltip- title={`False negative (FN) - Percentage of users who ${action} and did not complete the funnel.`}- >- <div className="percentage">- {falseNegative- ? percentage(falseNegative / (falseNegative + trueNegative))- : '0.00%'}- </div>- </Tooltip>- {falseNegative === 0 ? (- '0 users'- ) : (- <Link- onClick={() => {- openCorrelationPersonsModal(correlationDetails, false)- }}- >- {pluralize(falseNegative, 'user', undefined, true)}- </Link>- )}- </td>- </tr>- <tr>- <td className="horizontal-header">No</td>- <td>- <Tooltip- title={`False positive (FP) - Percentage of users who did not ${action} and completed the funnel.`}- >- <div className="percentage">- {falsePositive- ? percentage(falsePositive / (truePositive + falsePositive))- : '0.00%'}- </div>- </Tooltip>- {pluralize(falsePositive, 'user', undefined, true)}- </td>- <td>- <Tooltip- title={`True negative (TN) - Percentage of users who did not ${action} and did not complete the funnel.`}- >- <div className="percentage">- {trueNegative- ? percentage(trueNegative / (falseNegative + trueNegative))- : '0.00%'}- </div>- </Tooltip>- {pluralize(trueNegative, 'user', undefined, true)}- </td>- </tr>- <tr>- <td className="horizontal-header" />- <td>- <b>100%</b>- </td>- <td>- <b>100%</b>- </td>- </tr>- </tbody>- </table>- <div className="mt-4 text-center">- {capitalizeFirstLetter(correlationDetails?.result_type || '')} <b>{displayName}</b> has a{' '}- {correlationDetails?.correlation_type === FunnelCorrelationType.Success ? (- <Tooltip- title={`Positive correlation means this ${actor} is correlated with a successful conversion.`}- >- <span className="cursor-help text-success">- <IconTrendingFlat /> positive correlation- </span>- </Tooltip>- ) : (- <Tooltip- title={`Negative correlation means this ${actor} is correlated with an unsuccessful conversion (user dropped off).`}- >- <strong className="cursor-help text-danger">- <IconTrendingFlatDown /> negative correlation- </strong>- </Tooltip>- )}{' '}- score of{' '}- <Tooltip title={`This ${actor} has ${correlationScoreStrength} correlation.`}>- <strong- className={clsx(- 'cursor-help',- correlationScoreStrength === 'strong'- ? 'text-success'- : correlationScoreStrength === 'moderate'- ? 'text-warning'- : 'text-danger'- )}- >- {scoreIcon} {correlationScore.toFixed(3)}- </strong>- </Tooltip>- </div>- </>- ) : (- <LemonBanner type="error">- We could not load the details for this correlation value. Please recreate your funnel and try- again.- </LemonBanner>- )}- </div>- </LemonModal>- )-}diff --git a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelCorrelation.scss b/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelCorrelation.scssdeleted file mode 100644index 6fec1da56c3c..000000000000--- a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelCorrelation.scss+++ /dev/null@@ -1,21 +0,0 @@-.funnel-correlation {- margin-bottom: 3rem;-- .skew-warning {- margin-top: 1rem;- line-height: 2em;- background-color: var(--color-bg-surface-primary);- border: 1px solid var(--warning);- border-radius: var(--radius);-- h4 {- position: relative;- display: flex;- align-items: center;- justify-content: space-between;- padding: 0.5rem;- font-size: 1.1em;- border-bottom: 1px solid var(--color-border-primary);- }- }-}diff --git a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelCorrelation.tsx b/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelCorrelation.tsxdeleted file mode 100644index 3a40d317b0d5..000000000000--- a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelCorrelation.tsx+++ /dev/null@@ -1,40 +0,0 @@-import './FunnelCorrelation.scss'--import { useMountedLogic, useValues } from 'kea'--import { PayGateMini } from 'lib/components/PayGateMini/PayGateMini'-import { insightLogic } from 'scenes/insights/insightLogic'--import { AvailableFeature, FunnelVizType } from '~/types'--import { funnelDataLogic } from '../funnelDataLogic'-import { FunnelCorrelationSkewWarning } from './FunnelCorrelationSkewWarning'-import { FunnelCorrelationTable } from './FunnelCorrelationTable'-import { funnelCorrelationUsageLogic } from './funnelCorrelationUsageLogic'-import { FunnelPropertyCorrelationTable } from './FunnelPropertyCorrelationTable'--export const FunnelCorrelation = (): JSX.Element | null => {- const { insightProps } = useValues(insightLogic)- const { steps, funnelVizType: vizType, hasDataWarehouseSeries } = useValues(funnelDataLogic(insightProps))- useMountedLogic(funnelCorrelationUsageLogic(insightProps))- if (- (vizType !== FunnelVizType.Steps && vizType !== FunnelVizType.Flow) ||- steps.length <= 1 ||- hasDataWarehouseSeries- ) {- return null- }-- return (- <>- <h2 className="font-semibold text-lg my-4">Correlation analysis</h2>- <PayGateMini feature={AvailableFeature.CORRELATION_ANALYSIS} featureDetail="funnel-correlation-analysis">- <div className="funnel-correlation">- <FunnelCorrelationSkewWarning />- <FunnelCorrelationTable />- <FunnelPropertyCorrelationTable />- </div>- </PayGateMini>- </>- )-}diff --git a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelCorrelationSkewWarning.tsx b/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelCorrelationSkewWarning.tsxdeleted file mode 100644index 86333dfed0cc..000000000000--- a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelCorrelationSkewWarning.tsx+++ /dev/null@@ -1,41 +0,0 @@-import { useActions, useValues } from 'kea'--import { IconX } from '@posthog/icons'-import { LemonButton } from '@posthog/lemon-ui'--import { IconFeedback } from 'lib/lemon-ui/icons'-import { insightLogic } from 'scenes/insights/insightLogic'--import { funnelDataLogic } from '../funnelDataLogic'--export const FunnelCorrelationSkewWarning = (): JSX.Element | null => {- const { insightProps } = useValues(insightLogic)- const { isSkewed } = useValues(funnelDataLogic(insightProps))- const { hideSkewWarning } = useActions(funnelDataLogic(insightProps))-- if (!isSkewed) {- return null- }-- return (- <div className="skew-warning">- <h4>- <div className="flex items-center deprecated-space-x-1">- <IconFeedback style={{ fontSize: 24, marginRight: 4, color: 'var(--warning)' }} />- <span>Adjust your funnel definition to improve correlation analysis</span>- </div>- <LemonButton icon={<IconX />} onClick={hideSkewWarning} />- </h4>- <div className="px-2">- <b className="font-medium">Tips for adjusting your funnel:</b>- <ol>- <li>- Adjust your first funnel step to be more specific. For example, choose a page or an event that- occurs less frequently.- </li>- <li>Choose an event that happens more frequently for subsequent funnels steps.</li>- </ol>- </div>- </div>- )-}diff --git a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelCorrelationTable.scss b/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelCorrelationTable.scssdeleted file mode 100644index 2a6aa3cbaeba..000000000000--- a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelCorrelationTable.scss+++ /dev/null@@ -1,12 +0,0 @@-.FunnelCorrelationTable {- .table-options {- .LemonCheckbox:not(:last-child) label {- border-right: none;- border-radius: var(--radius) 0 0 var(--radius);- }-- .LemonCheckbox:last-child label {- border-radius: 0 var(--radius) var(--radius) 0;- }- }-}diff --git a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelCorrelationTable.stories.tsx b/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelCorrelationTable.stories.tsxdeleted file mode 100644index 7728c9783e04..000000000000--- a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelCorrelationTable.stories.tsx+++ /dev/null@@ -1,59 +0,0 @@-import type { Meta, StoryObj } from '@storybook/react'-import { BindLogic } from 'kea'-import { useState } from 'react'--import { insightLogic } from 'scenes/insights/insightLogic'--import { mswDecorator } from '~/mocks/browser'-import funnelCorrelation from '~/mocks/fixtures/api/projects/team_id/insights/funnelCorrelation.json'-import __funnelLeftToRight from '~/mocks/fixtures/api/projects/team_id/insights/funnelLeftToRight.json'-import { DataNodeLogicProps, dataNodeLogic } from '~/queries/nodes/DataNode/dataNodeLogic'-import { insightVizDataNodeKey } from '~/queries/nodes/InsightViz/InsightViz'-import { getCachedResults } from '~/queries/nodes/InsightViz/utils'-import { InsightLogicProps } from '~/types'--import { FunnelCorrelationTable } from './FunnelCorrelationTable'--type Story = StoryObj<{}>-const meta: Meta = {- title: 'Insights/FunnelCorrelationTable',- component: FunnelCorrelationTable,- decorators: [- mswDecorator({- post: {- 'api/environments/:team_id/insights/funnel/correlation/': funnelCorrelation,- },- }),- ],- render: () => {- const [dashboardItemId] = useState(() => `FunnelCorrelationTableStory.${uniqueNode++}`)-- // eslint-disable-next-line @typescript-eslint/no-var-requires- const insight = __funnelLeftToRight as any- const cachedInsight = { ...insight, short_id: dashboardItemId }-- const insightProps = { dashboardItemId, doNotLoad: true, cachedInsight } as InsightLogicProps-- const dataNodeLogicProps: DataNodeLogicProps = {- query: insight.query.source,- key: insightVizDataNodeKey(insightProps),- cachedResults: getCachedResults(insightProps.cachedInsight, insight.query.source),- doNotLoad: insightProps.doNotLoad,- }-- return (- <BindLogic logic={insightLogic} props={insightProps}>- <BindLogic logic={dataNodeLogic} props={dataNodeLogicProps}>- <FunnelCorrelationTable />- </BindLogic>- </BindLogic>- )- },-}-export default meta--let uniqueNode = 0--export const Default: Story = {- args: {},-}diff --git a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelCorrelationTable.tsx b/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelCorrelationTable.tsxdeleted file mode 100644index d4fdf22171ee..000000000000--- a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelCorrelationTable.tsx+++ /dev/null@@ -1,333 +0,0 @@-import './FunnelCorrelationTable.scss'--import { useActions, useValues } from 'kea'-import { useEffect } from 'react'--import { IconArchive, IconTrending } from '@posthog/icons'-import { LemonCheckbox, LemonTable } from '@posthog/lemon-ui'--import { PropertyKeyInfo } from 'lib/components/PropertyKeyInfo'-import { VisibilitySensor } from 'lib/components/VisibilitySensor/VisibilitySensor'-import { IconSelectEvents, IconTrendingDown } from 'lib/lemon-ui/icons'-import { LemonButton } from 'lib/lemon-ui/LemonButton'-import { Link } from 'lib/lemon-ui/Link'-import { Spinner } from 'lib/lemon-ui/Spinner/Spinner'-import { capitalizeFirstLetter } from 'lib/utils/strings'-import { insightLogic } from 'scenes/insights/insightLogic'--import { FunnelCorrelation, FunnelCorrelationResultsType, FunnelCorrelationType } from '~/types'--import { funnelDataLogic } from '../funnelDataLogic'-import { funnelPersonsModalLogic } from '../funnelPersonsModalLogic'-import { parseDisplayNameForCorrelation } from '../funnelUtils'-import { ValueInspectorButton } from '../shared/ValueInspectorButton'-import { EventCorrelationActionsCell } from './CorrelationActionsCell'-import { CorrelationMatrix } from './CorrelationMatrix'-import { funnelCorrelationLogic } from './funnelCorrelationLogic'-import { funnelCorrelationUsageLogic } from './funnelCorrelationUsageLogic'--export function FunnelCorrelationTable(): JSX.Element | null {- const { insightProps } = useValues(insightLogic)- const { steps, querySource, aggregationTargetLabel } = useValues(funnelDataLogic(insightProps))- const {- correlationTypes,- correlationsLoading,- correlationValues,- loadedEventCorrelationsTableOnce,- eventHasPropertyCorrelations,- eventWithPropertyCorrelationsLoading,- eventWithPropertyCorrelationsValues,- nestedTableExpandedKeys,- } = useValues(funnelCorrelationLogic(insightProps))- const {- setCorrelationTypes,- loadEventCorrelations,- loadEventWithPropertyCorrelations,- addNestedTableExpandedKey,- removeNestedTableExpandedKey,- } = useActions(funnelCorrelationLogic(insightProps))-- // Load correlations only if this component is mounted, and then reload if the query changes- useEffect(() => {- // We only automatically refresh results when the query changes after the user has manually asked for the first results to be loaded- if (loadedEventCorrelationsTableOnce) {- loadEventCorrelations({})- }- }, [querySource, loadedEventCorrelationsTableOnce, loadEventCorrelations])-- const { openCorrelationPersonsModal } = useActions(funnelPersonsModalLogic(insightProps))- const { correlationPropKey } = useValues(funnelCorrelationUsageLogic(insightProps))- const { reportCorrelationInteraction } = useActions(funnelCorrelationUsageLogic(insightProps))-- const onClickCorrelationType = (correlationType: FunnelCorrelationType): void => {- if (correlationTypes) {- if (correlationTypes.includes(correlationType)) {- setCorrelationTypes(correlationTypes.filter((types) => types !== correlationType))- } else {- setCorrelationTypes([...correlationTypes, correlationType])- }- } else {- setCorrelationTypes([correlationType])- }- }-- const renderOddsRatioTextRecord = (record: FunnelCorrelation): JSX.Element => {- const get_friendly_numeric_value = (value: number): string => {- if (value < 10 && !Number.isInteger(value)) {- return value.toFixed(1)- }-- return value.toFixed()- }- const is_success = record.correlation_type === FunnelCorrelationType.Success-- const { first_value, second_value } = parseDisplayNameForCorrelation(record)-- return (- <>- <div className="font-semibold text-text-3000">- {is_success ? (- <IconTrending className="text-success" />- ) : (- <IconTrendingDown className="text-danger" />- )}{' '}- <PropertyKeyInfo value={first_value} />- {second_value !== undefined && (- <>- {' :: '}- <PropertyKeyInfo value={second_value} disablePopover />- </>- )}- </div>- <div>- {capitalizeFirstLetter(aggregationTargetLabel.plural)}{' '}- {querySource?.aggregation_group_type_index != null ? 'that' : 'who'} converted were{' '}- <mark>- <b>- {get_friendly_numeric_value(record.odds_ratio)}x {is_success ? 'more' : 'less'} likely- </b>- </mark>{' '}- to{' '}- {record.result_type === FunnelCorrelationResultsType.EventWithProperties- ? 'have this event property'- : 'do this event'}- </div>- </>- )- }-- const renderSuccessCount = (record: FunnelCorrelation): JSX.Element => {- return (- <ValueInspectorButton- onClick={() => {- openCorrelationPersonsModal(record, true)- }}- >- {record.success_count}- </ValueInspectorButton>- )- }-- const renderFailureCount = (record: FunnelCorrelation): JSX.Element => {- return (- <ValueInspectorButton- onClick={() => {- openCorrelationPersonsModal(record, false)- }}- >- {record.failure_count}- </ValueInspectorButton>- )- }-- const renderNestedTable = (eventName: string): JSX.Element => {- if (eventWithPropertyCorrelationsLoading) {- return (- <div className="flex flex-col items-center py-2">- <Spinner className="text-2xl mb-2" />- <h3 className="mb-1 font-semibold">Loading correlation results…</h3>- <p className="m-0 text-xs text-secondary">This process can take up to 20 seconds.</p>- </div>- )- }-- return (- <div className="p-4">- <h4 className="pl-4">Correlated properties</h4>- <LemonTable- id={`event-correlation__${eventName}`}- dataSource={eventWithPropertyCorrelationsValues[eventName]}- rowKey={(record: FunnelCorrelation) => 'nested' + record.event.event}- pagination={{- pageSize: 5,- hideOnSinglePage: true,- onBackward: () =>- reportCorrelationInteraction(- FunnelCorrelationResultsType.EventWithProperties,- 'pagination change',- { direction: 'backward', page_size: 5 }- ),- onForward: () =>- reportCorrelationInteraction(- FunnelCorrelationResultsType.EventWithProperties,- 'pagination change',- { direction: 'forward', page_size: 5 }- ),- }}- columns={[- {- title: 'Property',- key: 'eventName',- render: (_, record) => renderOddsRatioTextRecord(record),- },- {- title: 'Completed',- key: 'success_count',- render: (_, record) => renderSuccessCount(record),- width: 90,- align: 'center',- },- {- title: 'Dropped off',- key: 'failure_count',- render: (_, record) => renderFailureCount(record),- width: 120,- align: 'center',- },- {- key: 'actions',- width: 30,- align: 'center',- render: (_, record) => <EventCorrelationActionsCell record={record} />,- },- ]}- />- </div>- )- }-- return steps.length > 1 ? (- <VisibilitySensor id={correlationPropKey} offset={152}>- <div className="FunnelCorrelationTable mt-4 border rounded overflow-hidden">- <span className="flex px-2 py-1 bg-[var(--color-bg-table)]">- <span className="flex items-center text-xs font-bold">- <IconSelectEvents className="mr-1 text-2xl opacity-50" />- CORRELATED EVENTS- </span>- <span className="table-options flex grow items-center justify-end">- <p className="flex items-center m-1 font-sans text-xs text-secondary font-semibold">- CORRELATION- </p>- <div className="flex">- <LemonCheckbox- checked={correlationTypes.includes(FunnelCorrelationType.Success)}- onChange={() => onClickCorrelationType(FunnelCorrelationType.Success)}- label="Success"- size="small"- bordered- />- <LemonCheckbox- checked={correlationTypes.includes(FunnelCorrelationType.Failure)}- onChange={() => onClickCorrelationType(FunnelCorrelationType.Failure)}- label="Drop-off"- size="small"- bordered- />- </div>- </span>- </span>- <CorrelationMatrix />-- <LemonTable- id="event-correlation"- embedded- columns={[- {- title: 'Event',- key: 'eventName',- render: (_, record) => renderOddsRatioTextRecord(record),- },- {- title: 'Completed',- tooltip: `${capitalizeFirstLetter(aggregationTargetLabel.plural)} ${- querySource?.aggregation_group_type_index != null ? 'that' : 'who'- } performed the event and completed the entire funnel.`,- dataIndex: 'success_count',- render: (_, record) => renderSuccessCount(record),- align: 'center',- width: 90,- },- {- title: 'Dropped off',- dataIndex: 'failure_count',- tooltip: `${capitalizeFirstLetter(aggregationTargetLabel.plural)} ${- querySource?.aggregation_group_type_index != null ? 'that' : 'who'- } performed the event and did not complete the entire funnel.`,- render: (_, record) => renderFailureCount(record),- align: 'center',- width: 120,- },- {- key: 'actions',- width: 30,- render: (_, record: FunnelCorrelation) => <EventCorrelationActionsCell record={record} />,- },- ]}- dataSource={correlationValues}- emptyState={- <div className="p-4 m-auto max-w-140">- <div className="flex flex-col items-center justify-self-center text-center">- {loadedEventCorrelationsTableOnce ? (- <div className="flex flex-col items-center justify-center deprecated-space-y-1 min-h-24">- <IconArchive className="text-tertiary-hover text-2xl" />- <div>No correlated events found.</div>- </div>- ) : (- <>- <p className="m-auto">- Highlight events which are likely to have affected the conversion rate- within the funnel.{' '}- <Link to="https://posthog.com/docs/product-analytics/correlation">- Learn more about correlation analysis.- </Link>- </p>- <LemonButton- onClick={() => loadEventCorrelations({})}- type="secondary"- className="mx-auto !mt-2"- >- Load results- </LemonButton>- </>- )}- </div>- </div>- }- loading={correlationsLoading}- size="small"- rowKey={(record) => record.event.event}- pagination={{- pageSize: 5,- hideOnSinglePage: true,- onBackward: () =>- reportCorrelationInteraction(FunnelCorrelationResultsType.Events, 'load more'),- onForward: () => reportCorrelationInteraction(FunnelCorrelationResultsType.Events, 'load more'),- }}- expandable={{- expandedRowRender: (record) => renderNestedTable(record.event.event),- isRowExpanded: (record) => nestedTableExpandedKeys.includes(record.event.event),- rowExpandable: () => querySource?.aggregation_group_type_index == null,- onRowExpand: (record) => {- !eventHasPropertyCorrelations(record.event.event) &&- loadEventWithPropertyCorrelations(record.event.event)- addNestedTableExpandedKey(record.event.event)- },- onRowCollapse: (record) => {- removeNestedTableExpandedKey(record.event.event)- },- }}- />- </div>- </VisibilitySensor>- ) : null-}diff --git a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelPropertyCorrelationTable.stories.tsx b/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelPropertyCorrelationTable.stories.tsxdeleted file mode 100644index 20895aa44023..000000000000--- a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelPropertyCorrelationTable.stories.tsx+++ /dev/null@@ -1,61 +0,0 @@-import type { Meta, StoryObj } from '@storybook/react'-import { BindLogic } from 'kea'-import { useState } from 'react'--import { taxonomicFilterMocksDecorator } from 'lib/components/TaxonomicFilter/__mocks__/taxonomicFilterMocksDecorator'-import { insightLogic } from 'scenes/insights/insightLogic'--import { mswDecorator } from '~/mocks/browser'-import funnelCorrelation from '~/mocks/fixtures/api/projects/team_id/insights/funnelCorrelation.json'-import __funnelLeftToRight from '~/mocks/fixtures/api/projects/team_id/insights/funnelLeftToRight.json'-import { DataNodeLogicProps, dataNodeLogic } from '~/queries/nodes/DataNode/dataNodeLogic'-import { insightVizDataNodeKey } from '~/queries/nodes/InsightViz/InsightViz'-import { getCachedResults } from '~/queries/nodes/InsightViz/utils'-import { InsightLogicProps } from '~/types'--import { FunnelPropertyCorrelationTable } from './FunnelPropertyCorrelationTable'--type Story = StoryObj<{}>-const meta: Meta = {- title: 'Insights/FunnelPropertyCorrelationTable',- component: FunnelPropertyCorrelationTable,- decorators: [- mswDecorator({- post: {- 'api/environments/:team_id/insights/funnel/correlation/': funnelCorrelation,- },- }),- taxonomicFilterMocksDecorator,- ],- render: () => {- const [dashboardItemId] = useState(() => `FunnelPropertyCorrelationTableStory.${uniqueNode++}`)-- // eslint-disable-next-line @typescript-eslint/no-var-requires- const insight = __funnelLeftToRight as any- const cachedInsight = { ...insight, short_id: dashboardItemId }-- const insightProps = { dashboardItemId, doNotLoad: true, cachedInsight } as InsightLogicProps-- const dataNodeLogicProps: DataNodeLogicProps = {- query: insight.query.source,- key: insightVizDataNodeKey(insightProps),- cachedResults: getCachedResults(insightProps.cachedInsight, insight.query.source),- doNotLoad: insightProps.doNotLoad,- }-- return (- <BindLogic logic={insightLogic} props={insightProps}>- <BindLogic logic={dataNodeLogic} props={dataNodeLogicProps}>- <FunnelPropertyCorrelationTable />- </BindLogic>- </BindLogic>- )- },-}-export default meta--let uniqueNode = 0--export const Default: Story = {- args: {},-}diff --git a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelPropertyCorrelationTable.tsx b/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelPropertyCorrelationTable.tsxdeleted file mode 100644index d0418d1aa982..000000000000--- a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/FunnelPropertyCorrelationTable.tsx+++ /dev/null@@ -1,304 +0,0 @@-import './FunnelCorrelationTable.scss'--import { useActions, useValues } from 'kea'-import { useEffect } from 'react'-import { useState } from 'react'--import { IconArchive, IconTrending } from '@posthog/icons'-import { LemonButton, LemonCheckbox, LemonTable } from '@posthog/lemon-ui'--import { PropertyKeyInfo } from 'lib/components/PropertyKeyInfo'-import { PropertySelect } from 'lib/components/PropertySelect/PropertySelect'-import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'-import { VisibilitySensor } from 'lib/components/VisibilitySensor/VisibilitySensor'-import { IconSelectProperties, IconTrendingDown } from 'lib/lemon-ui/icons'-import { Link } from 'lib/lemon-ui/Link'-import { Popover } from 'lib/lemon-ui/Popover'-import { capitalizeFirstLetter } from 'lib/utils/strings'-import { insightLogic } from 'scenes/insights/insightLogic'--import { FunnelCorrelation, FunnelCorrelationResultsType, FunnelCorrelationType } from '~/types'--import { funnelDataLogic } from '../funnelDataLogic'-import { funnelPersonsModalLogic } from '../funnelPersonsModalLogic'-import { parseDisplayNameForCorrelation } from '../funnelUtils'-import { ValueInspectorButton } from '../shared/ValueInspectorButton'-import { PropertyCorrelationActionsCell } from './CorrelationActionsCell'-import { funnelCorrelationUsageLogic } from './funnelCorrelationUsageLogic'-import { funnelPropertyCorrelationLogic } from './funnelPropertyCorrelationLogic'--export function FunnelPropertyCorrelationTable(): JSX.Element | null {- const { insightProps } = useValues(insightLogic)- const { steps, querySource, aggregationTargetLabel } = useValues(funnelDataLogic(insightProps))- const {- propertyCorrelationValues,- propertyCorrelationTypes,- propertyCorrelationsLoading,- propertyNames,- loadedPropertyCorrelationsTableOnce,- } = useValues(funnelPropertyCorrelationLogic(insightProps))- const { setPropertyCorrelationTypes, setPropertyNames, setAllProperties, loadPropertyCorrelations } = useActions(- funnelPropertyCorrelationLogic(insightProps)- )- // Load correlations only if this component is mounted, and then reload if the query change- useEffect(() => {- // We only automatically refresh results when the query changes after the user has manually asked for the first results to be loaded- if (loadedPropertyCorrelationsTableOnce) {- loadPropertyCorrelations({})- }- }, [querySource]) // oxlint-disable-line react-hooks/exhaustive-deps-- const { openCorrelationPersonsModal } = useActions(funnelPersonsModalLogic(insightProps))- const { correlationPropKey } = useValues(funnelCorrelationUsageLogic(insightProps))- const { reportCorrelationInteraction } = useActions(funnelCorrelationUsageLogic(insightProps))- const [isPropertiesOpen, setIsPropertiesOpen] = useState(false as boolean)-- const onClickCorrelationType = (correlationType: FunnelCorrelationType): void => {- if (propertyCorrelationTypes) {- if (propertyCorrelationTypes.includes(correlationType)) {- setPropertyCorrelationTypes(propertyCorrelationTypes.filter((types) => types !== correlationType))- } else {- setPropertyCorrelationTypes([...propertyCorrelationTypes, correlationType])- }- } else {- setPropertyCorrelationTypes([correlationType])- }- }-- const renderSuccessCount = (record: FunnelCorrelation): JSX.Element => {- return (- <ValueInspectorButton- onClick={() => {- openCorrelationPersonsModal(record, true)- }}- >- {record.success_count}- </ValueInspectorButton>- )- }-- const renderFailureCount = (record: FunnelCorrelation): JSX.Element => {- return (- <ValueInspectorButton- onClick={() => {- openCorrelationPersonsModal(record, false)- }}- >- {record.failure_count}- </ValueInspectorButton>- )- }-- const renderOddsRatioTextRecord = (record: FunnelCorrelation): JSX.Element => {- const get_friendly_numeric_value = (value: number): string => {- if (value < 10 && !Number.isInteger(value)) {- return value.toFixed(1)- }-- return value.toFixed()- }-- const is_success = record.correlation_type === FunnelCorrelationType.Success-- const { first_value, second_value } = parseDisplayNameForCorrelation(record)-- return (- <>- <div className="font-semibold text-text-3000">- {is_success ? (- <IconTrending style={{ color: 'green' }} />- ) : (- <IconTrendingDown style={{ color: 'red' }} />- )}{' '}- <PropertyKeyInfo value={first_value} />- {second_value !== undefined && (- <>- {' :: '}- <PropertyKeyInfo value={second_value} disablePopover />- </>- )}- </div>- <div>- {capitalizeFirstLetter(aggregationTargetLabel.plural)}{' '}- {querySource?.aggregation_group_type_index != null ? 'that' : 'who'} converted were{' '}- <mark>- <b>- {get_friendly_numeric_value(record.odds_ratio)}x {is_success ? 'more' : 'less'} likely- </b>- </mark>{' '}- to have this property value- </div>- </>- )- }-- return steps.length > 1 ? (- <VisibilitySensor offset={150} id={`${correlationPropKey}-properties`}>- <div className="FunnelCorrelationTable mt-4 border rounded overflow-hidden">- <div className="flex px-2 py-1 bg-[var(--color-bg-table)]">- <div className="flex items-center text-xs font-bold">- <IconSelectProperties style={{ marginRight: 4, opacity: 0.5, fontSize: 24 }} />- CORRELATED PROPERTIES- </div>- <div className="table-options flex grow items-center justify-end flex-wrap">- <div className="flex">- <p className="flex items-center m-1 font-sans text-xs text-secondary font-semibold">- PROPERTIES- </p>- <Popover- visible={isPropertiesOpen}- onClickOutside={() => setIsPropertiesOpen(false)}- overlay={- <div className="p-4">- <PropertySelect- taxonomicFilterGroup={TaxonomicFilterGroupType.PersonProperties}- onChange={setPropertyNames}- selectedProperties={- propertyNames.length === 1 && propertyNames[0] === '$all'- ? []- : propertyNames- }- addText="Add properties"- />- <br />- {propertyNames.length === 1 && propertyNames[0] === '$all' ? (- <>All properties selected</>- ) : (- <LemonButton- size="small"- type="primary"- onClick={() => {- setAllProperties()- setIsPropertiesOpen(false)- }}- >- Select all properties- </LemonButton>- )}- </div>- }- >- <LemonButton size="small" onClick={() => setIsPropertiesOpen(true)}>- {propertyNames.length === 1 && propertyNames[0] === '$all' ? (- <>All properties selected</>- ) : (- <>- {propertyNames.length} propert{propertyNames.length === 1 ? 'y' : 'ies'}{' '}- selected- </>- )}- </LemonButton>- </Popover>- </div>- <div className="flex">- <p className="flex items-center m-1 font-sans text-xs text-secondary font-semibold ml-2">- CORRELATION- </p>- <div className="flex">- <LemonCheckbox- checked={propertyCorrelationTypes.includes(FunnelCorrelationType.Success)}- onChange={() => onClickCorrelationType(FunnelCorrelationType.Success)}- label="Success"- size="small"- bordered- />- <LemonCheckbox- checked={propertyCorrelationTypes.includes(FunnelCorrelationType.Failure)}- onChange={() => onClickCorrelationType(FunnelCorrelationType.Failure)}- label="Drop-off"- size="small"- bordered- />- </div>- </div>- </div>- </div>-- <LemonTable- id="property-correlation"- embedded- columns={[- {- title: `${capitalizeFirstLetter(aggregationTargetLabel.singular)} property`,- key: 'propertName',- render: (_, record) => renderOddsRatioTextRecord(record),- },- {- title: 'Completed',- tooltip: `${capitalizeFirstLetter(aggregationTargetLabel.plural)} ${- querySource?.aggregation_group_type_index != null ? 'that' : 'who'- } have this property and completed the entire funnel.`,- key: 'success_count',- render: (_, record) => renderSuccessCount(record),- width: 90,- align: 'center',- },- {- title: 'Dropped off',- tooltip: `${capitalizeFirstLetter(aggregationTargetLabel.plural)} ${- querySource?.aggregation_group_type_index != null ? 'that' : 'who'- } have this property and did not complete the entire funnel.`,- key: 'failure_count',- render: (_, record) => renderFailureCount(record),- width: 120,- align: 'center',- },- {- key: 'actions',- width: 30,- align: 'center',- render: (_, record) => <PropertyCorrelationActionsCell record={record} />,- },- ]}- dataSource={propertyCorrelationValues}- loading={propertyCorrelationsLoading}- rowKey={(record) => record.event.event}- size="small"- emptyState={- <div className="p-4 m-auto max-w-140">- <div className="flex flex-col items-center justify-self-center text-center">- {loadedPropertyCorrelationsTableOnce ? (- <div className="flex flex-col items-center justify-center deprecated-space-y-1 min-h-24">- <IconArchive className="text-tertiary-hover text-2xl" />- <div>No correlated properties found.</div>- </div>- ) : (- <>- <p className="m-auto">- Highlight properties which are likely to have affected the conversion rate- within the funnel.{' '}- <Link to="https://posthog.com/docs/product-analytics/correlation">- Learn more about correlation analysis.- </Link>- </p>- <LemonButton- type="secondary"- onClick={() => setIsPropertiesOpen(true)}- className="mx-auto !mt-2"- >- Select properties- </LemonButton>- </>- )}- </div>- </div>- }- pagination={{- pageSize: 5,- hideOnSinglePage: true,- onBackward: () =>- reportCorrelationInteraction(FunnelCorrelationResultsType.Properties, 'pagination change', {- direction: 'backward',- page_size: 5,- }),- onForward: () =>- reportCorrelationInteraction(FunnelCorrelationResultsType.Properties, 'pagination change', {- direction: 'forward',- page_size: 5,- }),- }}- />- </div>- </VisibilitySensor>- ) : null-}diff --git a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/funnelCorrelationDetailsLogic.test.ts b/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/funnelCorrelationDetailsLogic.test.tsdeleted file mode 100644index 013d6e3dbd10..000000000000--- a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/funnelCorrelationDetailsLogic.test.ts+++ /dev/null@@ -1,104 +0,0 @@-import { expectLogic } from 'kea-test-utils'--import { dataNodeLogic } from '~/queries/nodes/DataNode/dataNodeLogic'-import { insightVizDataNodeKey } from '~/queries/nodes/InsightViz/insightVizKeys'-import { DataNode, InsightVizNode, NodeKind } from '~/queries/schema/schema-general'-import { initKeaTests } from '~/test/init'-import { FunnelCorrelationResultsType, FunnelCorrelationType, InsightLogicProps, InsightType } from '~/types'--import { funnelCorrelationDetailsLogic } from './funnelCorrelationDetailsLogic'--const funnelResults = [- {- action_id: '$pageview',- count: 19,- name: '$pageview',- order: 0,- type: 'events',- },- {- action_id: '$pageview',- count: 7,- name: '$pageview',- order: 1,- type: 'events',- },- {- action_id: '$pageview',- count: 4,- name: '$pageview',- order: 2,- type: 'events',- },-]--describe('funnelCorrelationDetailsLogic', () => {- let logic: ReturnType<typeof funnelCorrelationDetailsLogic.build>-- beforeEach(() => {- initKeaTests(false)- })-- const defaultProps: InsightLogicProps = {- dashboardItemId: undefined,- cachedInsight: {- short_id: undefined,- query: {- kind: NodeKind.InsightVizNode,- source: {- kind: NodeKind.FunnelsQuery,- series: [- { kind: NodeKind.ActionsNode, id: 1 },- { kind: NodeKind.ActionsNode, id: 1 },- ],- },- } as InsightVizNode,- result: funnelResults,- },- }-- beforeEach(async () => {- const builtDataNodeLogic = dataNodeLogic({- key: insightVizDataNodeKey(defaultProps),- query: {} as DataNode,- cachedResults: {- result: funnelResults,- filters: {- insight: InsightType.FUNNELS,- },- },- })- builtDataNodeLogic.mount()-- logic = funnelCorrelationDetailsLogic(defaultProps)- logic.mount()- })-- describe('correlationMatrixAndScore', () => {- it('returns calculated values based on selected details', async () => {- await expectLogic(logic, () =>- logic.actions.openCorrelationDetailsModal({- event: { event: 'some event', elements: [], properties: {} },- success_people_url: '',- failure_people_url: '',- success_count: 2,- failure_count: 4,- odds_ratio: 3,- correlation_type: FunnelCorrelationType.Success,- result_type: FunnelCorrelationResultsType.Events,- })- ).toMatchValues({- correlationMatrixAndScore: {- correlationScore: expect.anything(),- correlationScoreStrength: 'weak',- truePositive: 2,- falsePositive: 2,- trueNegative: 11,- falseNegative: 4,- },- })-- expect(logic.values.correlationMatrixAndScore.correlationScore).toBeCloseTo(0.204)- })- })-})diff --git a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/funnelCorrelationDetailsLogic.ts b/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/funnelCorrelationDetailsLogic.tsdeleted file mode 100644index fbbf5616a371..000000000000--- a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/funnelCorrelationDetailsLogic.ts+++ /dev/null@@ -1,148 +0,0 @@-import { MakeLogicType, actions, connect, kea, key, path, props, reducers, selectors } from 'kea'--import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'--import { FunnelCorrelation, InsightLogicProps } from '~/types'-import type { FunnelStepWithNestedBreakdown } from '~/types'--import { funnelDataLogic } from '../funnelDataLogic'--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface funnelCorrelationDetailsLogicValues {- steps: FunnelStepWithNestedBreakdown[] // funnelDataLogic- correlationDetails: FunnelCorrelation | null- correlationDetailsModalOpen: boolean- correlationMatrixAndScore: {- correlationScore: number- correlationScoreStrength: 'moderate' | 'strong' | 'weak' | null- falseNegative: number- falsePositive: number- trueNegative: number- truePositive: number- }-}--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface funnelCorrelationDetailsLogicActions {- closeCorrelationDetailsModal: () => {- value: true- }- openCorrelationDetailsModal: (payload: FunnelCorrelation) => {- payload: FunnelCorrelation- }-}--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface funnelCorrelationDetailsLogicMeta {- key: string- __keaTypeGenInternalSelectorTypes: {- correlationMatrixAndScore: (- correlationDetails: FunnelCorrelation | null,- steps: FunnelStepWithNestedBreakdown[]- ) => {- correlationScore: number- correlationScoreStrength: 'moderate' | 'strong' | 'weak' | null- falseNegative: number- falsePositive: number- trueNegative: number- truePositive: number- }- }-}--export type funnelCorrelationDetailsLogicType = MakeLogicType<- funnelCorrelationDetailsLogicValues,- funnelCorrelationDetailsLogicActions,- InsightLogicProps,- funnelCorrelationDetailsLogicMeta->--export const funnelCorrelationDetailsLogic = kea<funnelCorrelationDetailsLogicType>([- props({} as InsightLogicProps),- key(keyForInsightLogicProps('insight_funnel')),- path((key) => ['scenes', 'funnels', 'funnelCorrelationDetailsLogic', key]),- connect((props: InsightLogicProps) => ({- values: [funnelDataLogic(props), ['steps']],- })),-- actions({- openCorrelationDetailsModal: (payload: FunnelCorrelation) => ({ payload }),- closeCorrelationDetailsModal: true,- }),-- reducers({- correlationDetailsModalOpen: [- false,- {- openCorrelationDetailsModal: () => true,- closeCorrelationDetailsModal: () => false,- },- ],- correlationDetails: [- null as null | FunnelCorrelation,- {- openCorrelationDetailsModal: (_, { payload }) => payload,- },- ],- }),-- selectors({- correlationMatrixAndScore: [- (s) => [s.correlationDetails, s.steps],- (- correlationDetails: FunnelCorrelation | null,- steps: import('~/types').FunnelStepWithNestedBreakdown[]- ): {- truePositive: number- falsePositive: number- trueNegative: number- falseNegative: number- correlationScore: number- correlationScoreStrength: 'weak' | 'moderate' | 'strong' | null- } => {- if (!correlationDetails || steps.length === 0) {- return {- truePositive: 0,- falsePositive: 0,- trueNegative: 0,- falseNegative: 0,- correlationScore: 0,- correlationScoreStrength: null,- }- }-- const successTotal = steps[steps.length - 1].count- const failureTotal = steps[0].count - successTotal- const success = correlationDetails.success_count- const failure = correlationDetails.failure_count-- const truePositive = success // has property, converted- const falseNegative = failure // has property, but dropped off- const trueNegative = failureTotal - failure // doesn't have property, dropped off- const falsePositive = successTotal - success // doesn't have property, converted-- // Phi coefficient: https://en.wikipedia.org/wiki/Phi_coefficient- const correlationScore =- (truePositive * trueNegative - falsePositive * falseNegative) /- Math.sqrt(- (truePositive + falsePositive) *- (truePositive + falseNegative) *- (trueNegative + falsePositive) *- (trueNegative + falseNegative)- )-- const correlationScoreStrength =- Math.abs(correlationScore) > 0.5 ? 'strong' : Math.abs(correlationScore) > 0.3 ? 'moderate' : 'weak'-- return {- correlationScore,- truePositive,- falsePositive,- trueNegative,- falseNegative,- correlationScoreStrength,- }- },- ],- }),-])diff --git a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/funnelCorrelationLogic.ts b/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/funnelCorrelationLogic.tsdeleted file mode 100644index bb25523a4bfd..000000000000--- a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/funnelCorrelationLogic.ts+++ /dev/null@@ -1,371 +0,0 @@-import { MakeLogicType, actions, connect, defaults, kea, key, listeners, path, props, reducers, selectors } from 'kea'-import { loaders } from 'kea-loaders'--import { lemonToast } from '@posthog/lemon-ui'--import api, { ApiError } from 'lib/api'-import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'-import { teamLogic } from 'scenes/teamLogic'--import {- FunnelCorrelationQuery,- FunnelCorrelationResultsType,- FunnelsActorsQuery,- NodeKind,-} from '~/queries/schema/schema-general'-import type { FunnelsQuery } from '~/queries/schema/schema-general'-import { setLatestVersionsOnQuery } from '~/queries/utils'-import { FunnelCorrelation, FunnelCorrelationType, InsightLogicProps } from '~/types'-import type { TeamPublicType, TeamType } from '~/types'--import { funnelDataLogic } from '../funnelDataLogic'-import { appendToCorrelationConfig } from '../funnelUtils'--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface funnelCorrelationLogicValues {- querySource: FunnelsQuery | null // funnelDataLogic- currentTeam: TeamPublicType | TeamType | null // teamLogic- __ignore: FunnelCorrelationResultsType | null- correlationTypes: FunnelCorrelationType[]- correlationValues: FunnelCorrelation[]- correlations: Record<'events', FunnelCorrelation[]>- correlationsLoading: boolean- eventHasPropertyCorrelations: (eventName: string) => boolean- eventWithPropertyCorrelations: Record<string, FunnelCorrelation[]>- eventWithPropertyCorrelationsLoading: boolean- eventWithPropertyCorrelationsValues: Record<string, FunnelCorrelation[]>- excludedEventNames: string[]- excludedEventPropertyNames: string[]- isEventExcluded: (eventName: string) => boolean- isEventPropertyExcluded: (propertyName: string) => boolean- loadedEventCorrelationsTableOnce: boolean- nestedTableExpandedKeys: string[]-}--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface funnelCorrelationLogicActions {- addNestedTableExpandedKey: (expandKey: string) => {- expandKey: string- }- excludeEventFromProject: (eventName: string) => {- eventName: string- }- excludeEventPropertyFromProject: (- eventName: string,- propertyName: string- ) => {- eventName: string- propertyName: string- }- loadEventCorrelations: (_: any) => any- loadEventCorrelationsFailure: (- error: string,- errorObject?: any- ) => {- error: string- errorObject?: any- }- loadEventCorrelationsSuccess: (- correlations: {- events: FunnelCorrelation[]- },- payload?: any- ) => {- correlations: {- events: FunnelCorrelation[]- }- payload?: any- }- loadEventWithPropertyCorrelations: (eventName: string) => string- loadEventWithPropertyCorrelationsFailure: (- error: string,- errorObject?: any- ) => {- error: string- errorObject?: any- }- loadEventWithPropertyCorrelationsSuccess: (- eventWithPropertyCorrelations: {- [x: string]: FunnelCorrelation[]- },- payload?: string- ) => {- eventWithPropertyCorrelations: {- [x: string]: FunnelCorrelation[]- }- payload?: string- }- removeNestedTableExpandedKey: (expandKey: string) => {- expandKey: string- }- setCorrelationTypes: (types: FunnelCorrelationType[]) => {- types: FunnelCorrelationType[]- }-}--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface funnelCorrelationLogicMeta {- key: string- __keaTypeGenInternalSelectorTypes: {- correlationValues: (- correlations: Record<'events', FunnelCorrelation[]>,- correlationTypes: FunnelCorrelationType[],- excludedEventNames: string[]- ) => FunnelCorrelation[]- excludedEventNames: (currentTeam: TeamPublicType | TeamType | null) => string[]- isEventExcluded: (excludedEventNames: string[]) => (eventName: string) => boolean- excludedEventPropertyNames: (currentTeam: TeamPublicType | TeamType | null) => string[]- isEventPropertyExcluded: (excludedEventPropertyNames: string[]) => (propertyName: string) => boolean- eventWithPropertyCorrelationsValues: (- eventWithPropertyCorrelations: Record<string, FunnelCorrelation[]>,- correlationTypes: FunnelCorrelationType[],- excludedEventPropertyNames: string[]- ) => Record<string, FunnelCorrelation[]>- eventHasPropertyCorrelations: (- eventWithPropertyCorrelationsValues: Record<string, FunnelCorrelation[]>- ) => (eventName: string) => boolean- }-}--export type funnelCorrelationLogicType = MakeLogicType<- funnelCorrelationLogicValues,- funnelCorrelationLogicActions,- InsightLogicProps,- funnelCorrelationLogicMeta->--export const funnelCorrelationLogic = kea<funnelCorrelationLogicType>([- props({} as InsightLogicProps),- key(keyForInsightLogicProps('insight_funnel')),- path((key) => ['scenes', 'funnels', 'funnelCorrelationLogic', key]),- connect((props: InsightLogicProps) => ({- values: [funnelDataLogic(props), ['querySource'], teamLogic, ['currentTeam']],- })),- actions({- setCorrelationTypes: (types: FunnelCorrelationType[]) => ({ types }),- excludeEventFromProject: (eventName: string) => ({ eventName }),-- excludeEventPropertyFromProject: (eventName: string, propertyName: string) => ({ eventName, propertyName }),- addNestedTableExpandedKey: (expandKey: string) => ({ expandKey }),- removeNestedTableExpandedKey: (expandKey: string) => ({ expandKey }),- }),- defaults({- // This is a hack to get `FunnelCorrelationResultsType` imported in `funnelCorrelationLogicType.ts`- __ignore: null as FunnelCorrelationResultsType | null,- }),- loaders(({ values }) => ({- correlations: [- { events: [] } as Record<'events', FunnelCorrelation[]>,- {- loadEventCorrelations: async (_, breakpoint) => {- await breakpoint(100)-- try {- const actorsQuery: FunnelsActorsQuery = setLatestVersionsOnQuery(- {- kind: NodeKind.FunnelsActorsQuery,- source: values.querySource!,- },- { recursion: false }- )- const query: FunnelCorrelationQuery = setLatestVersionsOnQuery(- {- kind: NodeKind.FunnelCorrelationQuery,- source: actorsQuery,- funnelCorrelationType: FunnelCorrelationResultsType.Events,- funnelCorrelationExcludeEventNames: values.excludedEventNames,- },- { recursion: false }- )- const response = await api.query(query)- return {- events: response.results.events.map((result) => ({- ...result,- result_type: FunnelCorrelationResultsType.Events,- })) as FunnelCorrelation[],- }- } catch (error) {- const detail = error instanceof ApiError ? error.detail : null- lemonToast.error(detail || 'Failed to load correlation results', {- toastId: 'funnel-correlation-error',- })- return { events: [] }- }- },- },- ],- eventWithPropertyCorrelations: [- {} as Record<string, FunnelCorrelation[]>,- {- loadEventWithPropertyCorrelations: async (eventName: string) => {- const actorsQuery: FunnelsActorsQuery = setLatestVersionsOnQuery(- {- kind: NodeKind.FunnelsActorsQuery,- source: values.querySource!,- },- { recursion: false }- )- const query: FunnelCorrelationQuery = setLatestVersionsOnQuery(- {- kind: NodeKind.FunnelCorrelationQuery,- source: actorsQuery,- funnelCorrelationType: FunnelCorrelationResultsType.EventWithProperties,- funnelCorrelationEventNames: [eventName],- funnelCorrelationEventExcludePropertyNames: values.excludedEventPropertyNames,- },- { recursion: false }- )- const response = await api.query(query)- return {- [eventName]: response.results.events.map((result) => ({- ...result,- result_type: FunnelCorrelationResultsType.EventWithProperties,- })) as FunnelCorrelation[],- }- },- },- ],- })),- reducers({- correlationTypes: [- [FunnelCorrelationType.Success, FunnelCorrelationType.Failure] as FunnelCorrelationType[],- {- setCorrelationTypes: (_, { types }) => types,- },- ],- loadedEventCorrelationsTableOnce: [- false,- {- loadEventCorrelations: () => true,- },- ],- nestedTableExpandedKeys: [- [] as string[],- {- removeNestedTableExpandedKey: (state, { expandKey }) => {- return state.filter((key) => key !== expandKey)- },- addNestedTableExpandedKey: (state, { expandKey }) => {- return [...state, expandKey]- },- loadEventCorrelationsSuccess: () => {- return []- },- },- ],- eventWithPropertyCorrelations: {- loadEventCorrelationsSuccess: () => {- return {}- },- loadEventWithPropertyCorrelationsSuccess: (state, { eventWithPropertyCorrelations }) => {- return {- ...state,- ...eventWithPropertyCorrelations,- }- },- },- }),- selectors({- // event correlation- correlationValues: [- (s) => [s.correlations, s.correlationTypes, s.excludedEventNames],- (- correlations: Record<'events', FunnelCorrelation[]>,- correlationTypes: FunnelCorrelationType[],- excludedEventNames: string[]- ): FunnelCorrelation[] => {- return correlations.events- ?.filter(- (correlation) =>- correlationTypes.includes(correlation.correlation_type) &&- !excludedEventNames.includes(correlation.event.event)- )- .map((value) => {- return {- ...value,- odds_ratio:- value.correlation_type === FunnelCorrelationType.Success- ? value.odds_ratio- : 1 / value.odds_ratio,- }- })- .sort((first, second) => {- return second.odds_ratio - first.odds_ratio- })- },- ],- excludedEventNames: [- (s) => [s.currentTeam],- (currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType): string[] =>- currentTeam?.correlation_config?.excluded_event_names || [],- ],- isEventExcluded: [- (s) => [s.excludedEventNames],- (excludedEventNames: string[]) => (eventName: string) =>- excludedEventNames.find((name) => name === eventName) !== undefined,- ],-- // event property correlation- excludedEventPropertyNames: [- (s) => [s.currentTeam],- (currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType): string[] =>- currentTeam?.correlation_config?.excluded_event_property_names || [],- ],- isEventPropertyExcluded: [- (s) => [s.excludedEventPropertyNames],- (excludedEventPropertyNames: string[]) => (propertyName: string) =>- excludedEventPropertyNames.find((name) => name === propertyName) !== undefined,- ],- eventWithPropertyCorrelationsValues: [- (s) => [s.eventWithPropertyCorrelations, s.correlationTypes, s.excludedEventPropertyNames],- (- eventWithPropertyCorrelations: Record<string, FunnelCorrelation[]>,- correlationTypes: FunnelCorrelationType[],- excludedEventPropertyNames: string[]- ): Record<string, FunnelCorrelation[]> => {- const eventWithPropertyCorrelationsValues: Record<string, FunnelCorrelation[]> = {}- for (const key in eventWithPropertyCorrelations) {- if (eventWithPropertyCorrelations.hasOwnProperty(key)) {- eventWithPropertyCorrelationsValues[key] = eventWithPropertyCorrelations[key]- ?.filter(- (correlation) =>- correlationTypes.includes(correlation.correlation_type) &&- !excludedEventPropertyNames.includes(correlation.event.event.split('::')[1])- )- .map((value) => {- return {- ...value,- odds_ratio:- value.correlation_type === FunnelCorrelationType.Success- ? value.odds_ratio- : 1 / value.odds_ratio,- }- })- .sort((first, second) => {- return second.odds_ratio - first.odds_ratio- })- }- }- return eventWithPropertyCorrelationsValues- },- ],- eventHasPropertyCorrelations: [- (s) => [s.eventWithPropertyCorrelationsValues],- (- eventWithPropertyCorrelationsValues: Record<string, FunnelCorrelation[]>- ): ((eventName: string) => boolean) => {- return (eventName) => {- return !!eventWithPropertyCorrelationsValues[eventName]- }- },- ],- }),- listeners(({ values }) => ({- excludeEventFromProject: async ({ eventName }) => {- appendToCorrelationConfig('excluded_event_names', values.excludedEventNames, eventName)- },- excludeEventPropertyFromProject: async ({ propertyName }) => {- appendToCorrelationConfig('excluded_event_property_names', values.excludedEventPropertyNames, propertyName)- },- })),-])diff --git a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/funnelCorrelationUsageLogic.ts b/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/funnelCorrelationUsageLogic.tsdeleted file mode 100644index 8e062e0c660c..000000000000--- a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/funnelCorrelationUsageLogic.ts+++ /dev/null@@ -1,361 +0,0 @@-import { MakeLogicType, BreakPointFunction, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'--import { visibilitySensorLogic } from 'lib/components/VisibilitySensor/visibilitySensorLogic'-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'-import { insightLogic } from 'scenes/insights/insightLogic'-import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'-import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'--import type {- DataNode,- ErrorTrackingQueryResponse,- FunnelsQuery,- HogQLAutocompleteResponse,- HogQLMetadataResponse,- HogQLQueryResponse,- HogQueryResponse,- LifecycleQuery,- LogAttributesQueryResponse,- LogValuesQueryResponse,- MetricsQueryResponse,- Node,- PathsQuery,- RefreshType,- RetentionQuery,- SessionsQueryResponse,- StickinessQuery,- TraceSpansAggregationQueryResponse,- TraceSpansAttributeBreakdownQueryResponse,- TraceSpansQueryResponse,- TrendsQuery,- WebOverviewQuery,- WebStatsTableQuery,-} from '~/queries/schema/schema-general'-import type { PathsV2Query } from '~/queries/schema/schema-general'-import { EntityTypes, FunnelCorrelationResultsType, InsightLogicProps } from '~/types'-import type { FunnelCorrelation, FunnelCorrelationType } from '~/types'--import { funnelDataLogic } from '../funnelDataLogic'-import { funnelPersonsModalLogic } from '../funnelPersonsModalLogic'-import { parseEventAndProperty } from '../funnelUtils'-import { funnelCorrelationLogic } from './funnelCorrelationLogic'-import { funnelPropertyCorrelationLogic } from './funnelPropertyCorrelationLogic'--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface funnelCorrelationUsageLogicValues {- isInDashboardContext: boolean // insightLogic- querySource:- | FunnelsQuery- | LifecycleQuery- | PathsQuery- | PathsV2Query- | RetentionQuery- | StickinessQuery- | TrendsQuery- | WebOverviewQuery- | WebStatsTableQuery- | null // insightVizDataLogic- correlationPropKey: string- shouldReportCorrelationViewed: boolean- shouldReportPropertyCorrelationViewed: boolean-}--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface funnelCorrelationUsageLogicActions {- reportCorrelationInteraction: (- correlationType: FunnelCorrelationResultsType,- action: string,- props?: Record<string, any> | undefined- ) => {- action: string- correlationType: FunnelCorrelationResultsType- props: Record<string, any> | undefined- } // eventUsageLogic- reportCorrelationViewed: (- query: Node<Record<string, any>> | null,- delay?: number | undefined,- propertiesTable?: boolean | undefined- ) => {- delay: number | undefined- propertiesTable: boolean | undefined- query: Node<Record<string, any>> | null- } // eventUsageLogic- excludeEventFromProject: (eventName: string) => {- eventName: string- } // funnelCorrelationLogic- excludeEventPropertyFromProject: (- eventName: string,- propertyName: string- ) => {- eventName: string- propertyName: string- } // funnelCorrelationLogic- loadEventWithPropertyCorrelations: (eventName: string) => string // funnelCorrelationLogic- setCorrelationTypes: (types: FunnelCorrelationType[]) => {- types: FunnelCorrelationType[]- } // funnelCorrelationLogic- hideSkewWarning: () => {- value: true- } // funnelDataLogic- openCorrelationPersonsModal: (- correlation: FunnelCorrelation,- success: boolean- ) => {- correlation: FunnelCorrelation- success: boolean- } // funnelPersonsModalLogic- excludePropertyFromProject: (propertyName: string) => {- propertyName: string- } // funnelPropertyCorrelationLogic- setPropertyCorrelationTypes: (types: FunnelCorrelationType[]) => {- types: FunnelCorrelationType[]- } // funnelPropertyCorrelationLogic- setPropertyNames: (propertyNames: string[]) => {- propertyNames: string[]- } // funnelPropertyCorrelationLogic- loadDataSuccess: (- response:- | ErrorTrackingQueryResponse- | HogQLAutocompleteResponse- | HogQLMetadataResponse- | HogQLQueryResponse<any[]>- | HogQueryResponse- | LogAttributesQueryResponse- | LogValuesQueryResponse- | MetricsQueryResponse- | Record<string, any>- | SessionsQueryResponse- | TraceSpansAggregationQueryResponse- | TraceSpansAttributeBreakdownQueryResponse- | TraceSpansQueryResponse- | null- | import('~/queries/schema').TraceSpansTreeQueryResponse,- payload?:- | {- overrideQuery: DataNode<Record<string, any>> | undefined- pollOnly: boolean- queryId: string- refresh: RefreshType | undefined- }- | undefined- ) => {- payload?: {- overrideQuery: DataNode<Record<string, any>> | undefined- pollOnly: boolean- queryId: string- refresh: RefreshType | undefined- }- response:- | ErrorTrackingQueryResponse- | HogQLAutocompleteResponse- | HogQLMetadataResponse- | HogQLQueryResponse<any[]>- | HogQueryResponse- | LogAttributesQueryResponse- | LogValuesQueryResponse- | MetricsQueryResponse- | Record<string, any>- | SessionsQueryResponse- | TraceSpansAggregationQueryResponse- | TraceSpansAttributeBreakdownQueryResponse- | TraceSpansQueryResponse- | null- | import('~/queries/schema').TraceSpansTreeQueryResponse- } // insightVizDataLogic-}--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface funnelCorrelationUsageLogicMeta {- key: string- __keaTypeGenInternalSelectorTypes: {- correlationPropKey: (arg: any) => string- }-}--export type funnelCorrelationUsageLogicType = MakeLogicType<- funnelCorrelationUsageLogicValues,- funnelCorrelationUsageLogicActions,- InsightLogicProps,- funnelCorrelationUsageLogicMeta->--export const funnelCorrelationUsageLogic = kea<funnelCorrelationUsageLogicType>([- props({} as InsightLogicProps),- key(keyForInsightLogicProps('insight_funnel')),- path((key) => ['scenes', 'funnels', 'funnelCorrelationUsageLogic', key]),-- connect((props: InsightLogicProps) => ({- logic: [eventUsageLogic],-- values: [insightLogic(props), ['isInDashboardContext'], insightVizDataLogic(props), ['querySource']],-- actions: [- insightVizDataLogic(props),- ['loadDataSuccess'],- funnelPersonsModalLogic(props),- ['openCorrelationPersonsModal'],- funnelDataLogic(props),- ['hideSkewWarning'],- funnelCorrelationLogic(props),- [- 'setCorrelationTypes',- 'excludeEventFromProject',- 'loadEventWithPropertyCorrelations',- 'excludeEventPropertyFromProject',- ],- funnelPropertyCorrelationLogic(props),- ['setPropertyCorrelationTypes', 'excludePropertyFromProject', 'setPropertyNames'],- eventUsageLogic,- ['reportCorrelationViewed', 'reportCorrelationInteraction'],- ],- })),-- reducers({- shouldReportCorrelationViewed: [- true as boolean,- {- loadDataSuccess: () => true,- reportCorrelationViewed: (current, { propertiesTable }) => {- const correlationViewed = !propertiesTable- return correlationViewed ? false : current- },- },- ],- shouldReportPropertyCorrelationViewed: [- true as boolean,- {- loadDataSuccess: () => true,- reportCorrelationViewed: (current, { propertiesTable }) => {- const propertyCorrelationViewed = !!propertiesTable- return propertyCorrelationViewed ? false : current- },- },- ],- }),-- selectors({- correlationPropKey: [- () => [(_, props) => props],- (props): string => `correlation-${keyForInsightLogicProps('insight_funnel')(props)}`,- ],- }),-- listeners(({ values, actions }) => {- // Kea's action type strings can vary by keyed logic instance at runtime,- // but the generated types don't encode that, so we widen these keys to avoid TS1117.- const correlationVisibleActionType = visibilitySensorLogic({ id: values.correlationPropKey }).actionTypes- .setVisible as string- const propertyCorrelationVisibleActionType = visibilitySensorLogic({- id: `${values.correlationPropKey}-properties`,- }).actionTypes.setVisible as string-- return {- hideSkewWarning: () => {- actions.reportCorrelationInteraction(FunnelCorrelationResultsType.Events, 'hide skew warning')- },-- // event correlation- [correlationVisibleActionType]: async (- { visible }: { visible: boolean },- breakpoint: BreakPointFunction- ) => {- if (visible && values.shouldReportCorrelationViewed) {- actions.reportCorrelationViewed(values.querySource, 0)- await breakpoint(10000)- actions.reportCorrelationViewed(values.querySource, 10)- }- },- setCorrelationTypes: ({ types }) => {- eventUsageLogic.actions.reportCorrelationInteraction(- FunnelCorrelationResultsType.Events,- 'set correlation types',- { types }- )- },- excludeEventFromProject: async ({ eventName }) => {- eventUsageLogic.actions.reportCorrelationInteraction(- FunnelCorrelationResultsType.Events,- 'exclude event',- {- event_name: eventName,- }- )- },-- // property correlation- [propertyCorrelationVisibleActionType]: async (- { visible }: { visible: boolean },- breakpoint: BreakPointFunction- ) => {- if (visible && values.shouldReportPropertyCorrelationViewed) {- actions.reportCorrelationViewed(values.querySource, 0, true)- await breakpoint(10000)- actions.reportCorrelationViewed(values.querySource, 10, true)- }- },- setPropertyCorrelationTypes: ({ types }) => {- eventUsageLogic.actions.reportCorrelationInteraction(- FunnelCorrelationResultsType.Properties,- 'set property correlation types',- { types }- )- },- excludePropertyFromProject: ({ propertyName }) => {- eventUsageLogic.actions.reportCorrelationInteraction(- FunnelCorrelationResultsType.Events,- 'exclude person property',- {- person_property: propertyName,- }- )- },-- // event property correlation- setPropertyNames: async ({ propertyNames }) => {- eventUsageLogic.actions.reportCorrelationInteraction(- FunnelCorrelationResultsType.Properties,- 'set property names',- { property_names: propertyNames }- )- },- loadEventWithPropertyCorrelations: async (eventName: string) => {- eventUsageLogic.actions.reportCorrelationInteraction(- FunnelCorrelationResultsType.EventWithProperties,- 'load event with properties',- { name: eventName }- )- },- excludeEventPropertyFromProject: async ({ propertyName }) => {- eventUsageLogic.actions.reportCorrelationInteraction(- FunnelCorrelationResultsType.EventWithProperties,- 'exclude event property',- {- property_name: propertyName,- }- )- },-- // person modal- openCorrelationPersonsModal: ({ correlation, success }) => {- if (values.isInDashboardContext) {- return- }-- if (correlation.result_type === FunnelCorrelationResultsType.Properties) {- eventUsageLogic.actions.reportCorrelationInteraction(- FunnelCorrelationResultsType.Properties,- 'person modal'- )- } else {- const { name, properties } = parseEventAndProperty(correlation.event)- eventUsageLogic.actions.reportCorrelationInteraction(correlation.result_type, 'person modal', {- id: name,- type: EntityTypes.EVENTS,- properties,- converted: success,- })- }- },- }- }),-])diff --git a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/funnelPropertyCorrelationLogic.test.ts b/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/funnelPropertyCorrelationLogic.test.tsdeleted file mode 100644index 720ee4ee87e3..000000000000--- a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/funnelPropertyCorrelationLogic.test.ts+++ /dev/null@@ -1,174 +0,0 @@-import { MOCK_DEFAULT_TEAM } from 'lib/api.mock'--import { expectLogic, partial } from 'kea-test-utils'--import { teamLogic } from 'scenes/teamLogic'-import { userLogic } from 'scenes/userLogic'--import { useAvailableFeatures } from '~/mocks/features'-import { useMocks } from '~/mocks/jest'-import { InsightVizNode, NodeKind } from '~/queries/schema/schema-general'-import { initKeaTests } from '~/test/init'-import { AvailableFeature, CorrelationConfigType, InsightLogicProps, InsightShortId } from '~/types'--import { DEFAULT_EXCLUDED_PERSON_PROPERTIES, funnelPropertyCorrelationLogic } from './funnelPropertyCorrelationLogic'--const Insight123 = '123' as InsightShortId--describe('funnelPropertyCorrelationLogic', () => {- const props = { dashboardItemId: Insight123, syncWithUrl: true }- let logic: ReturnType<typeof funnelPropertyCorrelationLogic.build>- const correlationConfig: CorrelationConfigType = {}-- beforeEach(() => {- useAvailableFeatures([AvailableFeature.CORRELATION_ANALYSIS, AvailableFeature.GROUP_ANALYTICS])- useMocks({- get: {- '/api/environments/@current': () => [- 200,- {- ...MOCK_DEFAULT_TEAM,- correlation_config: correlationConfig,- },- ],- '/api/environments/:team_id/insights/': { results: [{}] },- '/api/environments/:team_id/insights/:id/': {},- '/api/projects/:team/groups_types/': [],- '/api/environments/:team_id/persons/properties': [- { name: 'some property', count: 20 },- { name: 'another property', count: 10 },- { name: 'third property', count: 5 },- ],- },- patch: {- '/api/environments/:id': async ({ request }) => {- const body = (await request.json()) as any- return [- 200,- {- ...MOCK_DEFAULT_TEAM,- correlation_config: {- ...correlationConfig,- excluded_person_property_names:- body?.correlation_config?.excluded_person_property_names,- },- },- ]- },- },- post: {- '/api/environments/:team_id/insights/funnel/correlation': async ({ request }) => {- const data = (await request.json()) as any- const excludePropertyFromProjectNames = data?.funnel_correlation_exclude_names || []- const includePropertyNames = data?.funnel_correlation_names || []- return [- 200,- {- is_cached: true,- last_refresh: '2021-09-16T13:41:41.297295Z',- result: {- events: [- {- event: { event: 'some property' },- success_count: 1,- failure_count: 1,- odds_ratio: 1,- correlation_type: 'success',- },- {- event: { event: 'another property' },- success_count: 1,- failure_count: 1,- odds_ratio: 1,- correlation_type: 'failure',- },- ]- .filter(- (correlation) =>- includePropertyNames.includes('$all') ||- includePropertyNames.includes(correlation.event.event)- )- .filter(- (correlation) =>- !excludePropertyFromProjectNames.includes(correlation.event.event)- ),- },- type: 'Funnel',- },- ]- },- },- })- initKeaTests(false)- window.POSTHOG_APP_CONTEXT = undefined // to force API request to /api/environments/@current- })-- const defaultProps: InsightLogicProps = {- dashboardItemId: undefined,- cachedInsight: {- short_id: undefined,- query: {- kind: NodeKind.InsightVizNode,- source: {- kind: NodeKind.FunnelsQuery,- series: [- { kind: NodeKind.ActionsNode, id: 1 },- { kind: NodeKind.ActionsNode, id: 1 },- ],- },- } as InsightVizNode,- result: null,- },- }-- async function initPropertyFunnelCorrelationLogic(props: InsightLogicProps = defaultProps): Promise<void> {- teamLogic.mount()- await expectLogic(teamLogic).toFinishAllListeners()- userLogic.mount()- await expectLogic(userLogic).toFinishAllListeners()- logic = funnelPropertyCorrelationLogic(props)- logic.mount()- await expectLogic(logic).toFinishAllListeners()- }-- it('Deselecting all returns empty result', async () => {- await initPropertyFunnelCorrelationLogic(props)- await expectLogic(logic, () => logic.actions.setPropertyNames([]))- .toDispatchActions(logic, ['loadPropertyCorrelationsSuccess'])- .toMatchValues({- propertyCorrelations: {- events: [],- },- })- })-- it('isPropertyExcludedFromProject returns true initially, then false when excluded, and is persisted to team config', async () => {- await initPropertyFunnelCorrelationLogic(props)-- expect(logic.values.isPropertyExcludedFromProject('some property')).toBe(false)-- await expectLogic(logic, () => logic.actions.excludePropertyFromProject('some property')).toFinishAllListeners()-- expect(logic.values.isPropertyExcludedFromProject('some property')).toBe(true)-- await expectLogic(teamLogic).toMatchValues({- currentTeam: partial({- correlation_config: {- excluded_person_property_names: DEFAULT_EXCLUDED_PERSON_PROPERTIES.concat(['some property']),- },- }),- })-- // Also make sure that excluding the property again doesn't double- // up on the config list- await expectLogic(logic, () => logic.actions.excludePropertyFromProject('some property')).toFinishAllListeners()-- await expectLogic(teamLogic).toMatchValues({- currentTeam: partial({- correlation_config: {- excluded_person_property_names: DEFAULT_EXCLUDED_PERSON_PROPERTIES.concat(['some property']),- },- }),- })- })-})diff --git a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/funnelPropertyCorrelationLogic.ts b/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/funnelPropertyCorrelationLogic.tsdeleted file mode 100644index dc988febd280..000000000000--- a/products/product_analytics/frontend/insights/funnels/FunnelCorrelation/funnelPropertyCorrelationLogic.ts+++ /dev/null@@ -1,251 +0,0 @@-import { MakeLogicType, actions, connect, defaults, kea, key, listeners, path, props, reducers, selectors } from 'kea'-import { loaders } from 'kea-loaders'--import { lemonToast } from '@posthog/lemon-ui'--import api from 'lib/api'-import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'-import { teamLogic } from 'scenes/teamLogic'--import { FunnelCorrelationQuery, FunnelsActorsQuery, NodeKind } from '~/queries/schema/schema-general'-import type { FunnelsQuery } from '~/queries/schema/schema-general'-import { setLatestVersionsOnQuery } from '~/queries/utils'-import { FunnelCorrelation, FunnelCorrelationResultsType, FunnelCorrelationType, InsightLogicProps } from '~/types'-import type { TeamPublicType, TeamType } from '~/types'--import { appendToCorrelationConfig } from '../funnelUtils'-import { funnelCorrelationLogic } from './funnelCorrelationLogic'--// List of events that should be excluded, if we don't have an explicit list of-// excluded properties. Copied from-// https://github.com/PostHog/posthog/issues/6474#issuecomment-952044722-export const DEFAULT_EXCLUDED_PERSON_PROPERTIES = [- '$initial_geoip_postal_code',- '$initial_geoip_latitude',- '$initial_geoip_longitude',- '$geoip_latitude',- '$geoip_longitude',- '$geoip_postal_code',- '$geoip_continent_code',- '$geoip_continent_name',- '$initial_geoip_continent_code',- '$initial_geoip_continent_name',- '$geoip_time_zone',- '$geoip_country_code',- '$geoip_subdivision_1_code',- '$initial_geoip_subdivision_1_code',- '$geoip_subdivision_2_code',- '$initial_geoip_subdivision_2_code',- '$geoip_subdivision_name',- '$initial_geoip_subdivision_name',-]--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface funnelPropertyCorrelationLogicValues {- querySource: FunnelsQuery | null // funnelCorrelationLogic- currentTeam: TeamPublicType | TeamType | null // teamLogic- __ignore: FunnelCorrelationResultsType | null- excludedPropertyNames: string[]- isPropertyExcludedFromProject: (propertyName: string) => boolean- loadedPropertyCorrelationsTableOnce: boolean- propertyCorrelationTypes: FunnelCorrelationType[]- propertyCorrelationValues: FunnelCorrelation[]- propertyCorrelations: Record<'events', FunnelCorrelation[]>- propertyCorrelationsLoading: boolean- propertyNames: string[]-}--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface funnelPropertyCorrelationLogicActions {- excludePropertyFromProject: (propertyName: string) => {- propertyName: string- }- loadPropertyCorrelations: (_: any) => any- loadPropertyCorrelationsFailure: (- error: string,- errorObject?: any- ) => {- error: string- errorObject?: any- }- loadPropertyCorrelationsSuccess: (- propertyCorrelations: {- events: FunnelCorrelation[]- },- payload?: any- ) => {- propertyCorrelations: {- events: FunnelCorrelation[]- }- payload?: any- }- setAllProperties: () => {- value: true- }- setPropertyCorrelationTypes: (types: FunnelCorrelationType[]) => {- types: FunnelCorrelationType[]- }- setPropertyNames: (propertyNames: string[]) => {- propertyNames: string[]- }-}--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface funnelPropertyCorrelationLogicMeta {- key: string- __keaTypeGenInternalSelectorTypes: {- propertyCorrelationValues: (- propertyCorrelations: Record<'events', FunnelCorrelation[]>,- propertyCorrelationTypes: FunnelCorrelationType[],- excludedPropertyNames: string[]- ) => FunnelCorrelation[]- excludedPropertyNames: (currentTeam: TeamPublicType | TeamType | null) => string[]- isPropertyExcludedFromProject: (excludedPropertyNames: string[]) => (propertyName: string) => boolean- }-}--export type funnelPropertyCorrelationLogicType = MakeLogicType<- funnelPropertyCorrelationLogicValues,- funnelPropertyCorrelationLogicActions,- InsightLogicProps,- funnelPropertyCorrelationLogicMeta->--export const funnelPropertyCorrelationLogic = kea<funnelPropertyCorrelationLogicType>([- props({} as InsightLogicProps),- key(keyForInsightLogicProps('insight_funnel')),- path((key) => ['scenes', 'funnels', 'funnelPropertyCorrelationLogic', key]),- connect((props: InsightLogicProps) => ({- values: [funnelCorrelationLogic(props), ['querySource'], teamLogic, ['currentTeam']],- })),- actions({- setPropertyCorrelationTypes: (types: FunnelCorrelationType[]) => ({ types }),- setPropertyNames: (propertyNames: string[]) => ({ propertyNames }),- excludePropertyFromProject: (propertyName: string) => ({ propertyName }),- setAllProperties: true,- }),- defaults({- // This is a hack to get `FunnelCorrelationResultsType` imported in `funnelCorrelationLogicType.ts`- __ignore: null as FunnelCorrelationResultsType | null,- }),- loaders(({ values }) => ({- propertyCorrelations: [- { events: [] } as Record<'events', FunnelCorrelation[]>,- {- loadPropertyCorrelations: async (_, breakpoint) => {- const targetProperties = values.propertyNames-- if (targetProperties.length === 0) {- return { events: [] }- }-- await breakpoint(100)-- try {- const actorsQuery: FunnelsActorsQuery = setLatestVersionsOnQuery(- {- kind: NodeKind.FunnelsActorsQuery,- source: values.querySource!,- },- { recursion: false }- )- const query: FunnelCorrelationQuery = setLatestVersionsOnQuery(- {- kind: NodeKind.FunnelCorrelationQuery,- source: actorsQuery,- funnelCorrelationType: FunnelCorrelationResultsType.Properties,- funnelCorrelationNames: targetProperties,- funnelCorrelationExcludeNames: values.excludedPropertyNames,- },- { recursion: false }- )- const response = await api.query(query)- return {- events: response.results.events.map((result) => ({- ...result,- result_type: FunnelCorrelationResultsType.Events,- })) as FunnelCorrelation[],- }- } catch {- lemonToast.error('Failed to load correlation results', { toastId: 'funnel-correlation-error' })- return { events: [] }- }- },- },- ],- })),- reducers({- propertyCorrelationTypes: [- [FunnelCorrelationType.Success, FunnelCorrelationType.Failure] as FunnelCorrelationType[],- {- setPropertyCorrelationTypes: (_, { types }) => types,- },- ],- propertyNames: [- [] as string[],- {- setPropertyNames: (_, { propertyNames }) => propertyNames,- setAllProperties: () => ['$all'],- excludePropertyFromProject: (selectedProperties, { propertyName }) => {- return selectedProperties.filter((p) => p !== propertyName)- },- },- ],- loadedPropertyCorrelationsTableOnce: [- false,- {- loadPropertyCorrelations: () => true,- },- ],- }),- selectors({- propertyCorrelationValues: [- (s) => [s.propertyCorrelations, s.propertyCorrelationTypes, s.excludedPropertyNames],- (- propertyCorrelations: Record<'events', FunnelCorrelation[]>,- propertyCorrelationTypes: FunnelCorrelationType[],- excludedPropertyNames: string[]- ): FunnelCorrelation[] => {- return propertyCorrelations.events- .filter(- (correlation) =>- propertyCorrelationTypes.includes(correlation.correlation_type) &&- !excludedPropertyNames.includes(correlation.event.event.split('::')[0])- )- .map((value) => {- return {- ...value,- odds_ratio:- value.correlation_type === FunnelCorrelationType.Success- ? value.odds_ratio- : 1 / value.odds_ratio,- }- })- .sort((first, second) => {- return second.odds_ratio - first.odds_ratio- })- },- ],- excludedPropertyNames: [- (s) => [s.currentTeam],- (currentTeam: null | import('~/types').TeamPublicType | import('~/types').TeamType): string[] =>- currentTeam?.correlation_config?.excluded_person_property_names || DEFAULT_EXCLUDED_PERSON_PROPERTIES,- ],- isPropertyExcludedFromProject: [- (s) => [s.excludedPropertyNames],- (excludedPropertyNames: string[]) => (propertyName: string) =>- excludedPropertyNames.find((name) => name === propertyName) !== undefined,- ],- }),- listeners(({ actions, values }) => ({- excludePropertyFromProject: ({ propertyName }) => {- appendToCorrelationConfig('excluded_person_property_names', values.excludedPropertyNames, propertyName)- },- setPropertyNames: async () => {- actions.loadPropertyCorrelations({})- },- setAllProperties: async () => {- actions.loadPropertyCorrelations({})- },- })),-])diff --git a/products/product_analytics/frontend/insights/funnels/FunnelStepsBarChart/FunnelStepsBarChart.stories.tsx b/products/product_analytics/frontend/insights/funnels/FunnelStepsBarChart/FunnelStepsBarChart.stories.tsxindex 72261771ccf7..70d315d23112 100644--- a/products/product_analytics/frontend/insights/funnels/FunnelStepsBarChart/FunnelStepsBarChart.stories.tsx+++ b/products/product_analytics/frontend/insights/funnels/FunnelStepsBarChart/FunnelStepsBarChart.stories.tsx@@ -133,7 +133,7 @@ export const BreakdownAndCompare: Story = {}// Full insight scene in edit mode — the steps funnel editor, and the funnels query kind's full data pipeline-const sceneEditWaitForSelector = ['[data-attr=funnel-steps-bar-chart] canvas[role="img"]', '.PayGateMini']+const sceneEditWaitForSelector = ['[data-attr=funnel-steps-bar-chart] canvas[role="img"]']export const EditScene: Story = createInsightStory(funnelLeftToRightFixture as any, 'edit')EditScene.decorators = [insightSceneMswDecorator]diff --git a/products/product_analytics/frontend/insights/funnels/funnelPersonsModalLogic.ts b/products/product_analytics/frontend/insights/funnels/funnelPersonsModalLogic.tsindex e6bf47c48825..e69940b7232d 100644--- a/products/product_analytics/frontend/insights/funnels/funnelPersonsModalLogic.ts+++ b/products/product_analytics/frontend/insights/funnels/funnelPersonsModalLogic.ts@@ -1,33 +1,16 @@import { MakeLogicType, actions, connect, kea, key, listeners, path, props, selectors } from 'kea'-import { elementsToAction } from 'scenes/activity/explore/createActionFromEvent'import { insightLogic } from 'scenes/insights/insightLogic'import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'import { funnelTitle } from 'scenes/trends/persons-modal/persons-modal-utils'import { openPersonsModal } from 'scenes/trends/persons-modal/PersonsModal'-import {- EventsNode,- FunnelCorrelationActorsQuery,- FunnelCorrelationQuery,- FunnelsActorsQuery,- NodeKind,-} from '~/queries/schema/schema-general'+import { FunnelsActorsQuery, NodeKind } from '~/queries/schema/schema-general'import type { FunnelsFilter, FunnelsQuery } from '~/queries/schema/schema-general'-import {- AnyPropertyFilter,- FunnelCorrelation,- FunnelCorrelationResultsType,- FunnelStep,- FunnelStepWithConversionMetrics,- InsightLogicProps,- PropertyFilterType,- PropertyOperator,-} from '~/types'+import { FunnelStep, FunnelStepWithConversionMetrics, InsightLogicProps } from '~/types'import type { FunnelStepWithNestedBreakdown } from '~/types'import { funnelDataLogic } from './funnelDataLogic'-import { parseBreakdownValue, parseEventAndProperty } from './funnelUtils'const DEFAULT_FUNNEL_LOGIC_KEY = 'default_funnel_key'@@ -43,13 +26,6 @@ export interface funnelPersonsModalLogicValues {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface funnelPersonsModalLogicActions {- openCorrelationPersonsModal: (- correlation: FunnelCorrelation,- success: boolean- ) => {- correlation: FunnelCorrelation- success: boolean- }openPersonsModalForSeries: ({step,series,@@ -134,10 +110,6 @@ export const funnelPersonsModalLogic = kea<funnelPersonsModalLogicType>([series,converted,}),- openCorrelationPersonsModal: (correlation: FunnelCorrelation, success: boolean) => ({- correlation,- success,- }),}),selectors({@@ -220,131 +192,5 @@ export const funnelPersonsModalLogic = kea<funnelPersonsModalLogicType>([}openPersonsModal({ title, query, additionalSelect: { matched_recordings: 'matched_recordings' } })},- openCorrelationPersonsModal: ({ correlation, success }) => {- if (correlation.result_type === FunnelCorrelationResultsType.Properties) {- const { breakdown, breakdown_value } = parseBreakdownValue(correlation.event.event)- const title = funnelTitle({- converted: success,- step: values.steps.length,- breakdown_value,- label: breakdown,- })-- // properties- const [propertyName, propertyValue] = correlation.event.event.split('::')- const propType = values.querySource?.aggregation_group_type_index ? 'group' : 'person'- const actorsQuery: FunnelsActorsQuery = {- kind: NodeKind.FunnelsActorsQuery,- source: values.querySource!,- funnelStep: 1,- includeRecordings: true,- }- const correlationQuery: FunnelCorrelationQuery = {- kind: NodeKind.FunnelCorrelationQuery,- source: actorsQuery,- funnelCorrelationType: correlation.result_type,- }- const query: FunnelCorrelationActorsQuery = {- kind: NodeKind.FunnelCorrelationActorsQuery,- source: correlationQuery,- funnelCorrelationPersonConverted: success,- funnelCorrelationPropertyValues: [- {- key: propertyName,- value: propertyValue,- type: propType === 'person' ? PropertyFilterType.Person : PropertyFilterType.Group,- operator: PropertyOperator.Exact,- group_type_index: values.querySource?.aggregation_group_type_index,- },- ],- }- openPersonsModal({- title,- query,- additionalSelect: { matched_recordings: 'matched_recordings' },- })- } else {- const { name } = parseEventAndProperty(correlation.event)- const title = funnelTitle({- converted: success,- step: values.steps.length,- label: name,- })-- const actorsQuery: FunnelsActorsQuery = {- kind: NodeKind.FunnelsActorsQuery,- source: values.querySource!,- funnelStep: 1,- includeRecordings: true,- }- const correlationQuery: FunnelCorrelationQuery = {- kind: NodeKind.FunnelCorrelationQuery,- source: actorsQuery,- funnelCorrelationType: correlation.result_type,- }-- let entity: EventsNode- if (correlation.result_type === FunnelCorrelationResultsType.Events) {- // events- entity = {- event: correlation.event.event,- kind: NodeKind.EventsNode,- }- } else {- // events with properties- const eventName = correlation.event.event.split('::')[0]-- let properties: AnyPropertyFilter[]- if (eventName === '$autocapture') {- // If we have an $autocapture event, we need to- // convert the `elements` chain into an "action".- const elements = correlation.event.elements- const elementsAsAction = elementsToAction(elements)- properties = Object.entries(elementsAsAction)- .map(([propertyKey, propertyValue]) => {- if (propertyValue !== null) {- return {- key: propertyKey,- value: [propertyValue],- type: 'element',- operator: 'exact',- }- }- })- .filter(Boolean) as AnyPropertyFilter[]- } else {- const [_, propertyName, propertyValue] = correlation.event.event.split('::')-- properties = [- {- key: propertyName,- value: propertyValue,- type: PropertyFilterType.Event,- operator: PropertyOperator.Exact,- },- ]- }-- entity = {- kind: NodeKind.EventsNode,- event: eventName,- properties,- }- }-- const query: FunnelCorrelationActorsQuery = {- kind: NodeKind.FunnelCorrelationActorsQuery,- source: correlationQuery,- funnelCorrelationPersonConverted: success,- funnelCorrelationPersonEntity: entity,- }-- openPersonsModal({- title,- query,- additionalSelect: { matched_recordings: 'matched_recordings' },- })- }- },})),])diff --git a/products/product_analytics/frontend/insights/funnels/funnelUtils.test.ts b/products/product_analytics/frontend/insights/funnels/funnelUtils.test.tsindex 39da23564eb6..86da64fb8ad0 100644--- a/products/product_analytics/frontend/insights/funnels/funnelUtils.test.ts+++ b/products/product_analytics/frontend/insights/funnels/funnelUtils.test.ts@@ -3,15 +3,7 @@ import { dayjs } from 'lib/dayjs'import { formatDateRange } from 'lib/utils/datetime'import { EventsNode, FunnelsQuery, NodeKind } from '~/queries/schema/schema-general'-import {- FunnelConversionWindowTimeUnit,- FunnelCorrelation,- FunnelCorrelationResultsType,- FunnelCorrelationType,- FunnelStep,- FunnelStepReference,- FunnelStepWithNestedBreakdown,-} from '~/types'+import { FunnelConversionWindowTimeUnit, FunnelStep, FunnelStepReference, FunnelStepWithNestedBreakdown } from '~/types'import {aggregateBreakdownCompareResult,@@ -35,7 +27,6 @@ import {hasBreakdown,isFunnelWithEnoughSteps,isFunnelWithIncompleteDataWarehouseStep,- parseDisplayNameForCorrelation,stepsWithConversionMetrics,} from './funnelUtils'@@ -231,95 +222,6 @@ describe('getClampedFunnelStepRange', () => {})})-describe('parseEventAndProperty', () => {- const basicFunnelRecord: FunnelCorrelation = {- event: { event: '$pageview::bzzz', properties: {}, elements: [] },- odds_ratio: 1,- correlation_type: FunnelCorrelationType.Success,- success_count: 1,- failure_count: 1,- success_people_url: '/some/people/url',- failure_people_url: '/some/people/url',- result_type: FunnelCorrelationResultsType.Events,- }- it('chooses the correct name based on Event type', async () => {- const result = parseDisplayNameForCorrelation(basicFunnelRecord)- expect(result).toEqual({- first_value: '$pageview::bzzz',- second_value: undefined,- })- })-- it('chooses the correct name based on Property type', async () => {- const result = parseDisplayNameForCorrelation({- ...basicFunnelRecord,- result_type: FunnelCorrelationResultsType.Properties,- })- expect(result).toEqual({- first_value: '$pageview',- second_value: 'bzzz',- })- })-- it('chooses the correct name based on EventWithProperty type', async () => {- const result = parseDisplayNameForCorrelation({- ...basicFunnelRecord,- result_type: FunnelCorrelationResultsType.EventWithProperties,- event: {- event: '$pageview::library::1.2',- properties: { random: 'x' },- elements: [],- },- })- expect(result).toEqual({- first_value: 'library',- second_value: '1.2',- })- })-- it('handles autocapture events on EventWithProperty type', async () => {- const result = parseDisplayNameForCorrelation({- ...basicFunnelRecord,- result_type: FunnelCorrelationResultsType.EventWithProperties,- event: {- event: '$autocapture::elements_chain::xyz_elements_a.link*',- properties: { $event_type: 'click' },- elements: [- {- tag_name: 'a',- href: '#',- attributes: { blah: 'https://example.com' },- nth_child: 0,- nth_of_type: 0,- order: 0,- text: 'bazinga',- },- ],- },- })- expect(result).toEqual({- first_value: 'clicked link with text "bazinga"',- second_value: undefined,- })- })-- it('handles autocapture events without elements_chain on EventWithProperty type', async () => {- const result = parseDisplayNameForCorrelation({- ...basicFunnelRecord,- result_type: FunnelCorrelationResultsType.EventWithProperties,- event: {- event: '$autocapture::library::1.2',- properties: { random: 'x' },- elements: [],- },- })- expect(result).toEqual({- first_value: 'library',- second_value: '1.2',- })- })-})-// Helpers for building minimal FunnelStep fixturesconst makeStep = (overrides: Partial<FunnelStep> & { count: number; order: number }): FunnelStep => ({action_id: 'step',diff --git a/products/product_analytics/frontend/insights/funnels/funnelUtils.tsx b/products/product_analytics/frontend/insights/funnels/funnelUtils.tsxindex 5b9013e34318..117722f89a37 100644--- a/products/product_analytics/frontend/insights/funnels/funnelUtils.tsx+++ b/products/product_analytics/frontend/insights/funnels/funnelUtils.tsx@@ -2,11 +2,8 @@ import { FunnelLayout } from 'lib/constants'import { dayjs } from 'lib/dayjs'import { formatDateRange } from 'lib/utils/datetime'import { humanFriendlyDuration } from 'lib/utils/durations'-import { autoCaptureEventToDescription } from 'lib/utils/events'import { clamp, percentage } from 'lib/utils/numbers'import { capitalizeFirstLetter, pluralize } from 'lib/utils/strings'-import { elementsToAction } from 'scenes/activity/explore/createActionFromEvent'-import { teamLogic } from 'scenes/teamLogic'import { Noun } from '~/models/groupsModel'import {@@ -20,23 +17,16 @@ import {import { integer } from '~/queries/schema/type-utils'import { isFunnelsDataWarehouseNode } from '~/queries/utils'import {- AnyPropertyFilter,Breakdown,BreakdownKeyType,- CorrelationConfigType,- ElementPropertyFilter,FlattenedFunnelStepByBreakdown,FunnelConversionWindow,FunnelConversionWindowTimeUnit,- FunnelCorrelation,- FunnelCorrelationResultsType,FunnelResultType,FunnelStep,FunnelStepReference,FunnelStepWithConversionMetrics,FunnelStepWithNestedBreakdown,- PropertyFilterType,- PropertyOperator,} from '~/types'// Keep in sync with CONVERSION_WINDOW_INTERVAL_BOUNDS in products/product_analytics/backend/hogql_queries/funnels/utils.py,@@ -815,122 +805,6 @@ export function flattenedStepsByBreakdownCompare(return rows}-export const parseBreakdownValue = (- item: string-): {- breakdown: string- breakdown_value: string-} => {- const components = item.split('::')- if (components.length === 1) {- return { breakdown: components[0], breakdown_value: '' }- }- return {- breakdown: components[0],- breakdown_value: components[1],- }-}--export const parseEventAndProperty = (- event: FunnelCorrelation['event']-): {- name: string- properties?: AnyPropertyFilter[]-} => {- const components = event.event.split('::')- /*- The `event` is either an event name, or event::property::property_value- */- if (components.length === 1) {- return { name: components[0] }- } else if (components[0] === '$autocapture') {- // We use elementsToAction to generate the required property filters- const elementData = elementsToAction(event.elements)- return {- name: components[0],- properties: Object.entries(elementData)- .filter(([, propertyValue]) => !!propertyValue)- .map(([propertyKey, propertyValue]) => ({- key: propertyKey as ElementPropertyFilter['key'],- operator: PropertyOperator.Exact,- type: PropertyFilterType.Element,- value: [propertyValue as string],- })),- }- }- return {- name: components[0],- properties: [- {- key: components[1],- operator: PropertyOperator.Exact,- value: components[2],- type: PropertyFilterType.Event,- },- ],- }-}--export const parseDisplayNameForCorrelation = (- record: FunnelCorrelation-): { first_value: string; second_value?: string } => {- let first_value = undefined- let second_value = undefined- const values = record.event.event.split('::')-- if (record.result_type === FunnelCorrelationResultsType.Events) {- first_value = record.event.event- return { first_value, second_value }- } else if (record.result_type === FunnelCorrelationResultsType.Properties) {- first_value = values[0]- second_value = values[1]- return { first_value, second_value }- } else if (values[0] === '$autocapture' && values[1] === 'elements_chain') {- // special case for autocapture elements_chain- first_value = autoCaptureEventToDescription({- ...record.event,- event: '$autocapture',- })- return { first_value, second_value }- }- // FunnelCorrelationResultsType.EventWithProperties- // Events here come in the form of event::property::value- return { first_value: values[1], second_value: values[2] }-}--export const appendToCorrelationConfig = (- configKey: keyof CorrelationConfigType,- currentValue: string[],- configValue: string-): void => {- // Helper to handle updating correlationConfig within the Team model. Only- // handles further appending to current values.-- // When we exclude a property, we want to update the config stored- // on the current Team/Project.- const oldCurrentTeam = teamLogic.values.currentTeam-- // If we haven't actually retrieved the current team, we can't- // update the config.- if (oldCurrentTeam === null || !currentValue) {- console.warn('Attempt to update correlation config without first retrieving existing config')- return- }-- const oldCorrelationConfig = oldCurrentTeam.correlation_config-- const configList = Array.from(new Set(currentValue.concat([configValue])))-- const correlationConfig = {- ...oldCorrelationConfig,- [configKey]: configList,- }-- teamLogic.actions.updateCurrentTeam({- correlation_config: correlationConfig,- })-}-export function aggregationLabelForHogQL(funnelAggregateByHogQL: string): Noun {if (funnelAggregateByHogQL === 'person_id') {return { singular: 'person', plural: 'persons' }diff --git a/products/slack_app/backend/slack_link_unfurl.py b/products/slack_app/backend/slack_link_unfurl.pyindex a4a5ccce502d..462ced58e5fa 100644--- a/products/slack_app/backend/slack_link_unfurl.py+++ b/products/slack_app/backend/slack_link_unfurl.py@@ -146,7 +146,6 @@ _INVITE_REDIS_TIMEOUT_SECONDS = 0.3_QUERY_KIND_TO_SHORT_NAME: dict[str, str] = {"TrendsQuery": "Trends","FunnelsQuery": "Funnel",- "FunnelCorrelationQuery": "Funnel correlation","RetentionQuery": "Retention","PathsQuery": "Paths","PathsV2Query": "Journeys",diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex f219706c5f9a..0851f5d9c3ac 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -6934,100 +6934,6 @@ export namespace Schemas {version?: number | null;}- export type FunnelCorrelationResultsType = typeof FunnelCorrelationResultsType[keyof typeof FunnelCorrelationResultsType];--- export const FunnelCorrelationResultsType = {- Events: 'events',- Properties: 'properties',- EventWithProperties: 'event_with_properties',- } as const;-- export type CorrelationType = typeof CorrelationType[keyof typeof CorrelationType];--- export const CorrelationType = {- Success: 'success',- Failure: 'failure',- } as const;-- export type EventDefinitionProperties = { [key: string]: unknown };-- export interface EventDefinition {- elements: unknown[];- event: string;- properties: EventDefinitionProperties;- }-- export interface EventOddsRatioSerialized {- correlation_type: CorrelationType;- event: EventDefinition;- failure_count: number;- odds_ratio: number;- success_count: number;- }-- export interface FunnelCorrelationResult {- events: EventOddsRatioSerialized[];- skewed: boolean;- }-- export interface FunnelCorrelationResponse {- columns?: unknown[] | null;- /** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */- error?: string | null;- hasMore?: boolean | null;- /** Generated HogQL query. */- hogql?: string | null;- limit?: number | null;- /** Modifiers used when performing the query */- modifiers?: HogQLQueryModifiers | null;- offset?: number | null;- /** Query status indicates whether next to the provided data, a query is still running. */- query_status?: QueryStatus | null;- /** The resolved previous/comparison period date range, when comparing against another period */- resolved_compare_date_range?: ResolvedDateRangeResponse | null;- /** The date range used for the query */- resolved_date_range?: ResolvedDateRangeResponse | null;- results: FunnelCorrelationResult;- /** Measured timings for different parts of the query generation process */- timings?: QueryTiming[] | null;- types?: unknown[] | null;- /** Connector-synced data warehouse sources referenced by this query, if any. */- used_data_warehouse_sources?: DataWarehouseSourceUsage[] | null;- /** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. Also carries access control warnings when a system-table query filters out objects the user can't access. */- warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;- }-- export interface FunnelCorrelationQuery {- funnelCorrelationEventExcludePropertyNames?: string[] | null;- funnelCorrelationEventNames?: string[] | null;- funnelCorrelationExcludeEventNames?: string[] | null;- funnelCorrelationExcludeNames?: string[] | null;- funnelCorrelationNames?: string[] | null;- funnelCorrelationType: FunnelCorrelationResultsType;- kind?: 'FunnelCorrelationQuery';- response?: FunnelCorrelationResponse | null;- source: FunnelsActorsQuery;- /** version of the node, used for schema migrations */- version?: number | null;- }-- export interface FunnelCorrelationActorsQuery {- funnelCorrelationPersonConverted?: boolean | null;- funnelCorrelationPersonEntity?: EventsNode | ActionsNode | DataWarehouseNode | null;- funnelCorrelationPropertyValues?: (EventPropertyFilter | PersonPropertyFilter | PersonMetadataPropertyFilter | ElementPropertyFilter | EventMetadataPropertyFilter | SessionPropertyFilter | CohortPropertyFilter | RecordingPropertyFilter | LogEntryPropertyFilter | GroupPropertyFilter | FeaturePropertyFilter | FlagPropertyFilter | HogQLPropertyFilter | EmptyPropertyFilter | DataWarehousePropertyFilter | DataWarehousePersonPropertyFilter | ErrorTrackingIssueFilter | LogPropertyFilter | MetricPropertyFilter | SpanPropertyFilter | RevenueAnalyticsPropertyFilter | AccountCustomPropertyFilter | WorkflowVariablePropertyFilter | BehavioralPropertyFilter)[] | null;- includeRecordings?: boolean | null;- kind?: 'FunnelCorrelationActorsQuery';- /** Modifiers used when performing the query */- modifiers?: HogQLQueryModifiers | null;- response?: ActorsQueryResponse | null;- source: FunnelCorrelationQuery;- tags?: QueryLogTags | null;- /** version of the node, used for schema migrations */- version?: number | null;- }-export type ExperimentEventExposureConfigResponse = { [key: string]: unknown } | null;export interface ExperimentEventExposureConfig {@@ -7694,7 +7600,7 @@ export namespace Schemas {response?: ActorsQueryResponse | null;search?: string | null;select?: string[] | null;- source?: InsightActorsQuery | FunnelsActorsQuery | FunnelCorrelationActorsQuery | ExperimentActorsQuery | StickinessActorsQuery | PathsV2ActorsQuery | HogQLQuery | null;+ source?: InsightActorsQuery | FunnelsActorsQuery | ExperimentActorsQuery | StickinessActorsQuery | PathsV2ActorsQuery | HogQLQuery | null;tags?: QueryLogTags | null;/** version of the node, used for schema migrations */version?: number | null;@@ -57398,7 +57304,7 @@ export namespace Schemas {export interface InsightActorsQueryOptions {kind?: 'InsightActorsQueryOptions';response?: InsightActorsQueryOptionsResponse | null;- source: InsightActorsQuery | FunnelsActorsQuery | FunnelCorrelationActorsQuery | StickinessActorsQuery | ExperimentActorsQuery | PathsV2ActorsQuery;+ source: InsightActorsQuery | FunnelsActorsQuery | StickinessActorsQuery | ExperimentActorsQuery | PathsV2ActorsQuery;/** version of the node, used for schema migrations */version?: number | null;}@@ -85509,7 +85415,6 @@ export namespace Schemas {* @items.maxLength 400*/person_display_name_properties?: string[] | null;- correlation_config?: unknown;/*** Disables posthog-js autocapture (clicks, page views) when true.* @nullable@@ -90800,7 +90705,6 @@ export namespace Schemas {* @items.maxLength 400*/person_display_name_properties?: string[] | null;- correlation_config?: unknown;/*** Disables posthog-js autocapture (clicks, page views) when true.* @nullable@@ -91670,7 +91574,6 @@ export namespace Schemas {* @items.maxLength 400*/person_display_name_properties?: string[] | null;- correlation_config?: unknown;/*** Disables posthog-js autocapture (clicks, page views) when true.* @nullable@@ -93549,7 +93452,7 @@ export namespace Schemas {* ```** For more details on HogQL queries, see the [PostHog HogQL documentation](/docs/hogql#api-access). */- query: EventsNode | ActionsNode | PersonsNode | DataWarehouseNode | FunnelsDataWarehouseNode | LifecycleDataWarehouseNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingFingerprintProjectionQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingReleasesQuery | ErrorTrackingIssueCorrelationQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebAgentAnalyticsQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | MarketingAnalyticsAttributionQuery | MarketingAnalyticsAttributionPathsQuery | MarketingAnalyticsRetentionQuery | MarketingAnalyticsSearchQuery | DataVisualizationNode | BIVisualizationNode | DataTableNode | SavedInsightNode | InsightVizNode | TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | PathsV2Query | StickinessQuery | LifecycleQuery | FunnelCorrelationQuery | DatabaseSchemaQuery | RecordingsQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | MetricsHistogramQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | AccountsTableQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallBreakdownQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPModelBreakdownQuery | MCPProtocolVersionBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolCategoryMapQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | MCPMissingCapabilitiesQuery | PropertyValuesQuery;+ query: EventsNode | ActionsNode | PersonsNode | DataWarehouseNode | FunnelsDataWarehouseNode | LifecycleDataWarehouseNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingFingerprintProjectionQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingReleasesQuery | ErrorTrackingIssueCorrelationQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebAgentAnalyticsQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | MarketingAnalyticsAttributionQuery | MarketingAnalyticsAttributionPathsQuery | MarketingAnalyticsRetentionQuery | MarketingAnalyticsSearchQuery | DataVisualizationNode | BIVisualizationNode | DataTableNode | SavedInsightNode | InsightVizNode | TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | PathsV2Query | StickinessQuery | LifecycleQuery | DatabaseSchemaQuery | RecordingsQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | MetricsHistogramQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | AccountsTableQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallBreakdownQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPModelBreakdownQuery | MCPProtocolVersionBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolCategoryMapQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | MCPMissingCapabilitiesQuery | PropertyValuesQuery;/** Whether results should be calculated sync or async, and how much to rely on the cache:* - `'blocking'` - calculate synchronously (returning only when the query is done), UNLESS there are very fresh results in the cache* - `'async'` - kick off background calculation (returning immediately with a query status), UNLESS there are very fresh results in the cache@@ -95181,41 +95084,14 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative65 {- columns?: unknown[] | null;- /** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */- error?: string | null;- hasMore?: boolean | null;- /** Generated HogQL query. */- hogql?: string | null;- limit?: number | null;- /** Modifiers used when performing the query */- modifiers?: HogQLQueryModifiers | null;- offset?: number | null;- /** Query status indicates whether next to the provided data, a query is still running. */- query_status?: QueryStatus | null;- /** The resolved previous/comparison period date range, when comparing against another period */- resolved_compare_date_range?: ResolvedDateRangeResponse | null;- /** The date range used for the query */- resolved_date_range?: ResolvedDateRangeResponse | null;- results: FunnelCorrelationResult;- /** Measured timings for different parts of the query generation process */- timings?: QueryTiming[] | null;- types?: unknown[] | null;- /** Connector-synced data warehouse sources referenced by this query, if any. */- used_data_warehouse_sources?: DataWarehouseSourceUsage[] | null;- /** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. Also carries access control warnings when a system-table query filters out objects the user can't access. */- warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;- }-- export type QueryResponseAlternative66Tables = {[key: string]: DatabaseSchemaPostHogTable | DatabaseSchemaSystemTable | DatabaseSchemaDataWarehouseTable | DatabaseSchemaViewTable | DatabaseSchemaManagedViewTable | DatabaseSchemaBatchExportTable | DatabaseSchemaMaterializedViewTable | DatabaseSchemaEndpointTable};+ export type QueryResponseAlternative65Tables = {[key: string]: DatabaseSchemaPostHogTable | DatabaseSchemaSystemTable | DatabaseSchemaDataWarehouseTable | DatabaseSchemaViewTable | DatabaseSchemaManagedViewTable | DatabaseSchemaBatchExportTable | DatabaseSchemaMaterializedViewTable | DatabaseSchemaEndpointTable};- export interface QueryResponseAlternative66 {+ export interface QueryResponseAlternative65 {joins: DataWarehouseViewLink[];- tables: QueryResponseAlternative66Tables;+ tables: QueryResponseAlternative65Tables;}- export interface QueryResponseAlternative67 {+ export interface QueryResponseAlternative66 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;has_next: boolean;@@ -95240,7 +95116,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative68 {+ export interface QueryResponseAlternative67 {columns?: string[] | null;/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;@@ -95268,7 +95144,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative69 {+ export interface QueryResponseAlternative68 {count: number;/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;@@ -95291,7 +95167,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative70 {+ export interface QueryResponseAlternative69 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -95313,7 +95189,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative71 {+ export interface QueryResponseAlternative70 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -95335,7 +95211,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative72 {+ export interface QueryResponseAlternative71 {/** Upper bound per row (y axis), ascending. */bounds: number[];/** Observation count per cell: counts[row][column], row = bound, column = time. */@@ -95363,7 +95239,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative73 {+ export interface QueryResponseAlternative72 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;hasMore?: boolean | null;@@ -95390,7 +95266,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative74 {+ export interface QueryResponseAlternative73 {/** Result rows for the comparison period when `compareFilter.compare` is true. */compare?: AggregatedSpanRow[] | null;/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */@@ -95414,7 +95290,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative75 {+ export interface QueryResponseAlternative74 {/** Result rows for the comparison period when `compareFilter.compare` is true. */compare?: SpanTreeNode[] | null;/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */@@ -95438,7 +95314,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative76 {+ export interface QueryResponseAlternative75 {/** Result rows for the comparison period when `compareFilter.compare` is true. */compare?: AttributeBreakdownRow[] | null;/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */@@ -95462,13 +95338,13 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative77 {+ export interface QueryResponseAlternative76 {questions: string[];/** Data warehouse sync warnings — see AnalyticsQueryResponseBase.warnings for semantics. */warnings?: DataWarehouseSyncWarning[] | null;}- export interface QueryResponseAlternative78 {+ export interface QueryResponseAlternative77 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;hasMore?: boolean | null;@@ -95493,7 +95369,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative79 {+ export interface QueryResponseAlternative78 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;hasMore?: boolean | null;@@ -95518,7 +95394,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative80 {+ export interface QueryResponseAlternative79 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -95540,7 +95416,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative81 {+ export interface QueryResponseAlternative80 {columns?: string[] | null;/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;@@ -95566,7 +95442,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative84 {+ export interface QueryResponseAlternative83 {/** Timestamp of the newer trace */newerTimestamp?: string | null;/** ID of the newer trace (chronologically after current) */@@ -95581,7 +95457,7 @@ export namespace Schemas {warnings?: DataWarehouseSyncWarning[] | null;}- export interface QueryResponseAlternative85 {+ export interface QueryResponseAlternative84 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -95603,7 +95479,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative86 {+ export interface QueryResponseAlternative85 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -95625,7 +95501,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative87 {+ export interface QueryResponseAlternative86 {columns: unknown[];/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;@@ -95655,7 +95531,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative88 {+ export interface QueryResponseAlternative87 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;hasMore: boolean;@@ -95683,7 +95559,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative89 {+ export interface QueryResponseAlternative88 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -95705,7 +95581,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative90 {+ export interface QueryResponseAlternative89 {columns?: unknown[] | null;/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;@@ -95732,9 +95608,9 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export type QueryResponseAlternative91ResultsItem = { [key: string]: unknown };+ export type QueryResponseAlternative90ResultsItem = { [key: string]: unknown };- export interface QueryResponseAlternative91 {+ export interface QueryResponseAlternative90 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -95747,7 +95623,7 @@ export namespace Schemas {resolved_compare_date_range?: ResolvedDateRangeResponse | null;/** The date range used for the query */resolved_date_range?: ResolvedDateRangeResponse | null;- results: QueryResponseAlternative91ResultsItem[];+ results: QueryResponseAlternative90ResultsItem[];/** Measured timings for different parts of the query generation process */timings?: QueryTiming[] | null;/** Connector-synced data warehouse sources referenced by this query, if any. */@@ -95756,7 +95632,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative92 {+ export interface QueryResponseAlternative91 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -95778,7 +95654,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative93 {+ export interface QueryResponseAlternative92 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -95800,7 +95676,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative94 {+ export interface QueryResponseAlternative93 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -95822,7 +95698,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative95 {+ export interface QueryResponseAlternative94 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Whether another page of individual model identifiers is available. */@@ -95846,7 +95722,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative96 {+ export interface QueryResponseAlternative95 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -95868,7 +95744,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative97 {+ export interface QueryResponseAlternative96 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -95890,7 +95766,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative98 {+ export interface QueryResponseAlternative97 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -95912,7 +95788,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative99 {+ export interface QueryResponseAlternative98 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -95934,7 +95810,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative100 {+ export interface QueryResponseAlternative99 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -95957,7 +95833,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative101 {+ export interface QueryResponseAlternative100 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -95979,7 +95855,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative102 {+ export interface QueryResponseAlternative101 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -96007,7 +95883,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative103 {+ export interface QueryResponseAlternative102 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -96029,7 +95905,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative104 {+ export interface QueryResponseAlternative103 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -96051,7 +95927,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative105 {+ export interface QueryResponseAlternative104 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -96073,7 +95949,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative106 {+ export interface QueryResponseAlternative105 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -96095,7 +95971,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative107 {+ export interface QueryResponseAlternative106 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -96117,7 +95993,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative108 {+ export interface QueryResponseAlternative107 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -96139,7 +96015,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative109 {+ export interface QueryResponseAlternative108 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -96161,7 +96037,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative110 {+ export interface QueryResponseAlternative109 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Whether more reports exist past this page. */@@ -96185,7 +96061,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative111 {+ export interface QueryResponseAlternative110 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -96207,7 +96083,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export type QueryResponseAlternative = { [key: string]: unknown } | QueryResponseAlternative1 | QueryResponseAlternative2 | QueryResponseAlternative3 | QueryResponseAlternative4 | QueryResponseAlternative5 | QueryResponseAlternative6 | QueryResponseAlternative7 | QueryResponseAlternative8 | QueryResponseAlternative9 | QueryResponseAlternative10 | QueryResponseAlternative11 | QueryResponseAlternative12 | QueryResponseAlternative13 | QueryResponseAlternative14 | QueryResponseAlternative15 | QueryResponseAlternative16 | QueryResponseAlternative17 | QueryResponseAlternative18 | QueryResponseAlternative19 | QueryResponseAlternative20 | QueryResponseAlternative21 | QueryResponseAlternative22 | QueryResponseAlternative23 | QueryResponseAlternative24 | QueryResponseAlternative26 | QueryResponseAlternative27 | QueryResponseAlternative28 | QueryResponseAlternative29 | QueryResponseAlternative30 | QueryResponseAlternative31 | QueryResponseAlternative32 | QueryResponseAlternative33 | QueryResponseAlternative34 | QueryResponseAlternative35 | QueryResponseAlternative36 | unknown | QueryResponseAlternative37 | QueryResponseAlternative38 | QueryResponseAlternative39 | QueryResponseAlternative40 | QueryResponseAlternative41 | QueryResponseAlternative42 | QueryResponseAlternative43 | QueryResponseAlternative44 | QueryResponseAlternative45 | QueryResponseAlternative46 | QueryResponseAlternative47 | QueryResponseAlternative48 | QueryResponseAlternative49 | QueryResponseAlternative50 | QueryResponseAlternative51 | QueryResponseAlternative52 | QueryResponseAlternative53 | QueryResponseAlternative55 | QueryResponseAlternative56 | QueryResponseAlternative57 | QueryResponseAlternative58 | QueryResponseAlternative59 | QueryResponseAlternative60 | QueryResponseAlternative61 | QueryResponseAlternative62 | QueryResponseAlternative63 | QueryResponseAlternative65 | QueryResponseAlternative66 | QueryResponseAlternative67 | QueryResponseAlternative68 | QueryResponseAlternative69 | QueryResponseAlternative70 | QueryResponseAlternative71 | QueryResponseAlternative72 | QueryResponseAlternative73 | QueryResponseAlternative74 | QueryResponseAlternative75 | QueryResponseAlternative76 | QueryResponseAlternative77 | QueryResponseAlternative78 | QueryResponseAlternative79 | QueryResponseAlternative80 | QueryResponseAlternative81 | QueryResponseAlternative84 | QueryResponseAlternative85 | QueryResponseAlternative86 | QueryResponseAlternative87 | QueryResponseAlternative88 | QueryResponseAlternative89 | QueryResponseAlternative90 | QueryResponseAlternative91 | QueryResponseAlternative92 | QueryResponseAlternative93 | QueryResponseAlternative94 | QueryResponseAlternative95 | QueryResponseAlternative96 | QueryResponseAlternative97 | QueryResponseAlternative98 | QueryResponseAlternative99 | QueryResponseAlternative100 | QueryResponseAlternative101 | QueryResponseAlternative102 | QueryResponseAlternative103 | QueryResponseAlternative104 | QueryResponseAlternative105 | QueryResponseAlternative106 | QueryResponseAlternative107 | QueryResponseAlternative108 | QueryResponseAlternative109 | QueryResponseAlternative110 | QueryResponseAlternative111;+ export type QueryResponseAlternative = { [key: string]: unknown } | QueryResponseAlternative1 | QueryResponseAlternative2 | QueryResponseAlternative3 | QueryResponseAlternative4 | QueryResponseAlternative5 | QueryResponseAlternative6 | QueryResponseAlternative7 | QueryResponseAlternative8 | QueryResponseAlternative9 | QueryResponseAlternative10 | QueryResponseAlternative11 | QueryResponseAlternative12 | QueryResponseAlternative13 | QueryResponseAlternative14 | QueryResponseAlternative15 | QueryResponseAlternative16 | QueryResponseAlternative17 | QueryResponseAlternative18 | QueryResponseAlternative19 | QueryResponseAlternative20 | QueryResponseAlternative21 | QueryResponseAlternative22 | QueryResponseAlternative23 | QueryResponseAlternative24 | QueryResponseAlternative26 | QueryResponseAlternative27 | QueryResponseAlternative28 | QueryResponseAlternative29 | QueryResponseAlternative30 | QueryResponseAlternative31 | QueryResponseAlternative32 | QueryResponseAlternative33 | QueryResponseAlternative34 | QueryResponseAlternative35 | QueryResponseAlternative36 | unknown | QueryResponseAlternative37 | QueryResponseAlternative38 | QueryResponseAlternative39 | QueryResponseAlternative40 | QueryResponseAlternative41 | QueryResponseAlternative42 | QueryResponseAlternative43 | QueryResponseAlternative44 | QueryResponseAlternative45 | QueryResponseAlternative46 | QueryResponseAlternative47 | QueryResponseAlternative48 | QueryResponseAlternative49 | QueryResponseAlternative50 | QueryResponseAlternative51 | QueryResponseAlternative52 | QueryResponseAlternative53 | QueryResponseAlternative55 | QueryResponseAlternative56 | QueryResponseAlternative57 | QueryResponseAlternative58 | QueryResponseAlternative59 | QueryResponseAlternative60 | QueryResponseAlternative61 | QueryResponseAlternative62 | QueryResponseAlternative63 | QueryResponseAlternative65 | QueryResponseAlternative66 | QueryResponseAlternative67 | QueryResponseAlternative68 | QueryResponseAlternative69 | QueryResponseAlternative70 | QueryResponseAlternative71 | QueryResponseAlternative72 | QueryResponseAlternative73 | QueryResponseAlternative74 | QueryResponseAlternative75 | QueryResponseAlternative76 | QueryResponseAlternative77 | QueryResponseAlternative78 | QueryResponseAlternative79 | QueryResponseAlternative80 | QueryResponseAlternative83 | QueryResponseAlternative84 | QueryResponseAlternative85 | QueryResponseAlternative86 | QueryResponseAlternative87 | QueryResponseAlternative88 | QueryResponseAlternative89 | QueryResponseAlternative90 | QueryResponseAlternative91 | QueryResponseAlternative92 | QueryResponseAlternative93 | QueryResponseAlternative94 | QueryResponseAlternative95 | QueryResponseAlternative96 | QueryResponseAlternative97 | QueryResponseAlternative98 | QueryResponseAlternative99 | QueryResponseAlternative100 | QueryResponseAlternative101 | QueryResponseAlternative102 | QueryResponseAlternative103 | QueryResponseAlternative104 | QueryResponseAlternative105 | QueryResponseAlternative106 | QueryResponseAlternative107 | QueryResponseAlternative108 | QueryResponseAlternative109 | QueryResponseAlternative110;export interface QueryScanResponse {analysis?: QueryScanAnalysis | null;@@ -96218,11 +96094,11 @@ export namespace Schemas {}export interface QueryUpgradeRequest {- query: EventsNode | ActionsNode | PersonsNode | DataWarehouseNode | FunnelsDataWarehouseNode | LifecycleDataWarehouseNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingFingerprintProjectionQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingReleasesQuery | ErrorTrackingIssueCorrelationQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebAgentAnalyticsQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | MarketingAnalyticsAttributionQuery | MarketingAnalyticsAttributionPathsQuery | MarketingAnalyticsRetentionQuery | MarketingAnalyticsSearchQuery | DataVisualizationNode | BIVisualizationNode | DataTableNode | SavedInsightNode | InsightVizNode | TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | PathsV2Query | StickinessQuery | LifecycleQuery | FunnelCorrelationQuery | DatabaseSchemaQuery | RecordingsQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | MetricsHistogramQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | AccountsTableQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallBreakdownQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPModelBreakdownQuery | MCPProtocolVersionBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolCategoryMapQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | MCPMissingCapabilitiesQuery | PropertyValuesQuery;+ query: EventsNode | ActionsNode | PersonsNode | DataWarehouseNode | FunnelsDataWarehouseNode | LifecycleDataWarehouseNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingFingerprintProjectionQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingReleasesQuery | ErrorTrackingIssueCorrelationQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebAgentAnalyticsQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | MarketingAnalyticsAttributionQuery | MarketingAnalyticsAttributionPathsQuery | MarketingAnalyticsRetentionQuery | MarketingAnalyticsSearchQuery | DataVisualizationNode | BIVisualizationNode | DataTableNode | SavedInsightNode | InsightVizNode | TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | PathsV2Query | StickinessQuery | LifecycleQuery | DatabaseSchemaQuery | RecordingsQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | MetricsHistogramQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | AccountsTableQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallBreakdownQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPModelBreakdownQuery | MCPProtocolVersionBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolCategoryMapQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | MCPMissingCapabilitiesQuery | PropertyValuesQuery;}export interface QueryUpgradeResponse {- query: EventsNode | ActionsNode | PersonsNode | DataWarehouseNode | FunnelsDataWarehouseNode | LifecycleDataWarehouseNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingFingerprintProjectionQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingReleasesQuery | ErrorTrackingIssueCorrelationQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebAgentAnalyticsQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | MarketingAnalyticsAttributionQuery | MarketingAnalyticsAttributionPathsQuery | MarketingAnalyticsRetentionQuery | MarketingAnalyticsSearchQuery | DataVisualizationNode | BIVisualizationNode | DataTableNode | SavedInsightNode | InsightVizNode | TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | PathsV2Query | StickinessQuery | LifecycleQuery | FunnelCorrelationQuery | DatabaseSchemaQuery | RecordingsQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | MetricsHistogramQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | AccountsTableQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallBreakdownQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPModelBreakdownQuery | MCPProtocolVersionBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolCategoryMapQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | MCPMissingCapabilitiesQuery | PropertyValuesQuery;+ query: EventsNode | ActionsNode | PersonsNode | DataWarehouseNode | FunnelsDataWarehouseNode | LifecycleDataWarehouseNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingFingerprintProjectionQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingReleasesQuery | ErrorTrackingIssueCorrelationQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebAgentAnalyticsQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | MarketingAnalyticsAttributionQuery | MarketingAnalyticsAttributionPathsQuery | MarketingAnalyticsRetentionQuery | MarketingAnalyticsSearchQuery | DataVisualizationNode | BIVisualizationNode | DataTableNode | SavedInsightNode | InsightVizNode | TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | PathsV2Query | StickinessQuery | LifecycleQuery | DatabaseSchemaQuery | RecordingsQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | MetricsHistogramQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | AccountsTableQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallBreakdownQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPModelBreakdownQuery | MCPProtocolVersionBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolCategoryMapQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | MCPMissingCapabilitiesQuery | PropertyValuesQuery;}export interface QuotaResourceLimit {diff --git a/services/mcp/src/generated/core/api.ts b/services/mcp/src/generated/core/api.tsindex a09d8e24cbe0..8537f5908142 100644--- a/services/mcp/src/generated/core/api.ts+++ b/services/mcp/src/generated/core/api.ts@@ -424,7 +424,6 @@ export const OrganizationsProjectsCreateBody = () => zod.array(zod.string().max(organizationsProjectsCreateBodyPersonDisplayNamePropertiesItemMax)).nullish().describe('Ordered list of person properties used to render a human-friendly display name in the UI.'),- correlation_config: zod.unknown().optional(),autocapture_opt_out: zod.boolean().nullish()@@ -3196,7 +3195,6 @@ export const OrganizationsProjectsPartialUpdateBody = () => zod.array(zod.string().max(organizationsProjectsPartialUpdateBodyPersonDisplayNamePropertiesItemMax)).nullish().describe('Ordered list of person properties used to render a human-friendly display name in the UI.'),- correlation_config: zod.unknown().optional(),autocapture_opt_out: zod.boolean().nullish()diff --git a/services/mcp/src/tools/generated/core.ts b/services/mcp/src/tools/generated/core.tsindex 6189c990b7fe..ba6cbaf080f7 100644--- a/services/mcp/src/tools/generated/core.ts+++ b/services/mcp/src/tools/generated/core.ts@@ -593,7 +593,6 @@ const ProjectCreateSchema = () => {timezone: true,data_attributes: true,person_display_name_properties: true,- correlation_config: true,autocapture_opt_out: true,autocapture_exceptions_opt_in: true,autocapture_web_vitals_opt_in: true,@@ -785,9 +784,6 @@ const projectSettingsUpdate = (): ToolBase<if (params.person_display_name_properties !== undefined) {body['person_display_name_properties'] = params.person_display_name_properties}- if (params.correlation_config !== undefined) {- body['correlation_config'] = params.correlation_config- }if (params.autocapture_opt_out !== undefined) {body['autocapture_opt_out'] = params.autocapture_opt_out}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/project-settings-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/project-settings-update.jsonindex 6aaf789fee8a..ec7c27758d91 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/project-settings-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/project-settings-update.json@@ -318,7 +318,6 @@}]},- "correlation_config": {},"customer_analytics_config": {"properties": {"account_group_type_index": {