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

Support custom grain in DSI callsites #363

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

WilliamDee
Copy link
Contributor

Description

Given that custom granularity is available, we need to start supporting it when parsing through names and filters.

Non-breaking changes

  • Removed WhereFilterTimeDimensionFactory as it's not used anywhere (MetricFlow has it's own in metricflow-semantics)
  • Added tests to test parsing of group by's using custom grain and filtering with custom grain

Breaking changes

  • Removed DunderedNameFormatter in favour of StructuredDunderedName as it's duplicate logic
  • Added custom_granularity_names to StructuredDunderedName.parse_name as a parameter to parse out any custom grain
    • Updated callsites for this
  • Changed PydanticWhereFilter.call_parameter_sets and PydanticWhereFilterIntersection.filter_expression_parameter_sets from a property to a method that takes in the valid custom grain names
    • Updated callsites for this

Checklist

Resolves SL-2989

Copy link

linear bot commented Nov 5, 2024

@cla-bot cla-bot bot added the cla:yes label Nov 5, 2024
…WhereFilterIntersection.filter_expression_parameter_sets from property to a method that takes in the valid custom grain names
…nticWhereFilterIntersection.filter_expression_parameter_sets
Copy link
Contributor

@courtneyholcomb courtneyholcomb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple comments but otherwise looks good!

Since this is a breaking change, I would wait to merge it until you're ready to bump the version (otherwise can risk someone else doing a patch version bump that includes your change). This should be a minor version bump.
@DevonFulcher also has a breaking change PR up. Maybe you guys can coordinate releasing & updating core. Make sure you guys sync with me before you update core because there are some extra steps you'll need to take.

@@ -91,52 +91,3 @@ def entity_prefix(self) -> Optional[str]:
return DUNDER.join(tuple(entity_reference.element_name for entity_reference in self.entity_links))

return None


class DunderedNameFormatter:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming you checked that this isn't used in any dependent repos?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for all the other deleted objects!

Copy link
Contributor Author

@WilliamDee WilliamDee Nov 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup! now i'm paranoid, gonna make another pass to see

Copy link
Contributor Author

@WilliamDee WilliamDee Nov 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so DunderedNameFormatter is used in MF, but I thought it should be fine since this is release a minor version upgrade, which shouldn't be picked up by MF right away right? And when I upgrade, i'll update those in MF

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! I would double check that metricflow-semantics won't pick it up (it's not always pinned to a patch version)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait ignore me you're right. Minor is not the same is patch. Sorry my brain is busted rn 🙃

@@ -49,6 +49,7 @@ def create_time_dimension(
time_granularity_name: Optional[str] = None,
entity_path: Sequence[str] = (),
date_part_name: Optional[str] = None,
custom_granularity_names: Sequence[str] = (),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be optional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

felt better for this to be default to a sequence, so we don't need to handle this at the bottom where we do

StructuredDunderedName.parse_name(
            name=time_dimension_name, custom_granularity_names=custom_granularity_names or ()
        )

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I guess I just want to make sure people don't skip it without realizing that it's necessary. Like sometimes I like to leave params like this as required so that people are forced to actively pass in the empty value and hopefully in the process they check out what it's used for and make sure they're doing the right thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooo yea, ill drop the default

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