RaigorJiang commented on issue #12491:
URL: 
https://github.com/apache/shardingsphere/issues/12491#issuecomment-921540329


   Hi @marker-wu 
   I investigated this issue and I have the following information to give you 
feedback:
   1. In the SQL parse progress, ANTLR recognizes ‘5’ as a Number type;
   2. The most suitable type corresponding to ‘5’ is Integer, so it becomes 
Interger;
   3. Although your table field type is bigint, meta data has not been used 
during parse progress, so it has not been converted to Long type.
   4. The sharding algorithm specifies that Long is required, so a conversion 
exception occurs.
   
   I think this problem needs to be corrected. Before that, you can also 
temporarily solve this problem by declaring the parameter as ‘Comparable’:
   ```java
       @Override
       public String doSharding(final Collection<String> availableTargetNames, 
final PreciseShardingValue<Comparable<?>> shardingValue) {
           for (String each : availableTargetNames) {
               if 
(each.endsWith(String.valueOf(Long.valueOf(shardingValue.getValue().toString()) 
% 2 + 1))) {
                   return each;
               }
           }
           return null;
       }
   ```


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