You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2023/02/16 03:14:26 UTC
[couchdb] branch main updated: mango: Fix specification of `choose_best_index/1`
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git
The following commit(s) were added to refs/heads/main by this push:
new 97fdac3af mango: Fix specification of `choose_best_index/1`
97fdac3af is described below
commit 97fdac3af36c378a3fe634942c3ac76e785f16de
Author: Gabor Pali <ga...@ibm.com>
AuthorDate: Thu Feb 16 02:57:24 2023 +0100
mango: Fix specification of `choose_best_index/1`
Comparators are not represented by binary strings in the selection
ranges, captured by the `range/0` type. Although that is how they
are coming from the corresponding parsed JSON object, they are
being translated to specific atoms on the fly.
Noticed by: nickva
---
src/mango/src/mango_cursor_view.erl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/mango/src/mango_cursor_view.erl b/src/mango/src/mango_cursor_view.erl
index a784cf6b0..a8a255f72 100644
--- a/src/mango/src/mango_cursor_view.erl
+++ b/src/mango/src/mango_cursor_view.erl
@@ -231,7 +231,8 @@ composite_prefix([Col | Rest], Ranges) ->
% In the future we can look into doing a cached parallel
% reduce view read on each index with the ranges to find
% the one that has the fewest number of rows or something.
--type range() :: {binary(), any(), binary(), any()} | empty.
+-type comparator() :: '$lt' | '$lte' | '$eq' | '$gte' | '$gt'.
+-type range() :: {comparator(), any(), comparator(), any()} | empty.
-spec choose_best_index(IndexRanges) -> Selection when
IndexRanges :: nonempty_list({#idx{}, [range()], integer()}),