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

jcoglan pushed a commit to branch mango-match-failures
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 02c5865339821751f363ad1bc9e75b1a113effba
Author: James Coglan <[email protected]>
AuthorDate: Mon Jul 20 12:47:02 2026 +0100

    fix: Do not split literal field names like "a.b" into separate path 
elements when reporting VDU failures
---
 src/mango/src/mango_selector.erl | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/mango/src/mango_selector.erl b/src/mango/src/mango_selector.erl
index 375223a84..b600ed36c 100644
--- a/src/mango/src/mango_selector.erl
+++ b/src/mango/src/mango_selector.erl
@@ -815,13 +815,12 @@ format_op(size, true, mismatch, [N]) ->
 
 format_path([]) ->
     [];
-format_path([<<>> | Rest]) ->
-    format_path(Rest) ++ [<<"">>];
 format_path([Item | Rest]) when is_binary(Item) ->
-    {ok, Path} = mango_util:parse_field(Item),
-    format_path(Rest) ++ Path;
+    format_path(Rest) ++ [Item];
 format_path([Item | Rest]) when is_integer(Item) ->
-    format_path(Rest) ++ [Item].
+    format_path(Rest) ++ [Item];
+format_path([Item | Rest]) when is_list(Item) ->
+    format_path(Rest) ++ Item.
 
 % Returns true if Selector requires all
 % fields in RequiredFields to exist in any matching documents.
@@ -2738,8 +2737,9 @@ format_path_test() ->
     ?assertEqual([<<"a">>], format_path([<<"a">>])),
     ?assertEqual([<<"a">>, <<"b">>], format_path([<<"b">>, <<"a">>])),
     ?assertEqual([<<"a">>, <<"">>], format_path([<<"">>, <<"a">>])),
-    ?assertEqual([<<"a">>, <<"b">>, <<"c">>], format_path([<<"b.c">>, 
<<"a">>])),
-    ?assertEqual([<<"a">>, 42, <<"b">>, <<"c">>], format_path([<<"b.c">>, 42, 
<<"a">>])).
+    ?assertEqual([<<"a">>, <<"b.c">>], format_path([<<"b.c">>, <<"a">>])),
+    ?assertEqual([<<"a">>, <<"b">>, <<"c">>], format_path([[<<"b">>, <<"c">>], 
<<"a">>])),
+    ?assertEqual([<<"a">>, 42, <<"b.c">>], format_path([<<"b.c">>, 42, 
<<"a">>])).
 
 % The following benchmarks can be run by adding the following dependencies to
 % rebar.config.script:

Reply via email to