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 2020/09/22 07:17:48 UTC

[GitHub] [shardingsphere] lwtdev edited a comment on issue #7548: Throw NPE at ExecutionContextBuilder.getPrimaryKeyColumns when execute sql

lwtdev edited a comment on issue #7548:
URL: https://github.com/apache/shardingsphere/issues/7548#issuecomment-696550564


   > Hi @lwtdev
   > Thanks for your detailed issue.
   > Firstly, I also wonder how you created the `customer` table, which will help position the problem.
   > Secondly, I have to say this is a band example of defensive programming. 😞
   
   Yes, This is not a good config example (And it was wrong...).  it's was a example simplify from config as follow(in 4.x):
   ```yaml
         databaseStrategy:
           inline:
             shardingColumn: customer_id
             algorithmExpression: ds_${String.format("%02d",new BigDecimal(customer_id).abs().divideAndRemainder(4)[1].longValue().intdiv(2))}
         tableStrategy:
           inline:
             shardingColumn: customer_id
             algorithmExpression: customer_email_${String.format("%04d",new BigDecimal(customer_id).abs().divideAndRemainder(4)[1].longValue())}
   ```
   


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