Repository navigation
fix(json): preserve boundary quotes in unquote - #27449
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed exact head c9db6cdb3c2d4ecefea2fd9157f983ab46404d1f against base 344d852ac3288e391a3ae6be3e3c7108caf2b75d.
The fix is at the correct representation layer: TpCodeString stores an already-decoded, length-prefixed payload, so returning it directly preserves leading/trailing quote characters and avoids treating payload bytes as JSON delimiters. Date/time/datetime, non-string JSON values, legacy BLOB, opaque, and BIT behavior remain unchanged. I traced the shared path through JSON_UNQUOTE for VARCHAR and binary JSON, JSON_EXTRACT_STRING, and JSON-to-string casts; the new regression matrix covers the affected entry points and quote-only/Unicode boundaries.
Full pkg/container/bytejson and pkg/sql/plan/function tests, full race suites, vet, and diff checks pass. Latest required CI is green, the exact head is mergeable, and I found no blocking or non-blocking issues.
Merge Queue Status
This pull request spent 1 hour 26 minutes 42 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #27449 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Tick the box to put this pull request back in the merge queue (same as
|
aptend
left a comment
There was a problem hiding this comment.
Deep-reviewed exact head c9db6cdb3c2d4ecefea2fd9157f983ab46404d1f, including the full diff and complete review/comment/thread state. TpCodeString consistently stores the already-decoded payload in its length-prefixed binary representation, so returning GetString() directly fixes boundary-quote loss without changing date/time, opaque, bit, blob, or non-string JSON semantics. I also audited the parser, JSON aggregate, typed-value, JSON_UNQUOTE, and JSON_EXTRACT_STRING construction paths for that representation invariant.
Validation: full pkg/container/bytejson and pkg/sql/plan/function tests; focused race tests with -count=3; a deterministic 10,000-case JSON marshal/parse/unquote round-trip covering quotes, escapes, controls, NUL, and Unicode; go vet; and git diff --check all pass. The temporary counterexample test was removed. No blocking correctness or compatibility issue found.
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#27427 ## What this PR does / why we need it: `JSON_UNQUOTE` and related JSON string extraction paths incorrectly removed the first and last characters when the decoded string payload itself began and ended with double quotes. Binary JSON string values already store the decoded payload without JSON representation delimiters, so payload content must not be interpreted as delimiters. This PR returns `TpCodeString` payloads directly and adds regression coverage for boundary quotes, embedded quotes, quote-only strings, Unicode, both `VARCHAR` and binary JSON inputs, and `JSON_EXTRACT_STRING`. Validation completed locally: - `make config` - `make err-check` - `go test ./pkg/container/bytejson ./pkg/sql/plan/function` - race tests for both affected packages - `go vet ./pkg/container/bytejson ./pkg/sql/plan/function` - latest local MatrixOne binary build - original failure reproduced 20/20 times - fixed JSON boundary matrix: 320/320 assertions passed across four APIs Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#27427 ## What this PR does / why we need it: `JSON_UNQUOTE` and related JSON string extraction paths incorrectly removed the first and last characters when the decoded string payload itself began and ended with double quotes. Binary JSON string values already store the decoded payload without JSON representation delimiters, so payload content must not be interpreted as delimiters. This PR returns `TpCodeString` payloads directly and adds regression coverage for boundary quotes, embedded quotes, quote-only strings, Unicode, both `VARCHAR` and binary JSON inputs, and `JSON_EXTRACT_STRING`. Validation completed locally: - `make config` - `make err-check` - `go test ./pkg/container/bytejson ./pkg/sql/plan/function` - race tests for both affected packages - `go vet ./pkg/container/bytejson ./pkg/sql/plan/function` - latest local MatrixOne binary build - original failure reproduced 20/20 times - fixed JSON boundary matrix: 320/320 assertions passed across four APIs Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#27427 ## What this PR does / why we need it: `JSON_UNQUOTE` and related JSON string extraction paths incorrectly removed the first and last characters when the decoded string payload itself began and ended with double quotes. Binary JSON string values already store the decoded payload without JSON representation delimiters, so payload content must not be interpreted as delimiters. This PR returns `TpCodeString` payloads directly and adds regression coverage for boundary quotes, embedded quotes, quote-only strings, Unicode, both `VARCHAR` and binary JSON inputs, and `JSON_EXTRACT_STRING`. Validation completed locally: - `make config` - `make err-check` - `go test ./pkg/container/bytejson ./pkg/sql/plan/function` - race tests for both affected packages - `go vet ./pkg/container/bytejson ./pkg/sql/plan/function` - latest local MatrixOne binary build - original failure reproduced 20/20 times - fixed JSON boundary matrix: 320/320 assertions passed across four APIs Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #27427
What this PR does / why we need it:
JSON_UNQUOTEand related JSON string extraction paths incorrectly removedthe first and last characters when the decoded string payload itself began
and ended with double quotes. Binary JSON string values already store the
decoded payload without JSON representation delimiters, so payload content
must not be interpreted as delimiters.
This PR returns
TpCodeStringpayloads directly and adds regression coveragefor boundary quotes, embedded quotes, quote-only strings, Unicode, both
VARCHARand binary JSON inputs, andJSON_EXTRACT_STRING.Validation completed locally:
make configmake err-checkgo test ./pkg/container/bytejson ./pkg/sql/plan/functiongo vet ./pkg/container/bytejson ./pkg/sql/plan/function