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 2020/07/29 20:15:37 UTC

[couchdb] branch prototype/fdb-layer-ebtree-group-reduce-fix created (now f8fdf97)

This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a change to branch prototype/fdb-layer-ebtree-group-reduce-fix
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


      at f8fdf97  Call collate for group equality

This branch includes the following new commits:

     new f8fdf97  Call collate for group equality

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[couchdb] 01/01: Call collate for group equality

Posted by rn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch prototype/fdb-layer-ebtree-group-reduce-fix
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit f8fdf9721e2ac932022065bc075301641568d67c
Author: Robert Newson <rn...@apache.org>
AuthorDate: Wed Jul 29 21:15:01 2020 +0100

    Call collate for group equality
---
 src/ebtree/src/ebtree.erl | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/ebtree/src/ebtree.erl b/src/ebtree/src/ebtree.erl
index ceb78fb..bae0ff3 100644
--- a/src/ebtree/src/ebtree.erl
+++ b/src/ebtree/src/ebtree.erl
@@ -339,7 +339,7 @@ group_reduce(Db, #tree{} = Tree, StartKey, EndKey, GroupKeyFun, UserAccFun, User
                 collate(Tree, Key, StartKey, if InclusiveStart -> [gt, eq]; true -> [gt] end) andalso
                 collate(Tree, Key, EndKey, if InclusiveEnd -> [lt, eq]; true -> [lt] end),
             KeyGroup = GroupKeyFun(Key),
-            SameGroup = CurrentGroup =:= KeyGroup,
+            SameGroup = collate(Tree, CurrentGroup, KeyGroup, [eq]),
             if
                 Dir == fwd andalso BeforeStart ->
                     {ok, {CurrentGroup, UserAcc, MapAcc, ReduceAcc}};
@@ -361,7 +361,9 @@ group_reduce(Db, #tree{} = Tree, StartKey, EndKey, GroupKeyFun, UserAccFun, User
         ({traverse, FirstKey, LastKey, Reduction}, {CurrentGroup, UserAcc, MapAcc, ReduceAcc}) ->
             BeforeStart = collate(Tree, LastKey, StartKey, if InclusiveStart -> [lt]; true -> [lt, eq] end),
             AfterEnd = collate(Tree, FirstKey, EndKey, if InclusiveEnd -> [gt]; true -> [gt, eq] end),
-            Whole = CurrentGroup =:= GroupKeyFun(FirstKey) andalso CurrentGroup =:= GroupKeyFun(LastKey),
+            Whole =
+                collate(Tree, CurrentGroup, GroupKeyFun(FirstKey), [eq]) andalso
+                collate(Tree, CurrentGroup, GroupKeyFun(LastKey), [eq]),
             FirstInRange =
                 collate(Tree, FirstKey, StartKey, if InclusiveStart -> [gt, eq]; true -> [gt] end) andalso
                 collate(Tree, FirstKey, EndKey, if InclusiveEnd -> [lt, eq]; true -> [lt] end),