You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Python JSON string expressions use numeric addition when concatenated #32037
On main b86ddaf, json_extract_string() and json_unquote() declare no SQLAlchemy return type. Combining two such expressions with + therefore selects numeric addition instead of string concatenation. JSON member .astext uses json_extract_string and is affected too.
This also affects numeric-looking strings: '12' + '34' should concatenate to '1234', not add to 46. A Python string literal on one side can mask the bug because SQLAlchemy infers a string operator from that operand.
Twelve offline regression cases cover both functions and .astext with ordinary text, numeric text, Unicode and SQL NULL. They fail before declaring String return types and pass afterward. SQLite callbacks model the functions' string/NULL return values to exercise SQLAlchemy operator selection; the generated MatrixOne SQL is checked separately. This is client-side validation, not a live MatrixOne result claim.
QA handoff (not acceptance): #32038 merged into main at 3474c0f743977460929241a1364137190f65135e on 2026-11-02 18:28 UTC; final PR head 88db51d22f2eb81ff859eeeae89f19a37d57c5e4.
The fix declares SQLAlchemy String return types for json_extract_string and json_unquote, covering JSON member .astext and restoring CONCAT selection when both operands are extracted strings. No unfinished development follow-up or current applicable counterexample was found in the complete issue/PR discussion.
Evidence reviewed remotely: the author reports all 12 new cases failing before the fix, then offline suites passing across SQLAlchemy 1.4.54, 2.0.55 and 2.1.6. The review found no actionable findings. Final PR-head CI Required, eight Python offline jobs and two core-import jobs succeeded. Online SDK CI was skipped.
This handoff pass ran no local tests. SQLite callbacks exercise client operator semantics and MatrixOne SQL compilation; they do not prove live MatrixOne query results. QA should verify the final merged version against a live server with both functions and .astext, ordinary/numeric-looking strings ('12' and '34' → '1234'), Unicode and SQL NULL, including both operands as expressions and SQLAlchemy 1.4/2.0/2.1. Keep server behavior and client compilation evidence distinct.
Handing to @Ariznawlll for QA; leave the issue open for the QA outcome.
Activity
fix(python): preserve JSON string concatenation semantics (#32038)
XuPeng-SH commentedon Nov 2, 2026
QA handoff (not acceptance): #32038 merged into main at
3474c0f743977460929241a1364137190f65135eon 2026-11-02 18:28 UTC; final PR head88db51d22f2eb81ff859eeeae89f19a37d57c5e4.The fix declares SQLAlchemy String return types for json_extract_string and json_unquote, covering JSON member .astext and restoring CONCAT selection when both operands are extracted strings. No unfinished development follow-up or current applicable counterexample was found in the complete issue/PR discussion.
Evidence reviewed remotely: the author reports all 12 new cases failing before the fix, then offline suites passing across SQLAlchemy 1.4.54, 2.0.55 and 2.1.6. The review found no actionable findings. Final PR-head CI Required, eight Python offline jobs and two core-import jobs succeeded. Online SDK CI was skipped.
This handoff pass ran no local tests. SQLite callbacks exercise client operator semantics and MatrixOne SQL compilation; they do not prove live MatrixOne query results. QA should verify the final merged version against a live server with both functions and .astext, ordinary/numeric-looking strings ('12' and '34' → '1234'), Unicode and SQL NULL, including both operands as expressions and SQLAlchemy 1.4/2.0/2.1. Keep server behavior and client compilation evidence distinct.
Handing to @Ariznawlll for QA; leave the issue open for the QA outcome.
Ariznawlll commentedon Nov 3, 2026
结论
测试通过。两个 JSON 字符串表达式相加时,SDK 选择字符串拼接并在真实 MO 上返回正确结果。
关键证据
main@d61a7206c16b30baa4efc525eb6067c4364035aa,隔离 MO、Python 3.12,SQLAlchemy 1.4.54、2.0.55、2.1.6。修复 #32038 的 SDK 离线矩阵及 CI Required 通过;online CI 跳过,下述在线结果是本次独立实测。json_extract_string、JSON 成员.astext和json_unquote分别使用两个表达式做拼接,覆盖普通文本、数字字符串和 Unicode:例如'12' + '34'返回'1234'。每个 SQLAlchemy 版本均在真实服务运行三轮,每轮 12 组值断言;还在第二个 CN 入口复测三轮。12 + 34 = 46,三轮通过。clients/python/tests/offline/test_json_string_concatenation.py检查三种表达式的 SQLAlchemy 运算符选择、MatrixOne SQL 编译和 NULL 语义;本地相关离线选择在上述三种版本各为 37 passed + 20 subtests。SQLite 离线结果和真实 MO 查询结果分别记录。此缺陷在 SDK 表达式类型,回归放在 SDK 测试而非 SQL MOTR。待解决点
无本 issue 范围内待解决项。CI online 未运行;本次已对隔离 MO 的两个 CN 入口做真实调用,不把两个入口等同于分布式执行计划。