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 df65365
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 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,22 @@ integration_test:
ds
) a
---
# TODO @serramatutu: I WAS HERE
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 df65365

Please sign in to comment.