YaoFly opened a new issue, #32076:
URL: https://github.com/apache/shardingsphere/issues/32076

   ## Bug Report
   When I use `not in`, the sql is parsed to the incorrect shard, but when I 
use  `!=`, everything works fine
   ### Which version of ShardingSphere did you use?
   latest , at master branch
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy
   ### Expected behavior
   ShardingSphere-SQL - Actual SQL:  select * from t_order_0 where shard_key 
not in (0) UNION ALL  select * from t_order_1 where shard_key not in (0)
   ### Actual behavior
   ShardingSphere-SQL - Actual SQL: ds_0 :::  select * from t_order_0 where 
shard_key not in (0)
   ### Reason analyze (If you can)
   (in) and (not in) are both InExpression, it`s not excluding the case of not 
in ConditionValueInOperatorGenerator class.
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   1. create table
   `create table t_order_0(
       shard_key int not null
   );
   create table t_order_1(
       shard_key int not null
   );`
   2. rule config
   rules:
     - !SHARDING
       tables:
         t_order:
           actualDataNodes: ds_0.t_order_${0..1}
           tableStrategy:
             standard:
               shardingColumn: shard_key
               shardingAlgorithmName: t_order_inline
       shardingAlgorithms:
         t_order_inline:
           type: INLINE
           props:
             algorithm-expression: t_order_${shard_key}
   3. execute sql
   `select * from t_order where shard_key not in (0);`
   
   ### Example codes for reproduce this issue (such as a github link).
   


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