Skip to content

fix(): usage reporting first seen duplicates #7455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@ WITH
@submission_date AS first_seen_date,
{% endif %}
{% endraw %}
app_channel,
IFNULL(app_channel, "") AS app_channel,
FROM
`{{ project_id }}.{{ channel_dataset }}.usage_reporting_clients_daily`
WHERE
usage_profile_id IS NOT NULL
{% raw %}
{% if is_init() %}
{% raw %}
{% if is_init() %}
AND submission_date > "2014-10-10"
{% else %}
AND submission_date = @submission_date
{% endif %}
{% endraw %}
GROUP BY
usage_profile_id,
app_channel
{% else %}
AND submission_date = @submission_date
{% endif %}
{% endraw %}
),
_previous AS (
SELECT
usage_profile_id,
app_channel,
IFNULL(app_channel, "") AS app_channel,
FROM
`{{ project_id }}.{{ channel_dataset }}_derived.{{ view_name }}_v1`
WHERE
Expand All @@ -45,7 +45,7 @@ _previous AS (
SELECT
first_seen_date,
usage_profile_id,
app_channel,
NULLIF(app_channel, "") AS app_channel,
FROM
_current
LEFT JOIN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ fields:
name: app_channel
type: STRING
description: |
The channel the application is being distributed on.
The channel the application is being distributed on, on mobile this is expected to be mostly null.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
WITH _current AS (
SELECT
usage_profile_id,
app_channel,
IFNULL(app_channel, "") AS app_channel,
-- The rightmost bit in 'days_since_seen' represents whether the user sent a usage_reporting ping on the submission_date.
CAST(TRUE AS INT64) AS days_seen_bits,
-- The rightmost bit in days_active_bits represents whether the user counts as active on the submission_date.
Expand All @@ -20,7 +20,7 @@ WITH _current AS (
_previous AS (
SELECT
usage_profile_id,
app_channel,
IFNULL(app_channel, "") AS app_channel,
days_seen_bits,
days_active_bits,
days_created_profile_bits,
Expand All @@ -45,10 +45,11 @@ SELECT
udf.combine_adjacent_days_28_bits(
_previous.days_created_profile_bits,
_current.days_created_profile_bits
) AS days_created_profile_bits
) AS days_created_profile_bits,
NULLIF(app_channel, "") AS app_channel
)
FROM
_current
FULL JOIN
_previous
USING (usage_profile_id)
USING (usage_profile_id, app_channel)