wsg96321 opened a new issue #16353:
URL: https://github.com/apache/shardingsphere/issues/16353


   version:  sharding proxy v 5.1.0 
   
   I implement hint algorithms name `common_hint_shard` , and I create 
dataresource by  distSQL . It has many tables in one dataresource and I special 
another algorithms just for 3 tables . But it seems not use when I create 
default algorithms with hint . 
   
   this is my distSQL : 
   ```
   CREATE SHARDING ALGORITHM common_hint_shard (
   TYPE(NAME=common_hint_shard)
   );
   
   CREATE DEFAULT SHARDING DATABASE STRATEGY (
   TYPE = standard,SHARDING_COLUMN=id,SHARDING_ALGORITHM=common_hint_shard
   );
   ###  I want use this like below(dont't special column because I think it 
should be a force route whatever the value you input ? ), but it seems to not 
support this gramma:
   # CREATE DEFAULT SHARDING DATABASE STRATEGY (
   #     TYPE = hint,SHARDING_ALGORITHM=common_hint_shard
   # );
   ```
   I want to use distSQL like YAML config below : 
   ```
   rules:
   - !SHARDING
     tables:
       hero:
         actualDataNodes: ds_${1..100}.hero
     bindingTables:
       - hero
   
     defaultDatabaseStrategy:
       hint:
         shardingAlgorithmName: common_hint_shard
     defaultTableStrategy:
       none:
   
     shardingAlgorithms:
       common_hint_shard:
         type: common_hint_shard
   ```
   
   this is `common_hint_shard` of some java code : 
   ```
   ...
   public final class DatabaseHintShardingAlgorithm implements 
HintShardingAlgorithm<String> {
       @Override
       public Collection<String> doSharding(Collection<String> 
availableTargetNames, HintShardingValue<String> shardingValue) {
           Collection<String> result = new ArrayList<>();
           for (String each : availableTargetNames) {
               for (String value : shardingValue.getValues()) {
                   String[] values = value.split(",");
                   for (String s : values) {
                       if (each.endsWith("_" + s)) {
                           result.add(each);
                       }
                   }
               }
           }
           return result;
       }
   
       @Override
       public String getType() {
           return "common_hint_shard";
       }
   ...
   ```
   
   In a summary
   1. I create default database strategy by DistSQL success, but I found it not 
use with table which auto discover, like `hero`
   2. can't find any grammar which don't special column in DistSQL
   
   
   
   
   


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