You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/06/09 10:02:20 UTC

[GitHub] [shardingsphere] jianliu removed a comment on issue #10735: Using IntervalShardingAlgorithm with config `datetime-interval-unit` greater than 'days' occur error when insert

jianliu removed a comment on issue #10735:
URL: https://github.com/apache/shardingsphere/issues/10735#issuecomment-857557777


   Make corrections of "Actual behavior "
   the default behavior is thrown excpetion like:
   ```
   Unknown exception: [failed to shard value PreciseShardingValue(logicTableName=time_test, columnName=create_at, value=2021-06-13 03:01:01), and availableTables [time_test_20210607, time_test_20210614, time_test_20210621, time_test_20210628, time_test_20210705, time_test_20210712, time_test_20210719, time_test_20210726, time_test_20210802, time_test_20210809, time_test_20210816, time_test_20210823, time_test_20210830, time_test_20210906, time_test_20210913, time_test_20210920, time_test_20210927, time_test_2 
   ```
   Because of another bug of multi ds use unique table name like ds1.t1,   ds1.t2,   ds2.t3 ,    ds2.t4, so I modify the code like this
   ```
       @Override
       public String doSharding(final Collection<String> availableTargetNames, final PreciseShardingValue<Comparable<?>> shardingValue) {
           return availableTargetNames.stream()
                   .filter(each -> each.endsWith(parseDateTime(shardingValue.getValue().toString()).format(tableSuffixPattern)))
                   .findFirst().orElse(null);  //when not hit table,return null
       }
   ```
   So finally the error becames:
   ```    
        You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.shardingsphere.sharding.rewrite.token.pojo.TableToken@4357801e (`create_at`, id' at line 1
   ```
   
   Sorry for misdescribe.


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

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