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

[fix] fixes APPLY / SORTBY / GROUPBY / REDUCE order on FT.AGGREGATE s… #41

Merged
merged 7 commits into from
Oct 28, 2019

Conversation

filipecosta90
Copy link
Collaborator

This is a draft PR open for discussion, fixing AggregateRequest incorrect order of clauses.

Fixes #40

Overall changes:

  • [add] added query builder tests to circleci
  • [add] added # Test with apply testcase to testbuilder.py
  • [fix] fixed Single field, single reducer, Multiple fields, single reducer, and Multiple fields, multiple reducers testcases on testbuilder.py
  • [rem] removed self._groups = [], self._projections = [] and self._sortby = [] in exchange of self._aggregateplan = [] which enforces the order of the clauses to be the order of the method calls.

@stryt2, would appreciate your comments regarding the changes.

Copy link

@MeirShpilraien MeirShpilraien left a comment

Choose a reason for hiding this comment

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

Looks good, small comments.
In addition I did not see the FILTER implementation, did I missed it?
Last I know it is also currently missing but reducers can also have alias, maybe its a good chance to add it? not a must though, its you chose ...

@filipecosta90
Copy link
Collaborator Author

Looks good, small comments.
In addition I did not see the FILTER implementation, did I missed it?
Last I know it is also currently missing but reducers can also have alias, maybe its a good chance to add it? not a must though, its you chose ...

FILTER was not in-place on redisearch-py. Will add it as well.
Will also accommodate the recommended changes. tks @MeirShpilraien

@filipecosta90
Copy link
Collaborator Author

Looks good, small comments.
In addition I did not see the FILTER implementation, did I missed it?
Last I know it is also currently missing but reducers can also have alias, maybe its a good chance to add it? not a must though, its you chose ...

@MeirShpilraien the latest commit:

MeirShpilraien
MeirShpilraien previously approved these changes Oct 3, 2019
@stryt2
Copy link

stryt2 commented Oct 4, 2019

Thanks for the quick fix. I think the fix looks good as well.

However, another comment on the FILTER, from the Redisearch Aggregation API Reference, it says

Several filter steps can be added, ...

Disregard efficiency, I think the filter(self, expressions) method should also allow multiple filters being added at different stages of the aggregation pipeline; unless having the FILTERs at different stages down the pipeline never effects the aggregation result.

But otherwise, the fix looks solid. Thanks again.

@filipecosta90
Copy link
Collaborator Author

Thanks for the quick fix. I think the fix looks good as well.

However, another comment on the FILTER, from the Redisearch Aggregation API Reference, it says

Several filter steps can be added, ...

Disregard efficiency, I think the filter(self, expressions) method should also allow multiple filters being added at different stages of the aggregation pipeline; unless having the FILTERs at different stages down the pipeline never effects the aggregation result.

hi there @stryt2 , with regards to the "multiple filters being added at different stages of the aggregation pipeline", you're right. I was enforcing them to be after all other clauses due to my interpretation of The FILTER expressions are evaluated post-query and relate to the current state of the pipeline..
will double-check that the filters vs other clauses order will have different outcomes. If so, will correct it. Thanks @stryt2 =)

@MeirShpilraien
Copy link

@filipecosta90 did you fix the multiple filters comment? Also a rebase is required.

@filipecosta90
Copy link
Collaborator Author

@filipecosta90 did you fix the multiple filters comment? Also a rebase is required.

will do it today @MeirShpilraien 👍

@filipecosta90
Copy link
Collaborator Author

@MeirShpilraien @stryt2 the latest commit should address the FILTER clause issue.

@gkorland gkorland merged commit cac6de9 into RediSearch:master Oct 28, 2019
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.

build_args method for the AggregateRequest enforces incorrect order of clauses
4 participants