diff options
author | Nick Vatamaniuc <vatamane@apache.org> | 2018-10-18 11:43:42 -0400 |
---|---|---|
committer | Nick Vatamaniuc <nickva@users.noreply.github.com> | 2018-10-18 13:20:32 -0400 |
commit | 4a76ccbd51786218f8bf20b888bbb23e40a019db (patch) | |
tree | 93391ab84a1bb0ea82ed3a464cfd99ac70a8a523 | |
parent | c980b8016dcf2c205571c3fb9d25f44e2f631074 (diff) | |
download | couchdb-4a76ccbd51786218f8bf20b888bbb23e40a019db.tar.gz |
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.
-rw-r--r-- | src/mango/src/mango_native_proc.erl | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mango/src/mango_native_proc.erl b/src/mango/src/mango_native_proc.erl index 6150e1d19..4c536f871 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 |