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 59a976d0349d36dba832aba92834ed645c2b3cea Author: Nick Vatamaniuc <vatam...@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 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mango/src/mango_native_proc.erl b/src/mango/src/mango_native_proc.erl index 6150e1d..4c536f8 100644 --- a/src/mango/src/mango_native_proc.erl +++ b/src/mango/src/mango_native_proc.erl @@ -89,11 +89,11 @@ 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}; +handle_call({prompt, [<<"rereduce">>, RedSrcs, _]}, _From, St) -> + {reply, [true, [null || _ <- RedSrcs]], St}; handle_call({prompt, [<<"index_doc">>, Doc]}, _From, St) -> Vals = case index_doc(St, mango_json:to_binary(Doc)) of