-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a26a75e
commit 87c62a6
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
tests_metricflow/integration/test_cases/itest_join_to_timespine.yaml
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,41 @@ | ||
integration_test: | ||
name: test_constraint_on_measure_selected_in_group_by | ||
description: Tests that the filter on measure is not re-applied even if selected in group by | ||
model: SIMPLE_MODEL | ||
metrics: ["instant_bookings_with_measure_filter"] | ||
group_bys: ["metric_time__day", "booking__is_instant"] | ||
where_filter: | | ||
{{ render_time_constraint(render_time_dimension_template('metric_time', 'day'), start_time="2020-01-01") }} | ||
check_query: | | ||
SELECT | ||
metric_time__day | ||
, booking__is_instant | ||
, bookings AS instant_bookings_with_measure_filter | ||
FROM ( | ||
SELECT | ||
t.ds AS metric_time__day | ||
, b.booking__is_instant AS booking__is_instant | ||
, b.bookings AS bookings | ||
FROM {{ source_schema }}.mf_time_spine t | ||
LEFT OUTER JOIN ( | ||
SELECT | ||
metric_time__day | ||
, booking__is_instant | ||
, SUM(bookings) AS bookings | ||
FROM ( | ||
SELECT | ||
{{ render_date_trunc("ds", TimeGranularity.DAY) }} AS metric_time__day | ||
, listing_id AS listing | ||
, is_instant AS booking__is_instant | ||
, 1 AS bookings | ||
FROM {{ source_schema }}.fct_bookings b | ||
) d | ||
WHERE booking__is_instant AND listing IS NOT NULL AND {{ render_time_constraint("metric_time__day", start_time="2020-01-01") }} | ||
GROUP BY | ||
metric_time__day | ||
, booking__is_instant | ||
) b | ||
ON | ||
t.ds = b.metric_time__day | ||
) c | ||
WHERE {{ render_time_constraint("metric_time__day", start_time="2020-01-01") }} |