Allow specifying an event property to narrow down event funnels (fixes #271) (#278)

This PR allows you to specify a single property name and value for
events in the funnel analysis explore. This covers most of the current
set of events for Firefox for Android.

https://mozilla-hub.atlassian.net/browse/DS-1776
This commit is contained in:
Will Lachance 2021-10-21 10:47:13 -04:00 коммит произвёл GitHub
Родитель f40a825159
Коммит 0207077d86
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 18 добавлений и 8 удалений

Просмотреть файл

@ -157,13 +157,17 @@ class FunnelAnalysisView(View):
"sql": (
"SELECT "
"mozfun.event_analysis.aggregate_match_strings( "
"ARRAY_AGG( "
"mozfun.event_analysis.event_index_to_match_string(index))) AS match_string "
"ARRAY_AGG( CONCAT(mozfun.event_analysis.escape_metachars(property_value.value),"
"mozfun.event_analysis.event_index_to_match_string(et.index)))) AS match_string "
"FROM "
f"{self.tables[0]['event_types']} "
f"{self.tables[0]['event_types']} as et "
"CROSS JOIN UNNEST(event_properties) AS properties "
"CROSS JOIN UNNEST(properties.value) AS property_value "
"WHERE "
"{% condition category %} category {% endcondition %} "
"AND {% condition event %} event {% endcondition %}"
"AND {% condition event %} event {% endcondition %} "
"AND {% condition property_name %} properties.key {% endcondition %} "
"AND {% condition property_value %} property_value.key {% endcondition %}"
)
},
"filters": [
@ -221,6 +225,7 @@ class FunnelAnalysisView(View):
" event, "
" property.key AS property_name, "
" property_value.key AS property_value, "
" property_value.index as property_index "
f"FROM {self.tables[0]['event_types']} "
"LEFT JOIN UNNEST(event_properties) AS property "
"LEFT JOIN UNNEST(property.value) AS property_value "

Просмотреть файл

@ -165,13 +165,17 @@ def test_view_lookml(funnel_analysis_view):
"sql": (
"SELECT "
"mozfun.event_analysis.aggregate_match_strings( "
"ARRAY_AGG( "
"mozfun.event_analysis.event_index_to_match_string(index))) AS match_string "
"ARRAY_AGG( CONCAT(mozfun.event_analysis.escape_metachars(property_value.value),"
"mozfun.event_analysis.event_index_to_match_string(et.index)))) AS match_string "
"FROM "
"`mozdata.glean_app.event_types` "
"`mozdata.glean_app.event_types` as et "
"CROSS JOIN UNNEST(event_properties) AS properties "
"CROSS JOIN UNNEST(properties.value) AS property_value "
"WHERE "
"{% condition category %} category {% endcondition %} "
"AND {% condition event %} event {% endcondition %}"
"AND {% condition event %} event {% endcondition %} "
"AND {% condition property_name %} properties.key {% endcondition %} "
"AND {% condition property_value %} property_value.key {% endcondition %}"
)
},
"filters": [
@ -228,6 +232,7 @@ def test_view_lookml(funnel_analysis_view):
" event, "
" property.key AS property_name, "
" property_value.key AS property_value, "
" property_value.index as property_index "
"FROM `mozdata.glean_app.event_types` "
"LEFT JOIN UNNEST(event_properties) AS property "
"LEFT JOIN UNNEST(property.value) AS property_value "