Update sampling portion of query to be more concise.

This commit is contained in:
Marina Samuel 2020-04-07 16:03:11 -04:00
Родитель 57377f6b68
Коммит 2a62e9fc99
7 изменённых файлов: 38 добавлений и 69 удалений

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

@ -119,16 +119,10 @@ def generate_sql(opts, additional_queries, windowed_clause, select_clause, json_
WHERE
channel IN ("nightly", "beta")
OR (channel = "release" AND os != "Windows")
UNION ALL
SELECT
*
FROM
filtered
WHERE
channel = 'release'
AND os = 'Windows'
AND sample_id >= @min_sample_id
AND sample_id <= @max_sample_id
OR (channel = "release" AND
os = "Windows" AND
sample_id >= @min_sample_id AND
sample_id <= @max_sample_id)
),
{additional_queries}

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

@ -101,16 +101,12 @@ sampled_data AS (
WHERE
channel IN ("nightly", "beta")
OR (channel = "release" AND os != "Windows")
UNION ALL
SELECT
*
FROM
filtered
WHERE
channel = 'release'
AND os = 'Windows'
AND sample_id >= @min_sample_id
AND sample_id <= @max_sample_id
OR (
channel = "release"
AND os = "Windows"
AND sample_id >= @min_sample_id
AND sample_id <= @max_sample_id
)
),
histograms AS (
SELECT

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

@ -88,16 +88,12 @@ sampled_data AS (
WHERE
channel IN ("nightly", "beta")
OR (channel = "release" AND os != "Windows")
UNION ALL
SELECT
*
FROM
flattened_metrics
WHERE
channel = 'release'
AND os = 'Windows'
AND sample_id >= @min_sample_id
AND sample_id <= @max_sample_id
OR (
channel = "release"
AND os = "Windows"
AND sample_id >= @min_sample_id
AND sample_id <= @max_sample_id
)
),
-- Using `min` for when `agg_type` is `count` returns null when all rows are null
aggregated AS (

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

@ -101,16 +101,12 @@ sampled_data AS (
WHERE
channel IN ("nightly", "beta")
OR (channel = "release" AND os != "Windows")
UNION ALL
SELECT
*
FROM
filtered
WHERE
channel = 'release'
AND os = 'Windows'
AND sample_id >= @min_sample_id
AND sample_id <= @max_sample_id
OR (
channel = "release"
AND os = "Windows"
AND sample_id >= @min_sample_id
AND sample_id <= @max_sample_id
)
),
grouped_metrics AS (
SELECT

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

@ -354,16 +354,12 @@ sampled_data AS (
WHERE
channel IN ("nightly", "beta")
OR (channel = "release" AND os != "Windows")
UNION ALL
SELECT
*
FROM
flattened_metrics
WHERE
channel = 'release'
AND os = 'Windows'
AND sample_id >= @min_sample_id
AND sample_id <= @max_sample_id
OR (
channel = "release"
AND os = "Windows"
AND sample_id >= @min_sample_id
AND sample_id <= @max_sample_id
)
),
-- Using `min` for when `agg_type` is `count` returns null when all rows are null
aggregated AS (

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

@ -73,15 +73,10 @@ def generate_sql(
FROM {querying_table}
WHERE channel IN ("nightly", "beta")
OR (channel = "release" AND os != "Windows")
UNION ALL
SELECT *
FROM {querying_table}
WHERE channel = 'release'
AND os = 'Windows'
AND sample_id >= @min_sample_id
AND sample_id <= @max_sample_id
OR (channel = "release" AND
os = "Windows" AND
sample_id >= @min_sample_id AND
sample_id <= @max_sample_id)
),
-- Using `min` for when `agg_type` is `count` returns null when all rows are null

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

@ -23,16 +23,12 @@ sampled_data AS (
WHERE
channel IN ("nightly", "beta")
OR (channel = "release" AND os != "Windows")
UNION ALL
SELECT
*
FROM
filtered
WHERE
channel = 'release'
AND os = 'Windows'
AND sample_id >= @min_sample_id
AND sample_id <= @max_sample_id
OR (
channel = "release"
AND os = "Windows"
AND sample_id >= @min_sample_id
AND sample_id <= @max_sample_id
)
),
-- Using `min` for when `agg_type` is `count` returns null when all rows are null
aggregated AS (