You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "sandynz (via GitHub)" <gi...@apache.org> on 2023/03/26 10:02:46 UTC

[GitHub] [shardingsphere] sandynz opened a new issue, #24837: [Discussion] Update `>` to `` in ShardingAlgorithm, KeyGenerateAlgorithm etc

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: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu commented on issue #24837: [Discussion] Update `>` to `` in ShardingAlgorithm, KeyGenerateAlgorithm etc

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on issue #24837:
URL: https://github.com/apache/shardingsphere/issues/24837#issuecomment-1484425687

   @sandynz Thanks for your suggestion, I think it's time to support more data types. We will consider the solution and support it in the next version.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org