-
Notifications
You must be signed in to change notification settings - Fork 94
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
Bug fix: Apply metric_time
filters to time spine when needed
#1455
Conversation
metric_time
filters to time spine when needed
f658c16
to
1a060b8
Compare
ad1d4bf
to
287cefa
Compare
25a0798
to
8700c5f
Compare
@@ -286,23 +296,81 @@ def _make_time_spine_data_set( | |||
) | |||
# TODO: also handle date part. | |||
|
|||
output_instance_set = InstanceSet( |
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 output instance set was incorrect before this PR, but was never used for any real logic so it didn't matter.
4fa8671
to
0359853
Compare
|
||
# Where constraints must be applied in an outer query since they are using an alias (e.g., 'metric_time__day'), | ||
# and some engines do not support using an alias in the WHERE clause. | ||
if not time_spine_where_constraints: |
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: I always have a hard time with not x
for these, it feels easier to read if we have like if len(time_spine_where_constraints) == 0
And also simplify / reorganized displayed properties for the node.
0359853
to
0299f63
Compare
There is currently a bug where, if you query a join_to_timespine metric with a metric_time filter that is not applied in the group by, you will end up with more rows than expected.
To fix that, we need to apply any metric_time filters to the time spine table before joining that table to the aggregated measure. This needs to happen before the join instead of after because after the join we may not have access to metric_time at the grain needed for the filter. This implements that behavior.
I recommend reviewing by commit.