-
Notifications
You must be signed in to change notification settings - Fork 47
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
Fix zero value metric #96
Conversation
I think this is the most important thing for us to clarify on this issue. Areas of Concern
What would happen if we completely abandoned the 0 coalesce and used null instead? Relevant slack thread: https://getdbt.slack.com/archives/C02CCBBBR1D/p1660673393965409 |
@dave-connors-3 crazy idea - what if we push this out into the metric definition itself? Have some sort of parameter in a config block that determines whether nulls are treated as 0's or as NULLS. This might be the way to keep metric definition flexible while keeping results consistent. |
@callum-mcdata @joellabes I believe I have addressed the comments here w.r.t. naming, passing the args the appropriate way, and validating configs (that last piece open to feedback!) last things we need here are:
once we get there, this should be close! |
Have added my vote for name on that comment ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has the stamp of approval! Nice job pushing this over the line, this one was more of a 🐻 than expected
Each component is addressed and the open questions will be punted on
@dave-connors-3 you've done the herculean work here -all yours to hit the big green button. |
…cs into fix-zero-value-metric
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Lets merge it
Love your work, you two! |
What is this PR?
This is a:
All pull requests from community contributors should target the
main
branch (default).Description & motivation
Closes #61
This initial approach parses expression metrics, checks for a
/
and wraps any divisors in the expression in the appropriatenullif( {{ dvisor }} , 0)
expression. This approach solves the current issue:Sample Metrics
Compiled SQL
Results:
My open question here is that this treats observed 0 value results (true zeros from my data) the same way as the filled-in 0s from our spining behavior. Is it appropriate to assume that any zero in the source metric should be evaluated by the corresponding expression metric?
What have I become
in order to enable the control over whether or not zeros or nulls show up in the results of the output, this PR has evolved to do the following
config
blocks from the metric definitiontreat_null_values_as_zero
behaviorChecklist
Tenets to keep in mind