Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added comments and clarity to the reduce/combine test. again

git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@664093 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit cba120e5615e3d37de01bc63fbc8b325108276c5 1 parent b9abcb5
Damien F. Katz authored
Showing with 5 additions and 7 deletions.
  1. +5 −7 share/www/script/couch_tests.js
View
12 share/www/script/couch_tests.js
@@ -361,14 +361,11 @@ var tests = {
if (combine) {
// This is the combine phase, we are re-reducing previosuly returned
// reduce values.
-
for(var i in values) {
count = count + values[i].count;
total = total + values[i].total;
sqrTotal = sqrTotal + (values[i].sqrTotal * values[i].sqrTotal);
}
- var variance = (sqrTotal - ((total * total)/count)) / count;
- stdDeviation = Math.sqrt(variance);
}
else {
// This is the reduce phase, we are reducing over emitted values from
@@ -378,12 +375,13 @@ var tests = {
sqrTotal = sqrTotal + (values[i] * values[i])
}
count = values.length;
- var variance = (sqrTotal - ((total * total)/count)) / count;
- stdDeviation = Math.sqrt(variance);
}
- // the reduce results. It contains enough information to compute
- // further reduce results, and the final output values.
+ var variance = (sqrTotal - ((total * total)/count)) / count;
+ stdDeviation = Math.sqrt(variance);
+
+ // the reduce result. It contains enough information to combine with
+ // more reduce results, and the final output values.
return {"stdDeviation":stdDeviation,"count":count,
"total":total,"sqrTotal":sqrTotal};
};
Please sign in to comment.
Something went wrong with that request. Please try again.