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
|
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 (
|
||||||
|
|
Загрузка…
Ссылка в новой задаче