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

Support null coalescing properties for metric nodes #8700

Merged
merged 5 commits into from
Sep 25, 2023

Conversation

QMalcolm
Copy link
Contributor

resolves #8593

Problem

MetricFlow is adding support for null value coalescing (dbt-labs/metricflow#759). In order to use that, dbt-core needs to support the related properties

Solution

Add the properties join_to_timespine and fill_nulls_with (as defined in the related MF and DSI issues: dbt-labs/metricflow#759, dbt-labs/dbt-semantic-interfaces#142) to the metric node definition.

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX
  • This PR includes type annotations for new and modified functions

@QMalcolm QMalcolm requested a review from a team as a code owner September 22, 2023 22:13
@QMalcolm QMalcolm requested a review from gshank September 22, 2023 22:13
@cla-bot cla-bot bot added the cla:yes label Sep 22, 2023
@codecov
Copy link

codecov bot commented Sep 22, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -1.34% ⚠️

Comparison is base (417fc2a) 86.65% compared to head (27b05ef) 85.31%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8700      +/-   ##
==========================================
- Coverage   86.65%   85.31%   -1.34%     
==========================================
  Files         176      176              
  Lines       25674    25678       +4     
==========================================
- Hits        22247    21907     -340     
- Misses       3427     3771     +344     
Flag Coverage Δ
integration 81.67% <100.00%> (-1.79%) ⬇️
unit 65.15% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
core/dbt/parser/schema_yaml_readers.py 89.36% <ø> (-2.56%) ⬇️
core/dbt/contracts/graph/nodes.py 95.18% <100.00%> (-0.96%) ⬇️
core/dbt/contracts/graph/unparsed.py 93.51% <100.00%> (+0.02%) ⬆️

... and 34 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

The `assert_symmetric` function asserts that dictionaries are mostly
equivalent. I say mostly equivalent because it drops keys that are
`None`. The issue is that that `join_to_timespine` gets defaulted
to `False`, so we have to specify it in the `get_ok_dict` so that
they match.
@QMalcolm QMalcolm merged commit 48e9ced into main Sep 25, 2023
49 of 50 checks passed
@QMalcolm QMalcolm deleted the qmalcolm--8593-null-value-coalescing-in-metrics branch September 25, 2023 18:02
@github-actions
Copy link
Contributor

The backport to 1.6.latest failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.6.latest 1.6.latest
# Navigate to the new working tree
cd .worktrees/backport-1.6.latest
# Create a new branch
git switch --create backport-8700-to-1.6.latest
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 48e9ced7815247d4d429fefba606aae3f77479ba
# Push it to GitHub
git push --set-upstream origin backport-8700-to-1.6.latest
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.6.latest

Then, create a pull request where the base branch is 1.6.latest and the compare/head branch is backport-8700-to-1.6.latest.

@emmyoop emmyoop mentioned this pull request Sep 30, 2023
5 tasks
QMalcolm added a commit that referenced this pull request Oct 4, 2023
* Include 'join_to_timespine` and `fill_nulls_with` in metric fixture

* Support `join_to_timespine` and `fill_nulls_with` properties on measure inputs to metrics

* Assert new `fill_nulls_with` and `join_to_timespine` properties don't break associated DSI protocol

* Add doc for metric null coalescing improvements

* Fix unit test for unparsed metric objects

The `assert_symmetric` function asserts that dictionaries are mostly
equivalent. I say mostly equivalent because it drops keys that are
`None`. The issue is that that `join_to_timespine` gets defaulted
to `False`, so we have to specify it in the `get_ok_dict` so that
they match.
QMalcolm added a commit that referenced this pull request Oct 5, 2023
…odes (#8700) (#8773)

* Support null coalescing properties for metric nodes (#8700)

* Include 'join_to_timespine` and `fill_nulls_with` in metric fixture

* Support `join_to_timespine` and `fill_nulls_with` properties on measure inputs to metrics

* Assert new `fill_nulls_with` and `join_to_timespine` properties don't break associated DSI protocol

* Add doc for metric null coalescing improvements

* Fix unit test for unparsed metric objects

The `assert_symmetric` function asserts that dictionaries are mostly
equivalent. I say mostly equivalent because it drops keys that are
`None`. The issue is that that `join_to_timespine` gets defaulted
to `False`, so we have to specify it in the `get_ok_dict` so that
they match.

* Regenerate v10 schema to include null coalescing options
QMalcolm added a commit that referenced this pull request Oct 9, 2023
* Include 'join_to_timespine` and `fill_nulls_with` in metric fixture

* Support `join_to_timespine` and `fill_nulls_with` properties on measure inputs to metrics

* Assert new `fill_nulls_with` and `join_to_timespine` properties don't break associated DSI protocol

* Add doc for metric null coalescing improvements

* Fix unit test for unparsed metric objects

The `assert_symmetric` function asserts that dictionaries are mostly
equivalent. I say mostly equivalent because it drops keys that are
`None`. The issue is that that `join_to_timespine` gets defaulted
to `False`, so we have to specify it in the `get_ok_dict` so that
they match.
@aranke aranke mentioned this pull request Jul 12, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-3090] Support properties for null value coalescing in metrics
3 participants