[Tarantool-patches] [PATCH 3/3] tuple: JSON path update intersection at maps
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Fri Dec 27 18:52:03 MSK 2019
Thanks for the review!
On 27/12/2019 15:57, Sergey Ostanevich wrote:
> Hi!
>
> Thanks for the patch!
> Just the spaces after unaries - otherwise LGTM.
Fixed:
================================================================================
diff --git a/src/box/xrow_update_map.c b/src/box/xrow_update_map.c
index 65dcb7408..b4251cc3b 100644
--- a/src/box/xrow_update_map.c
+++ b/src/box/xrow_update_map.c
@@ -224,7 +224,7 @@ xrow_update_op_do_map_insert(struct xrow_update_op *op,
struct xrow_update_map_item *item;
if (xrow_update_map_extract_opt_item(field, op, &item) != 0)
return -1;
- if (! xrow_update_op_is_term(op)) {
+ if (!xrow_update_op_is_term(op)) {
if (item == NULL)
return xrow_update_err_no_such_field(op);
op->is_token_consumed = true;
@@ -247,7 +247,7 @@ xrow_update_op_do_map_set(struct xrow_update_op *op,
struct xrow_update_map_item *item;
if (xrow_update_map_extract_opt_item(field, op, &item) != 0)
return -1;
- if (! xrow_update_op_is_term(op)) {
+ if (!xrow_update_op_is_term(op)) {
if (item == NULL)
return xrow_update_err_no_such_field(op);
op->is_token_consumed = true;
@@ -275,7 +275,7 @@ xrow_update_op_do_map_delete(struct xrow_update_op *op,
struct xrow_update_map_item *item;
if (xrow_update_map_extract_opt_item(field, op, &item) != 0)
return -1;
- if (! xrow_update_op_is_term(op)) {
+ if (!xrow_update_op_is_term(op)) {
if (item == NULL)
return xrow_update_err_no_such_field(op);
op->is_token_consumed = true;
@@ -318,7 +318,7 @@ xrow_update_op_do_map_##op_type(struct xrow_update_op *op, \
xrow_update_map_extract_item(field, op); \
if (item == NULL) \
return -1; \
- if (! xrow_update_op_is_term(op)) { \
+ if (!xrow_update_op_is_term(op)) { \
op->is_token_consumed = true; \
return xrow_update_op_do_field_##op_type(op, &item->field); \
} \
================================================================================
>
> If I got it right, the limitation from the #2 patch:
>
> | This is not allowed yet:
> |
> | [1][2][3].a.b.c = 20
> | [1][2][3].a.e.f = 30
> |
> | First difference is 'b' vs 'e' - intersection by a map,
> | not ok.
>
> is removed. Could you mention this in the description?
>
Sure. New commit message (prior to doc request):
================================================================================
tuple: JSON path update intersection at maps
Previous commits introduced isolated JSON updates, and then
allowed intersection at array. This one completes the puzzle,
adding intersection at maps, so now both these samples work:
Allowed in the previous commit:
[1][2][3].a.b.c = 20
[1][2][4].e.f.g = 30
^
First difference is [3] vs [4] - intersection by an array.
Allowed in this commit:
[1][2][3].a.b.c = 20
[1][2][3].a.e.f = 30
^
First difference is 'b' vs 'e' - intersection by a map.
Now JSON updates are fully available.
Closes #1261
================================================================================
More information about the Tarantool-patches
mailing list