Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F10F01898E for ; Tue, 30 Jun 2015 02:46:40 +0000 (UTC) Received: (qmail 87849 invoked by uid 500); 30 Jun 2015 02:46:40 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 87790 invoked by uid 500); 30 Jun 2015 02:46:40 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 87780 invoked by uid 99); 30 Jun 2015 02:46:40 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Jun 2015 02:46:40 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A878EE360F; Tue, 30 Jun 2015 02:46:40 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kocolosk@apache.org To: commits@couchdb.apache.org Date: Tue, 30 Jun 2015 02:46:43 -0000 Message-Id: <5a3245cad7f84d319dc4ca28783eea68@git.apache.org> In-Reply-To: <351cdf3b5a4449d1b95490cd9a0ecbe2@git.apache.org> References: <351cdf3b5a4449d1b95490cd9a0ecbe2@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [4/4] couch-mrview commit: updated refs/heads/1805-respect-collation-setting-reduce-group to ba84fb8 Use proper collation fun for reduce grouping We had been using raw collation for grouping keys in a MR view regardless of the overall collation setting for the view. This patch defers the construction of the grouping function to the btree code, where we have access to the correct sorting function. COUCHDB-1805 Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/commit/ba84fb80 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/ba84fb80 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/ba84fb80 Branch: refs/heads/1805-respect-collation-setting-reduce-group Commit: ba84fb80900e9a86ffa7a05dfcac3c092f2920e1 Parents: 14f5bba Author: Adam Kocoloski Authored: Fri Jun 26 20:34:28 2015 -0400 Committer: Adam Kocoloski Committed: Mon Jun 29 22:45:41 2015 -0400 ---------------------------------------------------------------------- src/couch_mrview.erl | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/ba84fb80/src/couch_mrview.erl ---------------------------------------------------------------------- diff --git a/src/couch_mrview.erl b/src/couch_mrview.erl index f4ba6e1..5583f1f 100644 --- a/src/couch_mrview.erl +++ b/src/couch_mrview.erl @@ -440,8 +440,8 @@ red_fold(Db, {_Nth, _Lang, View}=RedView, Args, Callback, UAcc) -> update_seq=View#mrview.update_seq, args=Args }, - GroupFun = group_rows_fun(Args#mrargs.group_level), - OptList = couch_mrview_util:key_opts(Args, [{key_group_fun, GroupFun}]), + Grouping = {key_group_level, Args#mrargs.group_level}, + OptList = couch_mrview_util:key_opts(Args, [Grouping]), Acc2 = lists:foldl(fun(Opts, Acc0) -> {ok, Acc1} = couch_mrview_util:fold_reduce(RedView, fun red_fold/3, Acc0, Opts), @@ -530,18 +530,6 @@ make_meta(Args, UpdateSeq, Base) -> end. -group_rows_fun(exact) -> - fun({Key1,_}, {Key2,_}) -> Key1 == Key2 end; -group_rows_fun(0) -> - fun(_A, _B) -> true end; -group_rows_fun(GroupLevel) when is_integer(GroupLevel) -> - fun({[_|_] = Key1,_}, {[_|_] = Key2,_}) -> - lists:sublist(Key1, GroupLevel) == lists:sublist(Key2, GroupLevel); - ({Key1,_}, {Key2,_}) -> - Key1 == Key2 - end. - - default_cb(complete, Acc) -> {ok, lists:reverse(Acc)}; default_cb({final, Info}, []) ->