UpdateItem: ADD through a missing parent map creates the map, and DynamoDB refuses the path

未关闭 适合新手
#939 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 5 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust
领域
databases

调研方向

阅读 crates/core/src/expression/update_evaluator.rs,重点查看 navigate_to_parent_map_or_create 及其在 apply_add 中的用法。将当前行为与 issue 中列出的 DynamoDB 情况进行比较。当缺失的中间 map 元素导致文档路径被拒绝,同时最后两种情况仍然成功时,即为完成;为这些情况添加或运行针对性测试。

由索引模型根据 Issue 内容生成。

描述

DynamoDB refuses an ADD action whose path goes through a map that does not exist. ExtendDB creates the missing maps and applies the ADD.

Measured in us-east-1 on 2026-11-10 at 21:19 UTC, two sends of each request, with UpdateItem on a table whose key is pk:

Item before the update Update expression DynamoDB
no item ADD a.b.c :v, :v = 1 ValidationException, "The document path provided in the update expression is invalid for update". No item is created.
an item without a ADD a.b.c :v, :v = 1 The same refusal. The item does not change.
a = {} ADD a.b.c :v, :v = 1 The same refusal. The item does not change.
a = {} ADD a.b.c :v, :v = the string set ["x"] The same refusal. The item does not change.
a = {} ADD a.b :v, :v = 1 200. a is {b: 1}.
a = {b: {}} ADD a.b.c :v, :v = 1 200. a is {b: {c: 1}}.

In ExtendDB, apply_add finds the parent map of the last path element with navigate_to_parent_map_or_create (crates/core/src/expression/update_evaluator.rs, main 29e66ab85). That function inserts an empty map for each element of the path that does not exist. So ExtendDB applies the first four requests: it creates the missing maps and stores the number or the set at a.b.c (from the code). For the first request it also creates the item. The last two rows give the same answer on both.

Proposed fix: in navigate_to_parent_map_or_create, answer the document path refusal when an element before the last one does not exist.

主要语言
Rust
星标
517
派生
60
平均合并
5 天 21 小时
30 天内合并 PR
110

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ExtendDB/extenddb 的其他 Issue

查看 ExtendDB/extenddb 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。