-
Notifications
You must be signed in to change notification settings - Fork 98
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
New test cases for fill_nulls_with
#1037
Conversation
919132f
to
9461ee6
Compare
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.
Seems reasonable!
--- | ||
metric: | ||
name: twice_bookings_fill_nulls_with_0_without_time_spine | ||
description: 2x twice_bookings_fill_nulls_with_0_without_time_spine |
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.
nit: 2x bookings_fill_nulls_with_0_without_time_spine
--- | ||
metric: | ||
name: nested_fill_nulls_without_time_spine | ||
description: 2x twice_bookings_fill_nulls_with_0_without_time_spine but then x3 |
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.
Same nit, but this time maybe strike the 2x
dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, | ||
sql_client: SqlClient, | ||
) -> None: | ||
"""Test conversion metric with constant properties by data flow plan rendering.""" |
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.
Let's update the docstring here and in the other test cases to indicate any weirdness. Like if this won't fill nulls at every level, we can put that in with a note that this should highlight the relevant changes if/when we alter that behavior.
-- Compute Metrics via Expressions | ||
SELECT | ||
metric_time__day | ||
, CAST(buys AS FLOAT64) / CAST(NULLIF(visits, 0) AS FLOAT64) AS visit_buy_conversion_rate_7days_fill_nulls_with_0 |
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.
Oh interesting. If we want to support recursively filling nulls with something we'll need to apply it on the metric, because conversion and ratio metrics will return NULL for any zero denominator.
This is the default behavior we want - NULL is the correct result - but users may override when they know, for example, that any zero denominator implies a 0% conversion rate for their analysis purposes.
Nothing to do about that now except maybe make a note of this in the test docstring.
Shoot, merged this on mobile which had the comments collapsed so I missed them. Will address in a follow up PR! |
Description
Tests for some edge cases that have come up in discussions about coalescing nulls. Getting these SQL examples merged will allow us to see the SQL changes more clearly when working on follow ups like SL-1677.