You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ii...@apache.org on 2025/06/27 17:15:48 UTC

(couchdb) 03/05: fixup! Implement csrt:query/2 and csrt:query/4

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

iilyak pushed a commit to branch couch-stats-resource-tracker-v3-rebase-http-2
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit d9d6bc747cbb907c6fc92425f652bd160590e141
Author: ILYA Khlopotov <ii...@apache.org>
AuthorDate: Fri Jun 27 09:21:00 2025 -0700

    fixup! Implement csrt:query/2 and csrt:query/4
---
 src/couch_stats/src/csrt_query.erl | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/couch_stats/src/csrt_query.erl b/src/couch_stats/src/csrt_query.erl
index 7ef350d73..f96e3fc65 100644
--- a/src/couch_stats/src/csrt_query.erl
+++ b/src/couch_stats/src/csrt_query.erl
@@ -340,9 +340,11 @@ when
 query(MatcherName, AggregationKeys, ValueKey, Options) ->
     AggregationKey = parse_key(AggregationKeys),
     VKey = parse_key(ValueKey),
-    Limit = maps:get(Options, aggregation, query_limit()),
-    Aggregation = maps:get(Options, aggregation, none),
+    Limit = maps:get(limit, Options, query_limit()),
+    Aggregation = maps:get(aggregation, Options, none),
     maybe
+        ok ?= validate_not_error(AggregationKey),
+        ok ?= validate_not_error(VKey),
         ok ?= validate_limit(Limit),
         ok ?= validate_aggregation(Aggregation),
         {ok, Matcher} ?= get_matcher(MatcherName),
@@ -360,6 +362,11 @@ query(MatcherName, AggregationKeys, ValueKey, Options) ->
         end
     end.
 
+validate_not_error({error, _} = Error) ->
+    Error;
+validate_not_error(_) ->
+    ok.
+
 query_limit() ->
     config:get_integer(?CSRT, "query_limit", ?QUERY_LIMIT).