-
Notifications
You must be signed in to change notification settings - Fork 92
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
Clean up object and module organization #225
Conversation
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
We occasionally need to convert WhereClauseConstraint objects to SpecWhereClauseConstraint objects. For historical reasons this logic was held in the MetricFlowQueryParser, but keeping it there does not make a lot of organizational sense. Worse, it sets up potential circular dependencies, as it forces the query parser to depend on our semantic containers, and the dataflow plan builder to depend on the query parser. Here we split this helper into its own independent class. We cannot move it onto either the source or target classes because of other concerns around possible circular dependencies, which we have documented in the new module.
The AggregationType enum was included with the Measure model object because that was where it was first needed, but its utility is quite a bit broader than as a model enumeration. Since its current location leads to potential circular imports, and additional aggregation properties (such as additiveness) might be coming in the future, we move it to a root aggregation_properties module.
Specs are meant to be relatively mutable constructs that can change depending on query constraints, while model objects are meant to be consistent to the user defined metric model. Therefore, we split the active dataflow state operations into a separate NonAdditiveDimensionSpec class, and populate its properties from the NonAdditiveDimensionParams model object.
This nomenclature is a little confusing, so we name all of the variables pointing at NonAdditiveDimensionSpec accordingly.
78ffcdb
to
c5eb2f9
Compare
9234a81
to
3da103b
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.
this looks great! Thank you for cleaning everything!
SIDE NOTE: we will need to make some changes to our internal SourceNodeBuilder to accommodate the change from NonAdditiveDimensionParameters
to NonAdditiveDimensionSpec
@@ -0,0 +1,39 @@ | |||
from __future__ import annotations |
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 if we had like a metricflow/model/properties/
directory that stores these? I'm not aware of the best practices, but personally I like how we have most things organized in their respective directories rather than being in the root directory.
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.
I think that'd be fine, although I pulled these to root because I think of them as being on the level of specs and suchlike. To be honest I thought about moving those into a sub-directory as well, but decided not to get too carried away, so I'm open to some simple file move reorganization PRs.
We have a number of slightly wonky organizational artifacts in our
codebase which have been cropping up as circular imports of late.
Most recently, issues with conversion between WhereClauseConstraint
and SpecWhereClauseConstraint are blocking update and merge on
#153 , but that's not the only issue we've been encountering.
This PR does the following in order to tidy things up and bring us
a bit closer to the layout described in #214: