You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2011/12/31 00:32:00 UTC

[2/3] git commit: CouchDB-1367 - Fix function_clause in _stats when no rows are emitted

CouchDB-1367 - Fix function_clause in _stats when no rows are emitted


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

Branch: refs/heads/master
Commit: 389142e0eee59f10c8f7d6f16adfae1629cad0ae
Parents: ee00d81
Author: Robert Newson <rn...@apache.org>
Authored: Fri Dec 30 23:30:24 2011 +0000
Committer: Robert Newson <rn...@apache.org>
Committed: Fri Dec 30 23:31:12 2011 +0000

----------------------------------------------------------------------
 src/couchdb/couch_query_servers.erl |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/389142e0/src/couchdb/couch_query_servers.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_query_servers.erl b/src/couchdb/couch_query_servers.erl
index c9c2bc6..e29f23b 100644
--- a/src/couchdb/couch_query_servers.erl
+++ b/src/couchdb/couch_query_servers.erl
@@ -205,6 +205,8 @@ sum_terms([X|Xs], [Y|Ys]) when is_number(X), is_number(Y) ->
 sum_terms(_, _) ->
     throw({invalid_value, <<"builtin _sum function requires map values to be numbers or lists of numbers">>}).
 
+builtin_stats(reduce, []) ->
+    {[]};
 builtin_stats(reduce, [[_,First]|Rest]) when is_number(First) ->
     Stats = lists:foldl(fun([_K,V], {S,C,Mi,Ma,Sq}) when is_number(V) ->
         {S+V, C+1, lists:min([Mi, V]), lists:max([Ma, V]), Sq+(V*V)};