Make addons and addon_aggregates exactly replace spark versions (#532)

This commit is contained in:
Daniel Thorn 2019-11-25 13:14:52 -05:00 коммит произвёл GitHub
Родитель 072e4af3b8
Коммит 9468f997ab
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
15 изменённых файлов: 269 добавлений и 197 удалений

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

@ -52,9 +52,6 @@ SKIP = {
"sql/static/fxa_amplitude_export_users_daily/query.sql",
# Syntax error
"sql/telemetry_derived/clients_last_seen_v1/init.sql",
# Unrecognized name: submission_date_s3
"sql/telemetry_derived/addons_v3/query.sql",
"sql/telemetry_derived/addons_aggregates_v3/query.sql",
# HTTP Error 408: Request Time-out
"sql/telemetry_derived/clients_histogram_aggregates_v1/query.sql",
"sql/telemetry_derived/clients_scalar_aggregates_v1/query.sql",

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

@ -0,0 +1,35 @@
SELECT
DATE(submission_timestamp) AS submission_date,
sample_id,
client_id,
normalized_channel,
SUBSTR(application.version, 1, 2) AS app_version,
environment.settings.locale,
COUNTIF(is_self_install) AS n_self_installed_addons,
COUNTIF(key LIKE "%@shield.mozilla%") AS n_shield_addons,
COUNTIF(value.foreign_install > 0) AS n_foreign_installed_addons,
COUNTIF(value.is_system) AS n_system_addons,
COUNTIF(value.is_web_extension) AS n_web_extensions,
MIN(IF(is_self_install, FORMAT_DATE("%Y%m%d", SAFE.DATE_FROM_UNIX_DATE(value.install_day)), NULL)) AS first_addon_install_date,
FORMAT_DATE("%Y%m%d", SAFE.DATE_FROM_UNIX_DATE(MIN(SAFE_CAST(environment.profile.creation_date AS INT64)))) AS profile_creation_date
FROM
telemetry.main,
UNNEST(environment.addons.active_addons),
UNNEST([
key IS NOT NULL
AND NOT value.is_system
AND NOT IFNULL(value.foreign_install, 0) > 0
AND NOT key LIKE '%mozilla%'
AND NOT key LIKE '%cliqz%'
AND NOT key LIKE '%@unified-urlbar%'
]) AS is_self_install
WHERE
client_id IS NOT NULL
AND DATE(submission_timestamp) = @submission_date
GROUP BY
submission_date,
sample_id,
client_id,
normalized_channel,
app_version,
locale

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

@ -1,36 +0,0 @@
SELECT
submission_date_s3 AS submission_date,
sample_id,
client_id,
normalized_channel,
SUBSTR(app_version, 1, 2) AS app_version,
SAFE.PARSE_DATE("%Y-%m-%d 00:00:00",
profile_creation_date) AS profile_creation_date,
locale,
(
SELECT
AS STRUCT --
COUNTIF(is_self_install) AS n_self_installed_addons,
COUNTIF(element.addon_id LIKE "%@shield.mozilla%") AS n_shield_addons,
COUNTIF(element.foreign_install) AS n_foreign_installed_addons,
COUNTIF(element.is_system) AS n_system_addons,
COUNTIF(element.is_web_extension) AS n_web_extensions,
MIN(IF(is_self_install,
SAFE.DATE_FROM_UNIX_DATE(element.install_day),
NULL)) AS first_addon_install_date
FROM (
SELECT
*,
element.addon_id IS NOT NULL
AND NOT element.is_system
AND NOT element.foreign_install
AND NOT element.addon_id LIKE '%mozilla%'
AND NOT element.addon_id LIKE '%cliqz%'
AND NOT element.addon_id LIKE '%@unified-urlbar%' AS is_self_install
FROM
UNNEST(active_addons.list))).*
FROM
clients_daily_v6
WHERE
client_id IS NOT NULL
AND submission_date_s3 = @submission_date

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

@ -0,0 +1,36 @@
SELECT
DATE(submission_timestamp) AS submission_date,
document_id,
client_id,
sample_id,
payload.info.subsession_start_date,
normalized_channel,
key AS addon_id,
value.blocklisted,
value.name,
value.user_disabled > 0 AS user_disabled,
value.app_disabled,
value.version,
value.scope,
value.type,
value.foreign_install > 0 AS foreign_install,
value.has_binary_components,
value.install_day,
value.update_day,
value.signed_state,
value.is_system,
value.is_web_extension,
value.multiprocess_compatible
FROM
telemetry.main,
UNNEST(
IF(
ARRAY_LENGTH(environment.addons.active_addons) > 0,
environment.addons.active_addons,
-- include a null addon if there were none (either null or an empty list)
[environment.addons.active_addons[SAFE_OFFSET(0)]]
)
)
WHERE
client_id IS NOT NULL
AND DATE(submission_timestamp) = @submission_date

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

@ -1,14 +0,0 @@
SELECT
submission_date_s3 AS submission_date,
document_id,
client_id,
sample_id,
subsession_start_date,
normalized_channel,
_addon.element.*
FROM
main_summary_v4,
UNNEST(active_addons.list) AS _addon
WHERE
client_id IS NOT NULL
AND submission_date_s3 = @submission_date

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

@ -0,0 +1,35 @@
SELECT
DATE(submission_timestamp) AS submission_date,
sample_id,
client_id,
normalized_channel,
SUBSTR(application.version, 1, 2) AS app_version,
environment.settings.locale,
COUNTIF(is_self_install) AS n_self_installed_addons,
COUNTIF(key LIKE "%@shield.mozilla%") AS n_shield_addons,
COUNTIF(value.foreign_install > 0) AS n_foreign_installed_addons,
COUNTIF(value.is_system) AS n_system_addons,
COUNTIF(value.is_web_extension) AS n_web_extensions,
MIN(IF(is_self_install, FORMAT_DATE("%Y%m%d", SAFE.DATE_FROM_UNIX_DATE(value.install_day)), NULL)) AS first_addon_install_date,
FORMAT_DATE("%Y%m%d", SAFE.DATE_FROM_UNIX_DATE(MIN(SAFE_CAST(environment.profile.creation_date AS INT64)))) AS profile_creation_date
FROM
telemetry.main,
UNNEST(environment.addons.active_addons),
UNNEST([
key IS NOT NULL
AND NOT value.is_system
AND NOT IFNULL(value.foreign_install, 0) > 0
AND NOT key LIKE '%mozilla%'
AND NOT key LIKE '%cliqz%'
AND NOT key LIKE '%@unified-urlbar%'
]) AS is_self_install
WHERE
client_id IS NOT NULL
AND DATE(submission_timestamp) = @submission_date
GROUP BY
submission_date,
sample_id,
client_id,
normalized_channel,
app_version,
locale

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

@ -1,36 +0,0 @@
SELECT
submission_date_s3 AS submission_date,
sample_id,
client_id,
normalized_channel,
SUBSTR(app_version, 1, 2) AS app_version,
SAFE.PARSE_DATE("%Y-%m-%d 00:00:00",
profile_creation_date) AS profile_creation_date,
locale,
(
SELECT
AS STRUCT --
COUNTIF(is_self_install) AS n_self_installed_addons,
COUNTIF(element.addon_id LIKE "%@shield.mozilla%") AS n_shield_addons,
COUNTIF(element.foreign_install) AS n_foreign_installed_addons,
COUNTIF(element.is_system) AS n_system_addons,
COUNTIF(element.is_web_extension) AS n_web_extensions,
MIN(IF(is_self_install,
SAFE.DATE_FROM_UNIX_DATE(element.install_day),
NULL)) AS first_addon_install_date
FROM (
SELECT
*,
element.addon_id IS NOT NULL
AND NOT element.is_system
AND NOT element.foreign_install
AND NOT element.addon_id LIKE '%mozilla%'
AND NOT element.addon_id LIKE '%cliqz%'
AND NOT element.addon_id LIKE '%@unified-urlbar%' AS is_self_install
FROM
UNNEST(active_addons.list))).*
FROM
clients_daily_v6
WHERE
client_id IS NOT NULL
AND submission_date_s3 = @submission_date

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

@ -0,0 +1,36 @@
SELECT
DATE(submission_timestamp) AS submission_date,
document_id,
client_id,
sample_id,
payload.info.subsession_start_date,
normalized_channel,
key AS addon_id,
value.blocklisted,
value.name,
value.user_disabled > 0 AS user_disabled,
value.app_disabled,
value.version,
value.scope,
value.type,
value.foreign_install > 0 AS foreign_install,
value.has_binary_components,
value.install_day,
value.update_day,
value.signed_state,
value.is_system,
value.is_web_extension,
value.multiprocess_compatible
FROM
telemetry.main,
UNNEST(
IF(
ARRAY_LENGTH(environment.addons.active_addons) > 0,
environment.addons.active_addons,
-- include a null addon if there were none (either null or an empty list)
[environment.addons.active_addons[SAFE_OFFSET(0)]]
)
)
WHERE
client_id IS NOT NULL
AND DATE(submission_timestamp) = @submission_date

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

@ -1,14 +0,0 @@
SELECT
submission_date_s3 AS submission_date,
document_id,
client_id,
sample_id,
subsession_start_date,
normalized_channel,
_addon.element.*
FROM
main_summary_v4,
UNNEST(active_addons.list) AS _addon
WHERE
client_id IS NOT NULL
AND submission_date_s3 = @submission_date

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

@ -1,5 +1,5 @@
{"submission_date": "2019-04-01", "sample_id": 1, "client_id": "a", "n_self_installed_addons": 1, "n_shield_addons": 0, "n_foreign_installed_addons": 0, "n_system_addons": 0, "n_web_extensions": 0, "first_addon_install_date": "2016-07-18", "profile_creation_date": "2017-08-12"}
{"submission_date": "2019-04-01", "sample_id": 1, "client_id": "b", "n_self_installed_addons": 1, "n_shield_addons": 0, "n_foreign_installed_addons": 0, "n_system_addons": 1, "n_web_extensions": 0, "first_addon_install_date": "2016-07-23", "profile_creation_date": "2017-05-02"}
{"submission_date": "2019-04-01", "sample_id": 1, "client_id": "c", "n_self_installed_addons": 1, "n_shield_addons": 0, "n_foreign_installed_addons": 1, "n_system_addons": 0, "n_web_extensions": 0, "first_addon_install_date": "2016-07-18", "profile_creation_date": "2016-06-05"}
{"submission_date": "2019-04-01", "sample_id": 1, "client_id": "d", "n_self_installed_addons": 2, "n_shield_addons": 0, "n_foreign_installed_addons": 0, "n_system_addons": 0, "n_web_extensions": 1, "first_addon_install_date": "2016-07-17", "profile_creation_date": "2015-04-15"}
{"submission_date": "2019-04-01", "sample_id": 1, "client_id": "e", "n_self_installed_addons": 1, "n_shield_addons": 0, "n_foreign_installed_addons": 1, "n_system_addons": 1, "n_web_extensions": 1, "first_addon_install_date": "2016-07-23", "profile_creation_date": "2016-07-01"}
{"submission_date": "2019-04-01", "sample_id": 1, "client_id": "a", "n_self_installed_addons": 2, "n_shield_addons": 0, "n_foreign_installed_addons": 0, "n_system_addons": 0, "n_web_extensions": 0, "first_addon_install_date": "20160718", "profile_creation_date": "20170812"}
{"submission_date": "2019-04-01", "sample_id": 1, "client_id": "b", "n_self_installed_addons": 1, "n_shield_addons": 0, "n_foreign_installed_addons": 0, "n_system_addons": 1, "n_web_extensions": 0, "first_addon_install_date": "20160723", "profile_creation_date": "20170502"}
{"submission_date": "2019-04-01", "sample_id": 1, "client_id": "c", "n_self_installed_addons": 1, "n_shield_addons": 0, "n_foreign_installed_addons": 1, "n_system_addons": 0, "n_web_extensions": 0, "first_addon_install_date": "20160718", "profile_creation_date": "20160605"}
{"submission_date": "2019-04-01", "sample_id": 1, "client_id": "d", "n_self_installed_addons": 2, "n_shield_addons": 0, "n_foreign_installed_addons": 0, "n_system_addons": 0, "n_web_extensions": 1, "first_addon_install_date": "20160717", "profile_creation_date": "20150415"}
{"submission_date": "2019-04-01", "sample_id": 1, "client_id": "e", "n_self_installed_addons": 1, "n_shield_addons": 0, "n_foreign_installed_addons": 1, "n_system_addons": 1, "n_web_extensions": 1, "first_addon_install_date": "20160723", "profile_creation_date": "20160701"}

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

@ -0,0 +1,5 @@
{"client_id":"a","sample_id":1,"submission_timestamp":"2019-04-01 00:00","environment":{"addons":{"active_addons":[{"key":"foo","value":{"is_web_extension":false,"is_system":false,"install_day":17000,"foreign_install":0}},{"key":"baz","value":{"is_web_extension":false,"is_system":null,"install_day":17001,"foreign_install":0}},{"key":"boz","value":{"is_web_extension":false,"is_system":false,"install_day":17003,"foreign_install":null}}]},"profile":{"creation_date":17390.0}}}
{"client_id":"b","sample_id":1,"submission_timestamp":"2019-04-01 00:00","environment":{"addons":{"active_addons":[{"key":"foo","value":{"is_web_extension":false,"is_system":true,"install_day":17004,"foreign_install":0}},{"key":"baz","value":{"is_web_extension":null,"is_system":false,"install_day":17005,"foreign_install":0}}]},"profile":{"creation_date":17288.0}}}
{"client_id":"c","sample_id":1,"submission_timestamp":"2019-04-01 00:00","environment":{"addons":{"active_addons":[{"key":"foo","value":{"is_web_extension":false,"is_system":false,"install_day":17000,"foreign_install":1}},{"key":"baz","value":{"is_web_extension":false,"is_system":false,"install_day":17000,"foreign_install":0}}]},"profile":{"creation_date":16957.0}}}
{"client_id":"d","sample_id":1,"submission_timestamp":"2019-04-01 00:00","environment":{"addons":{"active_addons":[{"key":"foo","value":{"is_web_extension":true,"is_system":false,"install_day":17001,"foreign_install":0}},{"key":"baz","value":{"is_web_extension":null,"is_system":false,"install_day":16999,"foreign_install":0}}]},"profile":{"creation_date":16540.0}}}
{"client_id":"e","sample_id":1,"submission_timestamp":"2019-04-01 00:00","environment":{"addons":{"active_addons":[{"key":"mozilla-foo","value":{"is_web_extension":true,"is_system":false,"install_day":17000,"foreign_install":0}},{"key":"cliqz-baz","value":{"is_web_extension":false,"is_system":false,"install_day":17001,"foreign_install":0}},{"key":"boz@unified-urlbar","value":{"is_web_extension":false,"is_system":false,"install_day":17002,"foreign_install":0}},{"key":"baz","value":{"is_web_extension":false,"is_system":true,"install_day":17003,"foreign_install":0}},{"key":"foo","value":{"is_web_extension":false,"is_system":false,"install_day":17004,"foreign_install":1}},{"key":"boz","value":{"is_web_extension":false,"is_system":false,"install_day":17005,"foreign_install":0}}]},"profile":{"creation_date":16983.0}}}

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

@ -0,0 +1,117 @@
[
{
"name": "submission_timestamp",
"type": "TIMESTAMP",
"mode": "REQUIRED",
"description": "time_partitioning_field"
},
{
"name": "client_id",
"type": "STRING",
"mode": "NULLABLE"
},
{
"name": "normalized_channel",
"type": "STRING",
"mode": "NULLABLE"
},
{
"name": "application",
"type": "RECORD",
"mode": "NULLABLE",
"fields": [
{
"name": "version",
"type": "STRING",
"mode": "NULLABLE"
}
]
},
{
"name": "sample_id",
"type": "INT64",
"mode": "NULLABLE"
},
{
"name": "environment",
"type": "RECORD",
"mode": "NULLABLE",
"fields": [
{
"name": "addons",
"type": "RECORD",
"mode": "NULLABLE",
"fields": [
{
"name": "active_addons",
"type": "RECORD",
"mode": "REPEATED",
"fields": [
{
"name": "key",
"type": "STRING",
"mode": "NULLABLE"
},
{
"name": "value",
"type": "RECORD",
"mode": "NULLABLE",
"fields": [
{
"name": "is_system",
"type": "BOOL",
"mode": "NULLABLE"
},
{
"name": "foreign_install",
"type": "INT64",
"mode": "NULLABLE"
},
{
"name": "addon_id",
"type": "STRING",
"mode": "NULLABLE"
},
{
"name": "is_web_extension",
"type": "BOOL",
"mode": "NULLABLE"
},
{
"name": "install_day",
"type": "INT64",
"mode": "NULLABLE"
}
]
}
]
}
]
},
{
"name": "settings",
"type": "RECORD",
"mode": "NULLABLE",
"fields": [
{
"name": "locale",
"type": "STRING",
"mode": "NULLABLE"
}
]
},
{
"name": "profile",
"type": "RECORD",
"mode": "NULLABLE",
"fields": [
{
"name": "creation_date",
"type": "FLOAT64",
"mode": "NULLABLE"
}
]
}
]
}
]

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

@ -1,5 +0,0 @@
{"client_id": "a", "sample_id": 1, "submission_date_s3": "2019-04-01", "active_addons": {"list": [{"element": {"addon_id": "foo", "is_web_extension": false, "is_system": false, "install_day": 17000, "foreign_install": false}}, {"element": {"addon_id": "baz", "is_web_extension": false, "is_system": null, "install_day": 17001, "foreign_install": false}}, {"element": {"addon_id": "boz", "is_web_extension": false, "is_system": false, "install_day": 17003, "foreign_install": null}}]}, "profile_creation_date": "2017-08-12 00:00:00"}
{"client_id": "b", "sample_id": 1, "submission_date_s3": "2019-04-01", "active_addons": {"list": [{"element": {"addon_id": "foo", "is_web_extension": false, "is_system": true, "install_day": 17004, "foreign_install": false}}, {"element": {"addon_id": "baz", "is_web_extension": null, "is_system": false, "install_day": 17005, "foreign_install": false}}]}, "profile_creation_date": "2017-05-02 00:00:00"}
{"client_id": "c", "sample_id": 1, "submission_date_s3": "2019-04-01", "active_addons": {"list": [{"element": {"addon_id": "foo", "is_web_extension": false, "is_system": false, "install_day": 17000, "foreign_install": true}}, {"element": {"addon_id": "baz", "is_web_extension": false, "is_system": false, "install_day": 17000, "foreign_install": false}}]}, "profile_creation_date": "2016-06-05 00:00:00"}
{"client_id": "d", "sample_id": 1, "submission_date_s3": "2019-04-01", "active_addons": {"list": [{"element": {"addon_id": "foo", "is_web_extension": true, "is_system": false, "install_day": 17001, "foreign_install": false}}, {"element": {"addon_id": "baz", "is_web_extension": null, "is_system": false, "install_day": 16999, "foreign_install": false}}]}, "profile_creation_date": "2015-04-15 00:00:00"}
{"client_id": "e", "sample_id": 1, "submission_date_s3": "2019-04-01", "active_addons": {"list": [{"element": {"addon_id": "mozilla-foo", "is_web_extension": true, "is_system": false, "install_day": 17000, "foreign_install": false}}, {"element": {"addon_id": "cliqz-baz", "is_web_extension": false, "is_system": false, "install_day": 17001, "foreign_install": false}}, {"element": {"addon_id": "boz@unified-urlbar", "is_web_extension": false, "is_system": false, "install_day": 17002, "foreign_install": false}}, {"element": {"addon_id": "baz", "is_web_extension": false, "is_system": true, "install_day": 17003, "foreign_install": false}}, {"element": {"addon_id": "foo", "is_web_extension": false, "is_system": false, "install_day": 17004, "foreign_install": true}}, {"element": {"addon_id": "boz", "is_web_extension": false, "is_system": false, "install_day": 17005, "foreign_install": false}}]}, "profile_creation_date": "2016-07-01 00:00:00"}

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

@ -1,84 +0,0 @@
[
{
"name": "submission_date_s3",
"type": "DATE",
"mode": "REQUIRED",
"description": "time_partitioning_field"
},
{
"name": "client_id",
"type": "STRING",
"mode": "NULLABLE"
},
{
"name": "normalized_channel",
"type": "STRING",
"mode": "NULLABLE"
},
{
"name": "app_version",
"type": "STRING",
"mode": "NULLABLE"
},
{
"name": "locale",
"type": "STRING",
"mode": "NULLABLE"
},
{
"name": "sample_id",
"type": "INT64",
"mode": "NULLABLE"
},
{
"name": "active_addons",
"type": "RECORD",
"mode": "NULLABLE",
"fields": [
{
"name": "list",
"type": "RECORD",
"mode": "REPEATED",
"fields": [
{
"name": "element",
"type": "RECORD",
"mode": "NULLABLE",
"fields": [
{
"name": "is_system",
"type": "BOOL",
"mode": "NULLABLE"
},
{
"name": "foreign_install",
"type": "BOOL",
"mode": "NULLABLE"
},
{
"name": "addon_id",
"type": "STRING",
"mode": "NULLABLE"
},
{
"name": "is_web_extension",
"type": "BOOL",
"mode": "NULLABLE"
},
{
"name": "install_day",
"type": "INT64",
"mode": "NULLABLE"
}
]
}
]
}
]
},
{
"name": "profile_creation_date",
"type": "STRING",
"mode": "NULLABLE"
}
]