Update sampling portion of query to be more concise.
This commit is contained in:
Родитель
57377f6b68
Коммит
2a62e9fc99
|
@ -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 (
|
||||
|
|
Загрузка…
Ссылка в новой задаче