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 WHERE
channel IN ("nightly", "beta") channel IN ("nightly", "beta")
OR (channel = "release" AND os != "Windows") OR (channel = "release" AND os != "Windows")
UNION ALL OR (channel = "release" AND
SELECT os = "Windows" AND
* sample_id >= @min_sample_id AND
FROM sample_id <= @max_sample_id)
filtered
WHERE
channel = 'release'
AND os = 'Windows'
AND sample_id >= @min_sample_id
AND sample_id <= @max_sample_id
), ),
{additional_queries} {additional_queries}

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

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

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

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

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

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

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

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

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

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

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

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