-
Notifications
You must be signed in to change notification settings - Fork 99
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
Build DataflowPlan for custom offset window #1584
base: court/custom-offset5
Are you sure you want to change the base?
Conversation
2719954
to
2dcf124
Compare
db647f3
to
e91fd30
Compare
57ba604
to
71cef04
Compare
e91fd30
to
7e13cf3
Compare
6e642e4
to
a9dc916
Compare
d0c473a
to
bebe99d
Compare
a9dc916
to
7de2bd3
Compare
3740d81
to
ef1dbdc
Compare
def _offset_window_is_custom(self, offset_window: Optional[MetricTimeWindow]) -> bool: | ||
return ( | ||
offset_window is not None | ||
and offset_window.granularity in self._semantic_model_lookup.custom_granularity_names |
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.
What happens when the granularity is not in custom_granularity_names
? Is this handled through a validation?
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.
In that case it would be a standard granularity! If neither were true, it would raise an error in validations.
output_node = JoinToTimeSpineNode.create( | ||
metric_source_node=output_node, | ||
time_spine_node=time_spine_node, | ||
requested_agg_time_dimension_specs=queried_agg_time_dimension_specs, | ||
join_on_time_dimension_spec=self._sort_by_base_granularity(queried_agg_time_dimension_specs)[0], | ||
offset_window=metric_spec.offset_window, | ||
offset_window=( |
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.
Are there cases where you can use a JoinToTimeSpineNode
with a custom offset window? If not, an assertion in the class would help.
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.
Sure, I'll add an assertion to the the __post_init__
for JoinToTimeSpineNode
!
a8cd2c0
to
69f253a
Compare
ef1dbdc
to
60da72b
Compare
69f253a
to
1d0dcca
Compare
e073215
to
74b183b
Compare
1d0dcca
to
53f6507
Compare
74b183b
to
7232d72
Compare
c77b7bb
to
2c32711
Compare
7232d72
to
70e5b61
Compare
2c32711
to
54edeb1
Compare
70e5b61
to
4292849
Compare
cd61ca8
to
e3af638
Compare
Note that we will also implement a simpler dataflow plan if the user queries the metric with only the granularity used in the offset window. This might not be done before the initial feature release, but the results should be the same. Only differences in performance and readability.
Should only have changes to column order. Only unoptimized queries are impacted.
4292849
to
e8a3d58
Compare
This is the dataflow plan that will be used if the custom grain is queried with any grains that aren't the same as the grain used in the offset window. There will be a simpler dataflow plan used for queries using only the same grain as what's used in the offset window.