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

   In the doSharding method of ComplexKeysShardingAlgorithm, the inability to 
obtain columnName and dataNodeInfo prevents the automatic sharding and the 
application of the sharding algorithm for the automatic sharding strategy in 
DISTSQL.
   
   To address this issue, PreciseShardingValue and RangeShardingValue should be 
included in ComplexKeysShardingValue, as shown below:
   
   java
   Copy code
   public final class ComplexKeysShardingValue<T extends Comparable<?>> 
implements ShardingValue {
       
       private final String logicTableName;
       
       private final Map<String, PreciseShardingValue<T>> 
columnNameAndShardingValuesMap;
       
       private final Map<String, RangeShardingValue<T>> 
columnNameAndRangeValuesMap;
   }
   
   My requirements are as follows:
   /**
   Composite Field Sharding Algorithm
   Ensure that the last N digits of the participating fields are consistent.
   Support multiple fields for sharding.
   Since multiple fields have the same last N digits, routing to the target 
table can be done with any of the fields.
   Use case:
   For example, when sharding orders by user ID, querying by order ID alone 
cannot route to the target table.
   In this case, if the last N digits of the order ID are consistent with the 
user ID, it is possible to query by either the user ID or the order ID.
   */
   public class CombineHashMod implements 
ComplexKeysShardingAlgorithm<Comparable<?>>, ShardingAutoTableAlgorithm {
    @Override
    public Collection<String> doSharding(Collection<String> 
availableTargetNames, ComplexKeysShardingValue<Comparable<?>> shardingValue);
   }


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