Skip to content

fix(python): preserve JSON string concatenation semantics - #32038

Merged
mergify[bot] merged 2 commits into
matrixorigin:mainfrom
MatrixAdventurer:fix-json-string-concatenation-32037
Nov 2, 2026
Merged

mergify[bot] merged 2 commits into
matrixorigin:mainfrom
MatrixAdventurer:fix-json-string-concatenation-32037

Conversation

@MatrixAdventurer

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • BUG

Which issue(s) this PR fixes:

Fixes #32037

What this PR does / why we need it:

Adding two JSON string expressions generated numeric + instead of CONCAT: json_extract_string(...) + json_extract_string(...), including JSON member .astext, and json_unquote(...) + json_unquote(...). Both functions had SQLAlchemy NullType, so string operator selection was lost unless another operand supplied a string type.

Declare String return types for json_extract_string and json_unquote. This makes two extracted strings such as '12' and '34' concatenate to '1234' rather than selecting numeric addition.

Add 12 regression cases covering both functions and .astext with ordinary text, numeric text, Unicode and SQL NULL. Each case checks MatrixOne CONCAT compilation and executes the SQLAlchemy expression in SQLite with callbacks supplying string/NULL function results. This validates client operator semantics, not a live MatrixOne server.

Validation on base b86ddaf:

  • Before fix: all 12 new cases fail (nine wrong execution results, three NULL cases with wrong MatrixOne SQL).
  • SQLAlchemy 1.4.54: 2961 offline tests passed, plus 103 subtests.
  • SQLAlchemy 2.0.55: 2957 offline tests passed, plus 103 subtests.
  • SQLAlchemy 2.1.6: 2965 offline tests passed, plus 103 subtests.
  • Black, fatal Flake8 checks (E9,F63,F7,F82), and git diff --check passed.

Production changes are limited to the import and two return-type declarations.

@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 →

@mergify mergify Bot added the kind/bug Something isn't working label Nov 2, 2026
@XuPeng-SH

XuPeng-SH commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: 0ca427bbd77e48c7b4d99f959602ae351b5573f5

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-local · review

Commit: 0ca427bbd77e48c7b4d99f959602ae351b5573f5

Assessment: approve

The String return types correctly restore concatenation semantics for both functions and JSON .astext. Reviewed the complete delta, affected consumers, regression oracles and discussion; no actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a1869d-999c-7481-b340-ae4a63e8cee4 · slot 1 · generation 2

Validation:

  • Reused supplied frozen-head CI evidence: eight successful Python offline jobs across SQLAlchemy 1.4, 2.0 and 2.1, plus two successful core-import jobs. Verified that CI selects the new regression cases.

  • Source identity, clean worktree, Python syntax, diff whitespace and discussion coverage passed: checks/1793640961006339979-2.json and review-audit-v2.log.

  • Saved review-plan.md, discussion-assessment.json and validation-summary.json; reconciled check receipts with retained logs.

Limitations:

  • Local Python tests were not run because dependencies are absent; author-reported test counts were not independently reproduced.

  • Online CI was skipped. SQLite callbacks validate client operator semantics, not live MatrixOne results; server behavior is unchanged.

@mergify mergify Bot added the queued label Nov 2, 2026
@mergify

mergify Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

✅ Merged into main as 3474c0f at 18:28 UTC

51 min in the queue, 3 min of it CI.

So far

  • ✅ Entered the queue Mon 2 Nov, 17:37 · rule main · triggered by rule Automatic queue on approval for main
  • ✅ Passed · in place
  • ✅ Merged 18:28 · 3474c0f · squash
3 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection
  • any of · required by GitHub branch protection:
    • check-success = CI Required
    • check-neutral = CI Required
    • check-skipped = CI Required

Times in UTC · dashboard · how the merge queue works

@mergify
mergify Bot merged commit 3474c0f into matrixorigin:main Nov 2, 2026
@mergify mergify Bot removed the queued label Nov 2, 2026
gouhongshen added a commit to gouhongshen/matrixone that referenced this pull request Nov 2, 2026
…stream claimed 97 as narrow_scan in matrixorigin#32034); take upstream narrow-scan prefetch, virtual-timestamp reads, temporal integer casts, vector shuffle ownership, JSON concat and logtail append-range changes

GitHub reported the PR CONFLICTING (DIRTY): upstream matrixorigin#32034 added
`plan.Node.narrow_scan = 97` while this branch's unmerged additive
`ScanReadRole scan_read_role` sat on field 97.

Semantic resolution, both sides kept:
- upstream keeps `narrow_scan = 97` (shipped on main;
  `plan.pb.go` regenerated from the merged proto with the repository
  protoc/gogofast pipeline plus both postprocessors; toolchain verified
  byte-identical against upstream's committed bindings before use);
- this branch's additive `scan_read_role` moves 97 -> 98; nothing ever
  persisted 97 as scan_read_role (unmerged field), provenance comment
  updated in proto/plan.proto;
- `merged_descriptor_test.go` (upstream's merge-collision contract
  guard) extended to pin Node.narrow_scan=97 / Node.scan_read_role=98
  so a future regeneration cannot silently renumber or drop either;
- all other overlapping files auto-merged with both sides' hunks intact
  (upstream: table_scan/narrow-scan scope+operator plumbing, plan binder
  temporal/int-arg changes, disttae datasource, query_builder/types/
  deepcopy/base_binder/apply_indices).

Upstream batch: matrixorigin#31268 (virtual timestamp reads), matrixorigin#32001 (temporal
integer casts), matrixorigin#32020 (vector shuffle ownership), matrixorigin#32031 (logtail
append ranges), matrixorigin#32038 (python JSON-string concatenation; upstream's
own change, no PR-side code), matrixorigin#32034 (narrow-scan prefetch).
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Python JSON string expressions use numeric addition when concatenated

2 participants