Skip to content

Conversation

YangKeao
Copy link
Member

What problem does this PR solve?

Issue Number: close #59465

Problem Summary:

Previously, JSON_ARRAY_APPEND('[1]', '$', '[2,3]') will give [1,2,3], which is not expected. It's because in TiDB the JSON_ARRAY_APPEND shared the same implementation with JSON_MERGE. To fix this issue, we should wrap the new item with an array when passing it to the merge logic.

What changed and how does it work?

Wrap the new item with array before re-using the merge logic.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/needs-triage-completed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed do-not-merge/needs-triage-completed labels Feb 21, 2025
@YangKeao YangKeao requested review from xhebox and XuHuaiyu February 21, 2025 06:37
Copy link

codecov bot commented Feb 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.6191%. Comparing base (a116b4e) to head (11c0871).
Report is 10 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #59688        +/-   ##
================================================
+ Coverage   72.9684%   73.6191%   +0.6507%     
================================================
  Files          1697       1697                
  Lines        468907     470323      +1416     
================================================
+ Hits         342154     346248      +4094     
+ Misses       105690     103083      -2607     
+ Partials      21063      20992        -71     
Flag Coverage Δ
integration 42.7797% <100.0000%> (?)
unit 72.4337% <100.0000%> (+0.2536%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.6910% <ø> (ø)
parser ∅ <ø> (∅)
br 45.1304% <ø> (+0.0282%) ⬆️

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Feb 21, 2025
Copy link

ti-chi-bot bot commented Feb 25, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: xhebox, XuHuaiyu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Feb 25, 2025
Copy link

ti-chi-bot bot commented Feb 25, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-02-21 07:49:48.012299339 +0000 UTC m=+1206830.408521400: ☑️ agreed by xhebox.
  • 2025-02-25 07:37:50.737846229 +0000 UTC m=+341418.691004495: ☑️ agreed by XuHuaiyu.

@YangKeao
Copy link
Member Author

/retest

@ti-chi-bot ti-chi-bot bot merged commit fed0251 into pingcap:master Feb 25, 2025
24 checks passed
zeminzhou pushed a commit to zeminzhou/tidb that referenced this pull request May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JSON_ARRAY_APPEND returns incorrect value for array arguments
3 participants