couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iil...@apache.org
Subject [1/2] couch commit: updated refs/heads/master to 5685f17
Date Wed, 08 Mar 2017 21:22:50 GMT
Repository: couchdb-couch
Updated Branches:
  refs/heads/master cb3b35a73 -> 5685f172d


Fix initial accumulator value for builtin_sum_rows

This a fixup for https://github.com/apache/couchdb-couch/pull/229.
The initial value for accumulator suppose to be 0. Since the result of
sum and count is integer. The problem was discovered by dialyzer.

COUCHDB-3305


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/1f152daa
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/1f152daa
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/1f152daa

Branch: refs/heads/master
Commit: 1f152daaac23dc96132139fb532786f77becdd64
Parents: cb3b35a
Author: ILYA Khlopotov <iilyak@apache.org>
Authored: Wed Mar 8 12:24:46 2017 -0800
Committer: ILYA Khlopotov <iilyak@apache.org>
Committed: Wed Mar 8 12:24:46 2017 -0800

----------------------------------------------------------------------
 src/couch_query_servers.erl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/1f152daa/src/couch_query_servers.erl
----------------------------------------------------------------------
diff --git a/src/couch_query_servers.erl b/src/couch_query_servers.erl
index ddc079e..63b0e39 100644
--- a/src/couch_query_servers.erl
+++ b/src/couch_query_servers.erl
@@ -142,13 +142,13 @@ os_rereduce(Lang, OsRedSrcs, KVs) ->
 builtin_reduce(_Re, [], _KVs, Acc) ->
     {ok, lists:reverse(Acc)};
 builtin_reduce(Re, [<<"_sum",_/binary>>|BuiltinReds], KVs, Acc) ->
-    Sum = builtin_sum_rows(KVs, []),
+    Sum = builtin_sum_rows(KVs, 0),
     builtin_reduce(Re, BuiltinReds, KVs, [Sum|Acc]);
 builtin_reduce(reduce, [<<"_count",_/binary>>|BuiltinReds], KVs, Acc) ->
     Count = length(KVs),
     builtin_reduce(reduce, BuiltinReds, KVs, [Count|Acc]);
 builtin_reduce(rereduce, [<<"_count",_/binary>>|BuiltinReds], KVs, Acc) ->
-    Count = builtin_sum_rows(KVs, []),
+    Count = builtin_sum_rows(KVs, 0),
     builtin_reduce(rereduce, BuiltinReds, KVs, [Count|Acc]);
 builtin_reduce(Re, [<<"_stats",_/binary>>|BuiltinReds], KVs, Acc) ->
     Stats = builtin_stats(Re, KVs),


Mime
View raw message