Skip to content
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

fix: skim some functionality #1130

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
81 changes: 1 addition & 80 deletions src/queries/rum-experiments.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
--- timezone: UTC
--- experiment: -
--- conversioncheckpoint: click
--- sources: -
--- targets: -
--- threshold: 500
--- domainkey: secret

Expand Down Expand Up @@ -73,70 +71,7 @@ experiment_checkpoints AS (
id
),

source_target_converted_checkpoints AS (
SELECT
all_checkpoints.id AS id,
ANY_VALUE(experiment_checkpoints.source) AS source,
ANY_VALUE(experiment_checkpoints.target) AS target,
ANY_VALUE(all_checkpoints.pageviews) AS pageviews
FROM experiment_checkpoints INNER JOIN all_checkpoints
ON experiment_checkpoints.id = all_checkpoints.id
WHERE
all_checkpoints.checkpoint = @conversioncheckpoint
AND EXISTS (
SELECT 1
FROM
UNNEST(SPLIT(@sources, ',')) AS prefix
WHERE all_checkpoints.source LIKE CONCAT(TRIM(prefix), '%')
)
AND EXISTS (
SELECT 1
FROM
UNNEST(SPLIT(@targets, ',')) AS prefix
WHERE all_checkpoints.target LIKE CONCAT(TRIM(prefix), '%')
)
GROUP BY all_checkpoints.id
),

source_converted_checkpoints AS (
SELECT
all_checkpoints.id AS id,
ANY_VALUE(experiment_checkpoints.source) AS source,
ANY_VALUE(experiment_checkpoints.target) AS target,
ANY_VALUE(all_checkpoints.pageviews) AS pageviews
FROM experiment_checkpoints INNER JOIN all_checkpoints
ON experiment_checkpoints.id = all_checkpoints.id
WHERE
all_checkpoints.checkpoint = @conversioncheckpoint
AND EXISTS (
SELECT 1
FROM
UNNEST(SPLIT(@sources, ',')) AS prefix
WHERE all_checkpoints.source LIKE CONCAT(TRIM(prefix), '%')
)
GROUP BY all_checkpoints.id
),

target_converted_checkpoints AS (
SELECT
all_checkpoints.id AS id,
ANY_VALUE(experiment_checkpoints.source) AS source,
ANY_VALUE(experiment_checkpoints.target) AS target,
ANY_VALUE(all_checkpoints.pageviews) AS pageviews
FROM experiment_checkpoints INNER JOIN all_checkpoints
ON experiment_checkpoints.id = all_checkpoints.id
WHERE
all_checkpoints.checkpoint = @conversioncheckpoint
AND EXISTS (
SELECT 1
FROM
UNNEST(SPLIT(@targets, ',')) AS prefix
WHERE all_checkpoints.target LIKE CONCAT(TRIM(prefix), '%')
)
GROUP BY all_checkpoints.id
),

loose_converted_checkpoints AS (
converted_checkpoints AS (
SELECT
all_checkpoints.id AS id,
ANY_VALUE(experiment_checkpoints.source) AS source,
Expand All @@ -148,20 +83,6 @@ loose_converted_checkpoints AS (
GROUP BY all_checkpoints.id
),

converted_checkpoints AS (
SELECT * FROM loose_converted_checkpoints
WHERE @sources = '-' AND @targets = '-'
UNION ALL
SELECT * FROM source_target_converted_checkpoints
WHERE @sources != '-' AND @targets != '-'
UNION ALL
SELECT * FROM source_converted_checkpoints
WHERE @sources != '-' AND @targets = '-'
UNION ALL
SELECT * FROM target_converted_checkpoints
WHERE @sources = '-' AND @targets != '-'
),

conversions_summary AS (
SELECT
source,
Expand Down
Loading