-
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
Enable different granularities for metrics with time offset #426
Conversation
@@ -209,7 +209,7 @@ metric: | |||
- txn_revenue | |||
--- | |||
metric: | |||
name: "every_two_days_bookers" # because the bookings test data only spans 3 days |
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.
No longer true
@@ -197,34 +197,15 @@ def _make_time_spine_data_set( | |||
|
|||
# If the requested granularity is the same as the granularity of the spine, do a direct select. | |||
if metric_time_dimension_instance.spec.time_granularity == time_spine_source.time_column_granularity: | |||
return SqlDataSet( |
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.
Removed some redundant code here
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.
As per discussion, there are some uncertainties on how the feature should work (from a product perspective), and we haven't prioritized a resolution. Since I'm using github to manage my review queue, marking this is Request Changes
so that it's not on my list.
PR outdated; new one here #726 |
With the current placement of the
JoinToTimeSpineNode
in the dataflow plan, we filter down to time columns with the requested granularity BEFORE joining to time spine. Since joining to time spine expects an unaggregated time column, this means queries with any granularity besidesDAY
don't return expected results. Here, we move the time spine join to happen before time column aggregation.For cumulative metrics, we also needed to change the order of the dataflow plan, from
FilterElementsNode -> JoinOverTimeRangeNode
(both required) toJoinOverTimeRangeNode (optional, only used if a time dimension is requested) -> JoinToTimeSpineNode (optional, only used for offset metrics) -> FilterElementsNode
. This ensures we'll have the columns needed when joining to time spine.Unrelated to time offset, this change also removes the unnecessary
JoinOverTimeRangeNode
step for a cumulative metric queried without a time dimension, which 1) does nothing in SQL and 2) might result in inaccurate costing for that query.