Skip to content

fix: support UpdateXML text() targets - #29364

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
XuPeng-SH:fix/29328-updatexml-text
Sep 24, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
XuPeng-SH:fix/29328-updatexml-text

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • BUG

Which issue(s) this PR fixes:

Fixes #29328.

What this PR does / why we need it:

UPDATEXML rejected XPath expressions ending in text(). MySQL 8.0.45 parses terminal text() without changing the current XPath context when choosing the source span for replacement. Normalize the terminal step to self for UpdateXML only, retaining descendant behavior and union deduplication. This replaces the containing element or document when exactly one context node is selected; multiple targets leave the original XML unchanged. ExtractValue remains unchanged.

Validation

  • A new focused test failed against the base commit with the unsupported-target error and passed after the fix. It covers 14 text-target cases plus NULL document behavior.
  • Focused and full ./pkg/sql/plan/function tests passed through mo-cgo-test with matching native artifacts.
  • go vet -mod=readonly ./pkg/sql/plan/function passed. Incremental golangci-lint 2.5.0 built with Go 1.26.4 reported 0 issues.
  • The existing XML SQL suite passed normal mo-tester comparison twice against a task-owned standalone service: 63/63 statements on each run, zero failed/ignored/abnormal. The service was shut down afterward.
  • gofmt and git diff --check passed. Independent GPT-6 medium design and final whole-diff review found no blockers.
  • A follow-up source review at 9cb12c655f found no additional correctness or performance change justified. Independent MySQL 8.0.45 checks confirmed terminal text() behavior for root/nested/empty/split/CDATA text, descendant and union paths, parent/relative/document paths, and attribute contexts.

CI status at 9cb12c655f

Shared build, Linux UT, UT coverage, and arm64 SCA passed. The PROXY and PESSIMISTIC Compose BVT jobs failed during topology startup: Docker could not pull the pinned Quay MinIO image (unauthorized), before any MatrixOne SQL or BVT case ran. Coverage and CI Required are downstream failures. This is a shared CI dependency, tracked in #29367; these red checks do not establish an XML regression. Re-run both BVT topologies at this exact head after the image source is restored.

Risk and rollback

The behavior change is limited to UpdateXML paths whose final step is text(). Existing malformed XML, invalid XPath, warning, cancellation, and budget paths remain covered by the XML suite. SQL expected-output metadata for two warning-count columns and an empty warning set was refreshed to match the service output while retaining value assertions. Revert this commit to restore the previous rejection behavior.

No distributed topology or GPU test was run locally; this is a scalar XML evaluator change.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

深度审查完成:head c09870b2ce3777c7ff4afe6764bf39a7848d8e1c,merge-base 44e5226a21。未发现阻塞问题,代码层面建议合并。

已覆盖全部 4 个变更文件,并追踪 XPath 编译、终端 text() 转换、descendant-or-self 展开、union 去重和源文本范围替换。与 MySQL 8.0.45 源码 对照,终端 text() 保留当前上下文、且仅在选中一个节点时替换的行为一致。编译后的 program 属于单次 executeXMLFunction 调用,UpdateXML 的原地转换不会污染 ExtractValue 或下一次调用。NULL、掩码、畸形 XML、取消及输入/输出/工作量预算仍沿现有路径处理,没有新增外部资源或跨调用共享状态。

目标 issue #29328 的两条原始复现均已映射到回归输入和明确的替换结果;14 个 text-target 单测还覆盖空元素、分段文本、CDATA、无匹配、多目标、union、后代、文档及属性上下文,另有 NULL 场景。BVT 保留了既有 ExtractValue 和元素替换控制。

验证证据:复用当前 head 的成功 CI,包括函数包所在的 Ubuntu UT、ARM64 SCA、UT Coverage 和 PROXY/PESSIMISTIC 两组多 CN BVT。PR 另记录本地 XML 套件两次 63/63;本次没有重新启动服务或重跑该套件。当前 head 的 BVT 已成功,PR 描述中针对旧 head 9cb12c655f 的 MinIO 拉取失败不再代表当前 CI 状态。

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Compatibility]: UPDATEXML rejects text() node targets supported by MySQL

2 participants