Skip to content

Proposed fix for #67 #68

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

Merged
merged 1 commit into from
Jul 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions redisearch/aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ class Group(object):
This object automatically created in the `AggregateRequest.group_by()`
"""
def __init__(self, fields, reducers):
if not fields:
Copy link
Contributor

Choose a reason for hiding this comment

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

@quintonparker
Why remove this and then remove the test?
Aren't they both relevant?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hey @ashtul

see #67

Copy link
Contributor Author

Choose a reason for hiding this comment

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

basically, aggregation queries that is possible on the cli is not reproducible with redisearch-py because this code is enforcing the fields var to be non-empty

raise ValueError('need at least one field')
if not reducers:
raise ValueError('Need at least one reducer')

Expand Down
6 changes: 5 additions & 1 deletion test/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ def testGroup(self):
# Check the group class on its own
self.assertRaises(ValueError, a.Group, [], [])
self.assertRaises(ValueError, a.Group, ['foo'], [])
self.assertRaises(ValueError, a.Group, [], r.count())

# Zero fields, single reducer
g = a.Group([], r.count())
ret = g.build_args()
self.assertEqual(['GROUPBY', '0', 'REDUCE', 'COUNT', '0'], ret)

# Single field, single reducer
g = a.Group('foo', r.count())
Expand Down