Merge lp://staging/~free.ekanayaka/storm/fix-order-by-expressions-in-ref-set into lp://staging/storm
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 455 | ||||
Proposed branch: | lp://staging/~free.ekanayaka/storm/fix-order-by-expressions-in-ref-set | ||||
Merge into: | lp://staging/storm | ||||
Diff against target: | 0 lines | ||||
To merge this branch: | bzr merge lp://staging/~free.ekanayaka/storm/fix-order-by-expressions-in-ref-set | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Thomas Herve (community) | Approve | ||
Storm Developers | Pending | ||
Review via email: mp+141729@code.staging.launchpad.net |
Description of the change
The bug was introduced by the change in r358, which makes the order_by parameter of the ReferenceSet be processed by PropertyResolver. This branch tries to address the issue by making the PropertyResolver handle not only Storm classes, strings and Columns, but also expressions.
I think this a general solution that offers nice flexibility (you can write things like order_by=
elif isinstance(
# Don't try to be fency here, just return whatever the user passed us
return property
which would handle order_by=
Maybe the wise choice would be to go with this latter less powerful approach, and try to make it fancy only if use cases arise for it. OTOH it also feels that in practice you the most you want to do is indeed just a Desc() expression, and nothing more complicated, since you can do everything else with some application code using ReferenceSet.find. So maybe the solution of this branch is actually a compromise that makes sense.
Thinking about it, a third option would be to have both approaches in place:
elif isinstance( property, SuffixExpr):
property. expr = self.resolve( property. expr) property, Expr):
# We know how to handle this specific case, so be smart
return property
elif isinstance(
# This is a generic expression that we don't handle (yet), so
# just take it as it is
return property