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 _stats reducer when map function emits array #1484

merged 1 commit into from Aug 1, 2018


Copy link

@iilyak iilyak commented Aug 1, 2018


According to documentation for _stats reduce function there is support for the case when map emits array of integers. This PR fixes this use case (fixup for 5fa3c43).

Testing recommendations

make check apps=couch tests=reduce_stats_test

and following reproducer script courtesy of @nickva



curl -XDELETE $S/$DB
curl -XPUT $S/$DB

curl -s -XPOST $S/$DB -d '{"_id":"_design/dd2","views":{"v1":{"map":"function(doc){emit(null, doc.x) };","reduce":"_stats"}}}' -H 'Content-Type: application/json'
curl -s -XPOST $S/$DB -d '{"x": [1,2]}' -H 'Content-Type: application/json'

curl $S/$DB/_design/dd2/_view/v1

Related Issues or Pull Requests

Fixes #1377


  • Code is written and works correctly;
  • Changes are covered by tests;
  • Documentation reflects the changes;
@iilyak iilyak force-pushed the cloudant:fix-stats-reducer-for-array branch from 63b418b to aeced65 Aug 1, 2018
nickva approved these changes Aug 1, 2018
Copy link

@nickva nickva left a comment

Well done

@iilyak iilyak merged commit 17aec1f into apache:master Aug 1, 2018
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
@iilyak iilyak deleted the cloudant:fix-stats-reducer-for-array branch Aug 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants