linghengqian opened a new issue #13009:
URL: https://github.com/apache/shardingsphere/issues/13009


   ## Question
   
   **For English only**, other languages will not accept.
   
   Before asking a question, make sure you have:
   
   - Googled your question.
   - Searched open and closed [GitHub 
issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere 
Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more 
details. 
   If no response anymore and we cannot reproduce it on current information, we 
will **close it**.
   
   After reading the article https://mp.weixin.qq.com/s/fDYqW-yJIVpkcUDNT-gsuA, 
I put forward some question of AUTO_INTERVAL.
   In shardingsphere-jdbc-core-spring-boot-starter:5.0.0 beta,  
AutoIntervalShardingAlgorithm class
   , public Collection doSharding(final Collection availableTargetNames, final 
RangeShardingValue >> shardingValue) , among the use of "each endswith ()". 
   ```java
   @Override
   public String doSharding(final Collection<String> availableTargetNames, 
final PreciseShardingValue<Comparable<?>> shardingValue)
   @Override
   public Collection<String> doSharding(final Collection<String> 
availableTargetNames, final RangeShardingValue<Comparable<?>> shardingValue)
   ```
   If there are more than 100 partitions and the sharding table result of the 
SQL matches the third real table, that's when each.endswith (3),what suffixes 
must the pre-created table have to ensure that the result returned only gets 
the third real table and not the extra 53rd real table? In my scenario, if the 
table is "T_order_ $->{1.. 160} "In this format, there should be no escape from 
the question, right?
   
   ```java
   @Override
       public String doSharding(final Collection<String> availableTargetNames, 
final PreciseShardingValue<Comparable<?>> shardingValue) {
           for (String each : availableTargetNames) {
               if 
(each.endsWith(String.valueOf(doSharding(parseDate(shardingValue.getValue())))))
 {
                   return each;
               }
           }
           return null;
       }
   
   @Override
       public Collection<String> doSharding(final Collection<String> 
availableTargetNames, final RangeShardingValue<Comparable<?>> shardingValue) {
           Collection<String> result = new 
LinkedHashSet<>(availableTargetNames.size());
           int firstPartition = 
getFirstPartition(shardingValue.getValueRange());
           int lastPartition = getLastPartition(shardingValue.getValueRange());
           for (int i = firstPartition; i <= lastPartition; i++) {
               for (String each : availableTargetNames) {
                   if (each.endsWith(String.valueOf(i))) {
                       result.add(each);
                   }
                   if (result.size() == availableTargetNames.size()) {
                       return result;
                   }
               }
           }
           return result;
       }
   ```
   
   And AutoIntervalShardingAlgorithm class, its getAllPropertyKeys () function 
is used for what?
   ```java
   @Override
       public Collection<String> getAllPropertyKeys() {
           return Arrays.asList(DATE_TIME_LOWER_KEY, DATE_TIME_UPPER_KEY, 
SHARDING_SECONDS_KEY);
       }
   ```
   
   


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