couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vatam...@apache.org
Subject [couchdb] 01/01: Avoid crashing if a mango query is reduced
Date Thu, 18 Oct 2018 16:01:10 GMT
This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch avoid-hard-crash-on-mango-reduce
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit f1f12a11e2f3e5d31294a5cd311b649d4c5364a2
Author: Nick Vatamaniuc <vatamane@apache.org>
AuthorDate: Thu Oct 18 11:43:42 2018 -0400

    Avoid crashing if a mango query is reduced
    
    Previously returning null from mango native proc lead to case clause error in
    couch_query_servers. Instead return a proper shape but with null results for
    each reduction.
---
 src/mango/src/mango_native_proc.erl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mango/src/mango_native_proc.erl b/src/mango/src/mango_native_proc.erl
index 6150e1d..d6b50a4 100644
--- a/src/mango/src/mango_native_proc.erl
+++ b/src/mango/src/mango_native_proc.erl
@@ -89,8 +89,8 @@ handle_call({prompt, [<<"add_fun">>, IndexInfo]}, _From, St)
->
 handle_call({prompt, [<<"map_doc">>, Doc]}, _From, St) ->
     {reply, map_doc(St, mango_json:to_binary(Doc)), St};
 
-handle_call({prompt, [<<"reduce">>, _, _]}, _From, St) ->
-    {reply, null, St};
+handle_call({prompt, [<<"reduce">>, RedSrcs, _]}, _From, St) ->
+    {reply, [true, [null || _ <- RedSrcs]], St};
 
 handle_call({prompt, [<<"rereduce">>, _, _]}, _From, St) ->
     {reply, null, St};


Mime
View raw message