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

Control operation combinations #147

Merged
merged 5 commits into from
Aug 22, 2023
Merged

Control operation combinations #147

merged 5 commits into from
Aug 22, 2023

Conversation

PatrikDurdevic
Copy link
Contributor

@PatrikDurdevic PatrikDurdevic commented Aug 20, 2023

  • Enable operations to exclude other operations they can be applied with
  • Prevent Aggregation operations besides FirstAggregationOp and LastAggregationOp to be paired with OrderByOp
  • Prevent FirstAggregationOp and LastAggregationOp from being paired with IdentityByOp (hence only allowing IdentityByOp)

Prevent aggregation operations besides First and Last to be paired with order by
@codecov
Copy link

codecov bot commented Aug 20, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.07% 🎉

Comparison is base (2c7cd68) 90.36% compared to head (a780d21) 90.43%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #147      +/-   ##
==========================================
+ Coverage   90.36%   90.43%   +0.07%     
==========================================
  Files          25       25              
  Lines         934      941       +7     
==========================================
+ Hits          844      851       +7     
  Misses         90       90              
Files Changed Coverage Δ
trane/core/utils.py 87.02% <100.00%> (+0.20%) ⬆️
trane/ops/__init__.py 100.00% <100.00%> (ø)
trane/ops/aggregation_ops.py 98.88% <100.00%> (+0.02%) ⬆️
trane/ops/op_base.py 95.91% <100.00%> (+0.08%) ⬆️
trane/ops/transformation_ops.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@PatrikDurdevic
Copy link
Contributor Author

#146

@PatrikDurdevic PatrikDurdevic marked this pull request as ready for review August 20, 2023 02:42
Comment on lines +295 to +299
assert {
filter_op.__class__.__name__,
transform_op.__class__.__name__,
agg_op.__class__.__name__,
}.intersection(filter_op.restricted_ops) == set()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
assert {
filter_op.__class__.__name__,
transform_op.__class__.__name__,
agg_op.__class__.__name__,
}.intersection(filter_op.restricted_ops) == set()
filter_cls_name = filter_op.__class__.__name__
transform_cls_name = transform_op.__class__.__name__
agg_cls_name = agg_op.__class__.__name__
assert {
filter_cls_name,
transform_cls_name,
agg_cls_name,
}.intersection(filter_op.restricted_ops) == set()

Copy link
Contributor

Choose a reason for hiding this comment

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

you can also use the variables below

transform_operation.__name__,
filter_operation.__name__,
}.intersection(
agg_operation.restricted_ops.union(
Copy link
Contributor

Choose a reason for hiding this comment

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

restricted_ops could be converted to the actual python objects, rather than relying on strings

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had circular dependency issues when I tried this (since in agg ops I am restricting transformation ops, and in transformation ops I am restricting agg ops; so I need to import one into another and vice versa), do you have an idea on how to approach it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I definitely agree with this though

Copy link
Contributor

Choose a reason for hiding this comment

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

oh I see. Let's leave it for now that, as is

Copy link
Contributor

@gsheni gsheni left a comment

Choose a reason for hiding this comment

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

overall, looks good. Just some minor suggestions

@gsheni gsheni merged commit 2bcc4f8 into main Aug 22, 2023
17 checks passed
@gsheni gsheni deleted the restrict_ops_order branch August 22, 2023 02:04
@gsheni gsheni mentioned this pull request Aug 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants