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

Build DataflowPlan for custom offset window #1584

Open
wants to merge 4 commits into
base: court/custom-offset5
Choose a base branch
from

Conversation

courtneyholcomb
Copy link
Contributor

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.

@cla-bot cla-bot bot added the cla:yes label Dec 18, 2024
@dbt-labs dbt-labs deleted a comment from github-actions bot Dec 18, 2024
@dbt-labs dbt-labs deleted a comment from github-actions bot Dec 18, 2024
@courtneyholcomb courtneyholcomb marked this pull request as ready for review December 18, 2024 21:38
@courtneyholcomb courtneyholcomb force-pushed the court/custom-offset5 branch 2 times, most recently from 6e642e4 to a9dc916 Compare December 19, 2024 06:51
@courtneyholcomb courtneyholcomb force-pushed the court/custom-offset6 branch 2 times, most recently from d0c473a to bebe99d Compare December 19, 2024 06:55
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.
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
Copy link
Contributor

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?

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=(
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants