From 44399cd7afd5c905d86e3959a1c92e6bfb3e25fc Mon Sep 17 00:00:00 2001 From: Nan Jiang Date: Wed, 8 Jun 2022 13:52:41 -0400 Subject: [PATCH] Bug 1757768: add match_type to contextual services derived dataset (#2897) * Bug 1757768: add match_type to contextual services derived dataset * f test --- .../event_aggregates_v1/init.sql | 1 + .../event_aggregates_v1/query.sql | 15 ++++++++++++++- .../contextual_services.quicksuggest_click.yaml | 1 + ...ntextual_services.quicksuggest_impression.yaml | 1 + .../test_aggregation/expect.yaml | 8 ++++++++ .../contextual_services.quicksuggest_click.yaml | 1 + ...ntextual_services.quicksuggest_impression.yaml | 1 + .../test_overactive_filter/expect.yaml | 7 +++++++ 8 files changed, 34 insertions(+), 1 deletion(-) diff --git a/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/init.sql b/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/init.sql index e1396b56d7..a6fd163eff 100644 --- a/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/init.sql +++ b/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/init.sql @@ -20,3 +20,4 @@ SELECT CAST(NULL AS INT64) AS position, CAST(NULL AS INT64) AS event_count, CAST(NULL AS INT64) AS user_count, + CAST(NULL AS STRING) AS match_type, diff --git a/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/query.sql b/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/query.sql index 63eb41ce79..18621f8c3d 100644 --- a/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/query.sql +++ b/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/query.sql @@ -19,6 +19,7 @@ WITH combined AS ( 'merino' END AS provider, + match_type, FROM contextual_services.quicksuggest_impression UNION ALL @@ -42,6 +43,7 @@ WITH combined AS ( 'merino' END AS provider, + match_type, FROM contextual_services.quicksuggest_click UNION ALL @@ -65,6 +67,8 @@ WITH combined AS ( 'contile' END AS provider, + -- `match_type` is only available for `quicksuggest_*` tables + NULL AS match_type, FROM contextual_services.topsites_impression UNION ALL @@ -88,6 +92,8 @@ WITH combined AS ( 'contile' END AS provider, + -- `match_type` is only available for `quicksuggest_*` tables + NULL AS match_type, FROM contextual_services.topsites_click UNION ALL @@ -115,6 +121,8 @@ WITH combined AS ( 'contile' END AS provider, + -- `match_type` is only available for `quicksuggest_*` tables + NULL AS match_type, FROM org_mozilla_firefox.topsites_impression UNION ALL @@ -140,6 +148,8 @@ WITH combined AS ( 'contile' END AS provider, + -- `match_type` is only available for `quicksuggest_*` tables + NULL AS match_type, FROM org_mozilla_firefox_beta.topsites_impression UNION ALL @@ -165,6 +175,8 @@ WITH combined AS ( 'contile' END AS provider, + -- `match_type` is only available for `quicksuggest_*` tables + NULL AS match_type, FROM org_mozilla_fenix.topsites_impression ), @@ -204,4 +216,5 @@ GROUP BY advertiser, release_channel, position, - provider + provider, + match_type diff --git a/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_aggregation/contextual_services.quicksuggest_click.yaml b/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_aggregation/contextual_services.quicksuggest_click.yaml index cde639a3ef..25267fddb3 100644 --- a/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_aggregation/contextual_services.quicksuggest_click.yaml +++ b/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_aggregation/contextual_services.quicksuggest_click.yaml @@ -9,3 +9,4 @@ release_channel: release position: 1 request_id: "HASH123" + match_type: "firefox-suggest" diff --git a/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_aggregation/contextual_services.quicksuggest_impression.yaml b/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_aggregation/contextual_services.quicksuggest_impression.yaml index cde639a3ef..25267fddb3 100644 --- a/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_aggregation/contextual_services.quicksuggest_impression.yaml +++ b/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_aggregation/contextual_services.quicksuggest_impression.yaml @@ -9,3 +9,4 @@ release_channel: release position: 1 request_id: "HASH123" + match_type: "firefox-suggest" diff --git a/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_aggregation/expect.yaml b/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_aggregation/expect.yaml index 2d7398b916..4e2406c746 100644 --- a/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_aggregation/expect.yaml +++ b/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_aggregation/expect.yaml @@ -9,27 +9,32 @@ subdivision1: AZ advertiser: ad1 release_channel: release + match_type: "firefox-suggest" position: 1 event_count: 1 user_count: 1 - <<: *base source: suggest event_type: click + match_type: "firefox-suggest" - <<: *base source: topsites provider: contile event_type: click + match_type: null - <<: *base source: topsites provider: contile event_type: impression event_count: 3 user_count: 2 + match_type: null - <<: *base source: topsites provider: contile event_type: impression advertiser: ad2 + match_type: null - &base_mobile submission_date: "2020-01-01" source: topsites @@ -40,10 +45,13 @@ subdivision1: NY advertiser: ad3 release_channel: release + match_type: null position: 1 event_count: 1 user_count: 1 - <<: *base_mobile release_channel: beta + match_type: null - <<: *base_mobile release_channel: nightly + match_type: null diff --git a/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_overactive_filter/contextual_services.quicksuggest_click.yaml b/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_overactive_filter/contextual_services.quicksuggest_click.yaml index c2747e5736..93753681cc 100644 --- a/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_overactive_filter/contextual_services.quicksuggest_click.yaml +++ b/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_overactive_filter/contextual_services.quicksuggest_click.yaml @@ -10,6 +10,7 @@ release_channel: release position: 1 request_id: "HASH123" + match_type: "firefox-suggest" - <<: *base context_id: b - <<: *base diff --git a/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_overactive_filter/contextual_services.quicksuggest_impression.yaml b/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_overactive_filter/contextual_services.quicksuggest_impression.yaml index c2747e5736..93753681cc 100644 --- a/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_overactive_filter/contextual_services.quicksuggest_impression.yaml +++ b/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_overactive_filter/contextual_services.quicksuggest_impression.yaml @@ -10,6 +10,7 @@ release_channel: release position: 1 request_id: "HASH123" + match_type: "firefox-suggest" - <<: *base context_id: b - <<: *base diff --git a/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_overactive_filter/expect.yaml b/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_overactive_filter/expect.yaml index 1b92a8603c..879a5d5c0c 100644 --- a/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_overactive_filter/expect.yaml +++ b/tests/sql/moz-fx-data-shared-prod/contextual_services_derived/event_aggregates_v1/test_overactive_filter/expect.yaml @@ -9,6 +9,7 @@ subdivision1: AZ advertiser: ad1 release_channel: release + match_type: "firefox-suggest" position: 1 event_count: 52 user_count: 2 @@ -16,17 +17,20 @@ source: topsites provider: contile event_type: impression + match_type: null event_count: 52 user_count: 2 - <<: *base source: suggest event_type: click + match_type: "firefox-suggest" event_count: 1 user_count: 1 - <<: *base source: topsites provider: contile event_type: click + match_type: null event_count: 1 user_count: 1 - &base_mobile @@ -39,10 +43,13 @@ subdivision1: NY advertiser: ad3 release_channel: release + match_type: null position: 1 event_count: 1 user_count: 1 - <<: *base_mobile release_channel: beta + match_type: null - <<: *base_mobile release_channel: nightly + match_type: null