sandynz opened a new issue, #24837:
URL: https://github.com/apache/shardingsphere/issues/24837

   ## Feature Request
   
   ### Is your feature request related to a problem?
   Yes
   
   MySQL `VARBINARY` column value is `byte[]` in Java, it doesn't implement 
`Comparable` interface. But some kernel interfaces limit generic type to 
sub-type of `Comparable`, it cause some feature doesn't work or limited.
   Related code example:
   ```
   public interface StandardShardingAlgorithm<T extends Comparable<?>> extends 
ShardingAlgorithm {
   
   public final class OrderByValue implements Comparable<OrderByValue> {
   ```
   
   `VARBINARY` column could be compared and sorted in MYSQL, e.g.
   ```
   mysql> show create table t_varbin;
   
+----------+-----------------------------------------------------------------------------------------------------------------------+
   | Table    | Create Table                                                    
                                                      |
   
+----------+-----------------------------------------------------------------------------------------------------------------------+
   | t_varbin | CREATE TABLE `t_varbin` (
     `id` varbinary(30) NOT NULL,
     PRIMARY KEY (`id`)
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 |
   
+----------+-----------------------------------------------------------------------------------------------------------------------+
   1 row in set (0.04 sec)
   
   mysql> select * from t_varbin;
   +-----+
   | id  |
   +-----+
   | 1   |
   | a12 |
   | b34 |
   +-----+
   3 rows in set (0.00 sec)
   
   mysql> select * from t_varbin where id>'a' order by id;
   +-----+
   | id  |
   +-----+
   | a12 |
   | b34 |
   +-----+
   2 rows in set (0.12 sec)
   ```
   
   Problem examples:
   1, Insert failed on MySQL VARBINARY column when it is sharding column. Refer 
to issue #24210 for more details. There's partial fix #24285 for now.
   Related classes: `StandardShardingAlgorithm`, 
`ComplexKeysShardingAlgorithm`, `HintShardingAlgorithm`, and sub-classes.
   
   2, Order by MySQL VARBINARY primary key failed. Refer to issue #24107 for 
more details.
   Related classes: `OrderByValue`
   
   3, Insert failed on MySQL VARBINARY column when keyGenerateStrategy is 
configured. Refer to #24135 for more details.
   Related classes: `GeneratedKeyContextEngine`
   
   4, Could not customize KeyGenerateAlgorithm for `VARBINARY` column. Since 
`generateKey` return `Comparable`.
   Related classes: `KeyGenerateAlgorithm`
   
   ### Describe the feature you would like.
   Could we update these interfaces and classes generic type definition, change 
`<T extends Comparable<?>>` to `<T>`, in later version, e.g. `5.4.0`, `5.5.0` 
etc (current stable version is `5.3.1`).
   
   


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