Repository navigation
fix(function): prevent md5 truncation for text and blob - #27883
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.
Deep-reviewed exact head 9c46d67. The root cause and fix boundary match: stored LONGTEXT and LONGBLOB previously took the sole VARCHAR overload and could truncate at 65,535 bytes; direct TEXT and BLOB overloads now reuse the byte-oriented MD5 executor without changing digest, NULL, return-type, or protocol behavior. The focused test proves no implicit cast and the complete 65,536-byte digest for both physical types, while BVT compares stored-column output with an independently constructed full-length expression. I found no blocking correctness, performance, or unhappy-path issue.
|
@Mergifyio Refresh |
❌ Sorry but I didn't understand the command. Please consult the commands documentation 📚. |
…#27883) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: close matrixorigin#27798 ## What this PR does / why we need it: `MD5` only registered a `T_varchar` overload. Stored `LONGTEXT` and `LONGBLOB` values were therefore implicitly converted to `VARCHAR` before hashing, truncating inputs at 65,535 bytes. This PR: - registers direct `T_text` and `T_blob` overloads that reuse the existing `Md5` implementation; - adds a unit regression that verifies both types avoid implicit casts and hash the complete 65,536-byte value; - adds distributed SQL regression cases for `LONGTEXT` and `LONGBLOB`. The existing `T_varchar` overload, return type, digest implementation, SQL schema, and protocol behavior remain unchanged. No dependency or configuration changes are introduced. ## Testing On the final branch based on `matrixorigin/main@4dedea1`: - `go test -vet=off ./pkg/sql/plan/function -run TestMd5 -count=1` - PASS: `ok github.com/matrixorigin/matrixone/pkg/sql/plan/function 1.542s` - the same test with `-coverprofile` - PASS: package coverage 0.6% for the targeted test selection; `Md5` function coverage 100.0% - `git diff --check origin/main...HEAD` - PASS Before the final main sync, the same patch was also built as an independent `mo-service` and exercised with the exact 65,536-byte SQL reproduction. MatrixOne returned `2d61aa54b58c2e94403fb092c3dbc027` for both stored `LONGBLOB` and `LONGTEXT`, matching MySQL 8.0.42. Not run: full repository test suite, race, lint, vet, or the complete mo-tester distributed suite. Co-authored-by: XuPeng-SH <[email protected]>
…#27883) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: close matrixorigin#27798 ## What this PR does / why we need it: `MD5` only registered a `T_varchar` overload. Stored `LONGTEXT` and `LONGBLOB` values were therefore implicitly converted to `VARCHAR` before hashing, truncating inputs at 65,535 bytes. This PR: - registers direct `T_text` and `T_blob` overloads that reuse the existing `Md5` implementation; - adds a unit regression that verifies both types avoid implicit casts and hash the complete 65,536-byte value; - adds distributed SQL regression cases for `LONGTEXT` and `LONGBLOB`. The existing `T_varchar` overload, return type, digest implementation, SQL schema, and protocol behavior remain unchanged. No dependency or configuration changes are introduced. ## Testing On the final branch based on `matrixorigin/main@4dedea1`: - `go test -vet=off ./pkg/sql/plan/function -run TestMd5 -count=1` - PASS: `ok github.com/matrixorigin/matrixone/pkg/sql/plan/function 1.542s` - the same test with `-coverprofile` - PASS: package coverage 0.6% for the targeted test selection; `Md5` function coverage 100.0% - `git diff --check origin/main...HEAD` - PASS Before the final main sync, the same patch was also built as an independent `mo-service` and exercised with the exact 65,536-byte SQL reproduction. MatrixOne returned `2d61aa54b58c2e94403fb092c3dbc027` for both stored `LONGBLOB` and `LONGTEXT`, matching MySQL 8.0.42. Not run: full repository test suite, race, lint, vet, or the complete mo-tester distributed suite. Co-authored-by: XuPeng-SH <[email protected]>
…#27883) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: close matrixorigin#27798 ## What this PR does / why we need it: `MD5` only registered a `T_varchar` overload. Stored `LONGTEXT` and `LONGBLOB` values were therefore implicitly converted to `VARCHAR` before hashing, truncating inputs at 65,535 bytes. This PR: - registers direct `T_text` and `T_blob` overloads that reuse the existing `Md5` implementation; - adds a unit regression that verifies both types avoid implicit casts and hash the complete 65,536-byte value; - adds distributed SQL regression cases for `LONGTEXT` and `LONGBLOB`. The existing `T_varchar` overload, return type, digest implementation, SQL schema, and protocol behavior remain unchanged. No dependency or configuration changes are introduced. ## Testing On the final branch based on `matrixorigin/main@4dedea1`: - `go test -vet=off ./pkg/sql/plan/function -run TestMd5 -count=1` - PASS: `ok github.com/matrixorigin/matrixone/pkg/sql/plan/function 1.542s` - the same test with `-coverprofile` - PASS: package coverage 0.6% for the targeted test selection; `Md5` function coverage 100.0% - `git diff --check origin/main...HEAD` - PASS Before the final main sync, the same patch was also built as an independent `mo-service` and exercised with the exact 65,536-byte SQL reproduction. MatrixOne returned `2d61aa54b58c2e94403fb092c3dbc027` for both stored `LONGBLOB` and `LONGTEXT`, matching MySQL 8.0.42. Not run: full repository test suite, race, lint, vet, or the complete mo-tester distributed suite. Co-authored-by: XuPeng-SH <[email protected]>
What type of PR is this?
Which issue(s) this PR fixes:
close #27798
What this PR does / why we need it:
MD5only registered aT_varcharoverload. StoredLONGTEXTandLONGBLOBvalues were therefore implicitly converted toVARCHARbefore hashing, truncating inputs at 65,535 bytes.This PR:
T_textandT_bloboverloads that reuse the existingMd5implementation;LONGTEXTandLONGBLOB.The existing
T_varcharoverload, return type, digest implementation, SQL schema, and protocol behavior remain unchanged. No dependency or configuration changes are introduced.Testing
On the final branch based on
matrixorigin/main@4dedea1ebe391c55715d324804ba4cd6ab1e4f08:go test -vet=off ./pkg/sql/plan/function -run TestMd5 -count=1ok github.com/matrixorigin/matrixone/pkg/sql/plan/function 1.542s-coverprofileMd5function coverage 100.0%git diff --check origin/main...HEADBefore the final main sync, the same patch was also built as an independent
mo-serviceand exercised with the exact 65,536-byte SQL reproduction. MatrixOne returned2d61aa54b58c2e94403fb092c3dbc027for both storedLONGBLOBandLONGTEXT, matching MySQL 8.0.42.Not run: full repository test suite, race, lint, vet, or the complete mo-tester distributed suite.