Skip to content

Commit

Permalink
Add integration test for derived metrics with shared aliases
Browse files Browse the repository at this point in the history
This commit adds a new integration test that uses
`derived_sharedalias_1a` and `derived_sharedalias_2`.

I manually optimized the SQL from the output of the optimized SQL
snapshot.
  • Loading branch information
serramatutu committed Oct 30, 2024
1 parent cac1d59 commit 2f9bf6b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests_metricflow/integration/test_cases/itest_metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,21 @@ integration_test:
ds
) a
---
integration_test:
name: shared_alias_derived_metric
description: Tests derived metrics which use the same alias for different things
model: SIMPLE_MODEL
metrics: ["derived_sharedalias_1a", "derived_sharedalias_2"]
group_bys: ["booking__is_instant"]
check_query: |
SELECT
is_instant AS booking__is_instant
, COUNT(*) - 10 AS derived_sharedalias_1a
, SUM(CASE WHEN is_instant THEN 1 ELSE 0 END) + 10 AS derived_sharedalias_2
FROM {{ source_schema }}.fct_bookings
GROUP BY
booking__is_instant
---
integration_test:
name: two_metrics_with_null_dimension_values
description: Tests querying two metrics with a dimension having a NULL values
Expand Down

0 comments on commit 2f9bf6b

Please sign in to comment.