Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow measures that join to time spine to use agg_time_dim #1005

Merged
merged 21 commits into from
Feb 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions metricflow/test/integration/test_cases/itest_metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,26 @@ integration_test:
GROUP BY
1
---
integration_test:
name: simple_fill_nulls_with_0_agg_time_dim
description: Test a simple query that joins to time spine and fills nulls, with agg_time_dimension
model: SIMPLE_MODEL
metrics: ["bookings_fill_nulls_with_0"]
group_by_objs: [{"name": "booking__ds__day"}]
check_query: |
SELECT
subq_5.ds AS booking__ds__day
, COALESCE(subq_3.bookings, 0) AS bookings_fill_nulls_with_0
FROM {{ source_schema }}.mf_time_spine subq_5
LEFT OUTER JOIN (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so previously this would have just run the query but skipped the join, correct? That seems strange and incorrect to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic there was that if there's no time dimension to join to, we can't join to time spine anyway.
And then, if there is a time dimension that isn't agg time, should we time spine join to that dimension? Seems inconsistent if we're treating it like any other categorical dimension in all other ways.

SELECT
{{ render_date_trunc("ds", TimeGranularity.DAY) }} AS booking__ds__day
, SUM(1) AS bookings
FROM {{ source_schema }}.fct_bookings bookings_source_src_1
GROUP BY 1
) subq_3
ON subq_5.ds = subq_3.booking__ds__day
---
integration_test:
name: simple_fill_nulls_with_0_with_categorical_dimension
description: Test simple query that fills nulls but doesn't join to time spine (categorical dimension)
Expand Down
Loading