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

   ## Question
   
   [code 
location](https://github.com/apache/shardingsphere/blob/a0a1f25e187010cc79adccd432bf94bfac3fc416/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/engine/WhereClauseShardingConditionEngine.java#LL98C13-L98C13)。
   
   See the sql below
   ```sql
   select concat(data_source_id, '_', cost_item_name) as ruleKey,
       sum(ori_amount) as ori_amount
   from cost_item_order_detail
   where tenant_code = ?
       and platform_code = ?
       and shop_code = ?
       and order_date between ? and ?
       and (
           data_source_id = ?
           and cost_item_name = ?
       )
       or (
           data_source_id = ?
           and cost_item_name = ?
       )
   group by data_source_id,
       cost_item_name
   ```
   shardingsphere will analyse two `AndPredicate`, one is `tenant_code = ? 
platform_code = ? and shop_code = ? and order_date between ? and ? and 
(data_source_id = ? and cost_item_name = ?)` and the other is `data_source_id = 
? and cost_item_name = ?`.
   
   We use `tenant_code = ? platform_code = ? and shop_code = ?` as table 
sharding rule so the `shardingConditionValues`  from the first `AndPredicate` 
is OK, but the second is empty. But in the code above, if there is any empty 
`shardingConditionValues`, it will return `Collections.emptyList()` which raise 
an error in our project.
   
   I wonder to know why return empty when just one conditon is empty here 🤨
   


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