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

[3/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/3e24328f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/3e24328f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/3e24328f

Branch: refs/heads/1.1.x
Commit: 3e24328feae59daa2b3e4a8fddcfbf7148b0ae44
Parents: 3816108
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:30:24 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/3e24328f/src/couchdb/couch_query_servers.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_query_servers.erl b/src/couchdb/couch_query_servers.erl
index f8bbcae..dd327c1 100644
--- a/src/couchdb/couch_query_servers.erl
+++ b/src/couchdb/couch_query_servers.erl
@@ -194,6 +194,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)};