From 0969a51673b4e20aa9e90096ee2231d64f2d6731 Mon Sep 17 00:00:00 2001 From: Jeff Klukas Date: Mon, 3 Aug 2020 09:38:02 -0400 Subject: [PATCH] Include sample_id in feature_usage (#1201) Used as clustering key and allows sampling --- sql/telemetry_derived/feature_usage_v1/query.sql | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sql/telemetry_derived/feature_usage_v1/query.sql b/sql/telemetry_derived/feature_usage_v1/query.sql index 3706064107..7a05c0e76b 100644 --- a/sql/telemetry_derived/feature_usage_v1/query.sql +++ b/sql/telemetry_derived/feature_usage_v1/query.sql @@ -1,7 +1,8 @@ WITH events_t AS ( SELECT - client_id, submission_date, + sample_id, + client_id, LOGICAL_OR( event_method = 'show' AND event_object = 'protection_report' @@ -13,12 +14,14 @@ WITH events_t AS ( submission_date = @submission_date GROUP BY submission_date, + sample_id, client_id ), main_t AS ( SELECT - client_id, DATE(submission_timestamp) AS submission_date, + sample_id, + client_id, SUM( payload.processes.parent.scalars.browser_engagement_max_concurrent_tab_pinned_count ) > 0 AS has_pinned_tab, @@ -65,11 +68,13 @@ main_t AS ( DATE(submission_timestamp) = @submission_date GROUP BY submission_date, + sample_id, client_id ) SELECT - client_id, submission_date, + sample_id, + client_id, COALESCE(viewed_protection_report, FALSE) AS viewed_protection_report, COALESCE(has_pinned_tab, FALSE) AS has_pinned_tab, COALESCE(default_browser, FALSE) AS default_browser, @@ -83,4 +88,4 @@ FROM FULL JOIN main_t USING - (client_id, submission_date) + (submission_date, sample_id, client_id)