-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! Add integration test for derived metrics with shared aliases
- Loading branch information
1 parent
8a7b603
commit 57e0611
Showing
13 changed files
with
3,127 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
459 changes: 459 additions & 0 deletions
459
...gQuery/test_derived_metric_that_defines_the_same_alias_in_different_components__plan0.sql
Large diffs are not rendered by default.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
...t_derived_metric_that_defines_the_same_alias_in_different_components__plan0_optimized.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
-- Combine Aggregated Outputs | ||
-- Order By [] Limit 1 | ||
SELECT | ||
COALESCE(subq_18.booking__is_instant, subq_24.booking__is_instant) AS booking__is_instant | ||
, MAX(subq_18.derived_shared_alias_1a) AS derived_shared_alias_1a | ||
, MAX(subq_24.derived_shared_alias_2) AS derived_shared_alias_2 | ||
FROM ( | ||
-- Compute Metrics via Expressions | ||
SELECT | ||
booking__is_instant | ||
, shared_alias - 10 AS derived_shared_alias_1a | ||
FROM ( | ||
-- Aggregate Measures | ||
-- Compute Metrics via Expressions | ||
SELECT | ||
booking__is_instant | ||
, SUM(bookings) AS shared_alias | ||
FROM ( | ||
-- Read Elements From Semantic Model 'bookings_source' | ||
-- Metric Time Dimension 'ds' | ||
-- Pass Only Elements: ['bookings', 'booking__is_instant'] | ||
SELECT | ||
is_instant AS booking__is_instant | ||
, 1 AS bookings | ||
FROM ***************************.fct_bookings bookings_source_src_28000 | ||
) subq_15 | ||
GROUP BY | ||
booking__is_instant | ||
) subq_17 | ||
) subq_18 | ||
FULL OUTER JOIN ( | ||
-- Compute Metrics via Expressions | ||
SELECT | ||
booking__is_instant | ||
, shared_alias + 10 AS derived_shared_alias_2 | ||
FROM ( | ||
-- Aggregate Measures | ||
-- Compute Metrics via Expressions | ||
SELECT | ||
booking__is_instant | ||
, SUM(instant_bookings) AS shared_alias | ||
FROM ( | ||
-- Read Elements From Semantic Model 'bookings_source' | ||
-- Metric Time Dimension 'ds' | ||
-- Pass Only Elements: ['instant_bookings', 'booking__is_instant'] | ||
SELECT | ||
is_instant AS booking__is_instant | ||
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings | ||
FROM ***************************.fct_bookings bookings_source_src_28000 | ||
) subq_21 | ||
GROUP BY | ||
booking__is_instant | ||
) subq_23 | ||
) subq_24 | ||
ON | ||
subq_18.booking__is_instant = subq_24.booking__is_instant | ||
GROUP BY | ||
booking__is_instant | ||
LIMIT 1 |
459 changes: 459 additions & 0 deletions
459
...bricks/test_derived_metric_that_defines_the_same_alias_in_different_components__plan0.sql
Large diffs are not rendered by default.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
...t_derived_metric_that_defines_the_same_alias_in_different_components__plan0_optimized.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
-- Combine Aggregated Outputs | ||
-- Order By [] Limit 1 | ||
SELECT | ||
COALESCE(subq_18.booking__is_instant, subq_24.booking__is_instant) AS booking__is_instant | ||
, MAX(subq_18.derived_shared_alias_1a) AS derived_shared_alias_1a | ||
, MAX(subq_24.derived_shared_alias_2) AS derived_shared_alias_2 | ||
FROM ( | ||
-- Compute Metrics via Expressions | ||
SELECT | ||
booking__is_instant | ||
, shared_alias - 10 AS derived_shared_alias_1a | ||
FROM ( | ||
-- Aggregate Measures | ||
-- Compute Metrics via Expressions | ||
SELECT | ||
booking__is_instant | ||
, SUM(bookings) AS shared_alias | ||
FROM ( | ||
-- Read Elements From Semantic Model 'bookings_source' | ||
-- Metric Time Dimension 'ds' | ||
-- Pass Only Elements: ['bookings', 'booking__is_instant'] | ||
SELECT | ||
is_instant AS booking__is_instant | ||
, 1 AS bookings | ||
FROM ***************************.fct_bookings bookings_source_src_28000 | ||
) subq_15 | ||
GROUP BY | ||
booking__is_instant | ||
) subq_17 | ||
) subq_18 | ||
FULL OUTER JOIN ( | ||
-- Compute Metrics via Expressions | ||
SELECT | ||
booking__is_instant | ||
, shared_alias + 10 AS derived_shared_alias_2 | ||
FROM ( | ||
-- Aggregate Measures | ||
-- Compute Metrics via Expressions | ||
SELECT | ||
booking__is_instant | ||
, SUM(instant_bookings) AS shared_alias | ||
FROM ( | ||
-- Read Elements From Semantic Model 'bookings_source' | ||
-- Metric Time Dimension 'ds' | ||
-- Pass Only Elements: ['instant_bookings', 'booking__is_instant'] | ||
SELECT | ||
is_instant AS booking__is_instant | ||
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings | ||
FROM ***************************.fct_bookings bookings_source_src_28000 | ||
) subq_21 | ||
GROUP BY | ||
booking__is_instant | ||
) subq_23 | ||
) subq_24 | ||
ON | ||
subq_18.booking__is_instant = subq_24.booking__is_instant | ||
GROUP BY | ||
COALESCE(subq_18.booking__is_instant, subq_24.booking__is_instant) | ||
LIMIT 1 |
Oops, something went wrong.