Phixsura opened a new pull request, #38699:
URL: https://github.com/apache/shardingsphere/pull/38699

   Fixes #24107.
   
   Changes proposed in this pull request:
     - Add `ComparableByteArray`, a tiny `Comparable` wrapper that orders byte 
arrays by unsigned lexicographic comparison (matching MySQL VARBINARY collation 
semantics).
     - In `OrderByValue.getOrderValues`, extract a `toComparable` step that 
wraps `byte[]` values via `ComparableByteArray` before they enter the result 
list. Other value types still flow through the existing `instanceof Comparable` 
precondition.
     - Unit tests:
       - `ComparableByteArrayTest`: equality, single-byte ordering, unsigned 
high byte, shorter-prefix-is-less, empty arrays.
       - `OrderByValueTest`: an ASC scenario where the smaller VARBINARY value 
sorts before the larger one (covers high-bit byte `0x80` vs `0x7F`).
   
   Before this change, selecting an `ORDER BY` over a `VARBINARY` (or `BINARY`) 
column threw `NotImplementComparableValueException` because `byte[]` does not 
implement `Comparable`. Native MySQL allows the same query.
   
   ---
   
   Before committing this PR, I'm sure that I have checked the following 
options:
   - [x] My code follows the [code of 
conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) 
of this project.
   - [x] I have self-reviewed the commit code.
   - [ ] I have (or in comment I request) added corresponding labels for the 
pull request.
   - [x] I have passed maven check locally for the affected modules (spotless, 
checkstyle, unit tests).
   - [x] I have made corresponding changes to the documentation.
   - [x] I have added corresponding unit tests for my changes.
   - [x] I have updated the Release Notes of the current development version. 
For more details, see [Update Release 
Note](https://shardingsphere.apache.org/community/en/involved/contribute/contributor/)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to