iilyak opened a new pull request #1484: Fix _stats reducer when map function 
emits array
URL: https://github.com/apache/couchdb/pull/1484
 
 
   ## Overview
   
   According to [documentation for _stats reduce 
function](http://docs.couchdb.org/en/2.2.0/ddocs/ddocs.html#_stats) there is 
support for the case when map emits array of integers. This PR fixes this use 
case (fixup for 
https://github.com/apache/couchdb/commit/5fa3c43f2c7313b18a63c0100ab2b1843bd8ab94).
 
   
   
   ## Testing recommendations
   
   ```
   make check apps=couch tests=reduce_stats_test
   ```
   
   and following reproducer script courtesy of @nickva  
   ```
   #!/bin/bash
   
   S=${1:-adm:pass@localhost:15984}
   DB=${2:-statsdb1}
   
   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 https://github.com/apache/couchdb/pull/1377
   
   ## Checklist
   
   - [x] Code is written and works correctly;
   - [x] Changes are covered by tests;
   - [ ] Documentation reflects the changes;
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to