Skip to content

Commit

Permalink
Add check query tests for the interactions between sub-daily granular…
Browse files Browse the repository at this point in the history
…ity and metric default granularity
  • Loading branch information
courtneyholcomb committed Aug 13, 2024
1 parent f9679f3 commit 6170177
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@ metric:
type_params:
measure:
name: archived_users
time_granularity: hour
time_granularity: hour
28 changes: 26 additions & 2 deletions tests_metricflow/integration/test_cases/itest_metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2330,5 +2330,29 @@ integration_test:
GROUP BY metric_time__hour
) subq_3
ON subq_5.ts = subq_3.metric_time__hour
# test_subdaiy_metric_default_granularity
---
integration_test:
name: subdaily_metric_defaults_to_day_granularity
description: test that a subdaily metric without explicit default granularity defaults to DAY
model: SIMPLE_MODEL
metrics: ["simple_subdaily_metric_default_day"]
group_bys: ["metric_time"]
check_query: |
SELECT
{{ render_date_trunc("archived_at", TimeGranularity.DAY) }} AS metric_time__day
, SUM(1) AS simple_subdaily_metric_default_day
FROM {{ source_schema }}.dim_users
GROUP BY {{ render_date_trunc("archived_at", TimeGranularity.DAY) }}
---
integration_test:
name: subdaily_metric_default_granularity
description: test that a subdaily metric without explicit default granularity defaults to DAY
model: SIMPLE_MODEL
metrics: ["simple_subdaily_metric_default_hour"]
group_bys: ["metric_time"]
check_query: |
SELECT
{{ render_date_trunc("archived_at", TimeGranularity.HOUR) }} AS metric_time__hour
, SUM(1) AS simple_subdaily_metric_default_hour
FROM {{ source_schema }}.dim_users
GROUP BY {{ render_date_trunc("archived_at", TimeGranularity.HOUR) }}

0 comments on commit 6170177

Please sign in to comment.