sofay opened a new issue #2231: OrConditionFiller#getTableName error URL: https://github.com/apache/incubator-shardingsphere/issues/2231 ## Bug Report **For English only**, other languages will not accept. Before report a bug, make sure you have: - Searched open and closed [GitHub issues](https://github.com/sharding-sphere/sharding-sphere/issues). - Read documentation: [ShardingSphere Doc](http://shardingsphere.io/document/current/en/overview/). Please pay attention on issues you submitted, because we maybe need more details. If no response **more than 7 days** and we cannot reproduce it on current information, we will **close it**. Please answer these questions before submitting your issue. Thanks! ### Which version of ShardingSphere did you use? 4.0.0-RC2 ### Which project did you use? Sharding-JDBC or Sharding-Proxy? Sharding-JDBC ### Expected behavior sql like: ``` select id customerId, entity_card_num entityCardNum, mobile, NAME from customer where company_id = ? and id not in ( SELECT distinct customer_id FROM customer_account_change_record cacr inner join customer c on cacr.company_id = c.company_id and c.id = cacr.customer_id and cacr.company_id = ? WHERE cacr.created between ? and ? and cacr.company_id = ? and cacr.card_type = 1 ) and enabled_status = 1 order by created desc limit ?,? ``` `ConditionSegment(name:created, owner:cacr, operator:BETWEEN)` ### Actual behavior getTableName will return 'customer' not 'customer_account_change_record' ### Reason analyze (If you can) ``` private String getTableName(final ShardingTableMetaData shardingTableMetaData, final ShardingRule shardingRule, final Tables tables, final ConditionSegment conditionSegment) { Collection<String> shardingLogicTableNames = shardingRule.getShardingLogicTableNames(tables.getTableNames()); if (tables.isSingleTable() || tables.isSameTable() || 1 == shardingLogicTableNames.size() || shardingRule.isAllBindingTables(shardingLogicTableNames)) { return tables.getSingleTableName(); } if (conditionSegment.getColumn().getOwner().isPresent()) { Optional<Table> table = tables.find(conditionSegment.getColumn().getOwner().get()); return table.isPresent() ? table.get().getName() : ""; } else { return getTableNameFromMetaData(shardingTableMetaData, tables, conditionSegment.getColumn().getName()); } } ``` match the if condition `1 == shardingLogicTableNames.size()` then direct return the first table name ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc. ### 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
