strongduanmu opened a new issue, #25349: URL: https://github.com/apache/shardingsphere/issues/25349
## Bug Report ### Which version of ShardingSphere did you use? [a1cb0ba](https://github.com/apache/shardingsphere/commit/a1cb0ba014cac29ec2b9ce16c4d55d25e1e25401) ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy? ShardingSphere-Proxy ### Expected behavior show index/show create table statement return correct logic index. ### Actual behavior ```sql mysql> SHOW CREATE TABLE T_ORDER; +---------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | +---------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | T_ORDER | CREATE TABLE `t_order_0` ( `ORDER_ID` bigint(20) NOT NULL, `USER_ID` int(11) NOT NULL, `STATUS` varchar(50) NOT NULL, `MERCHANT_ID` int(11) NOT NULL, `REMARK` varchar(50) NOT NULL, `CREATION_DATE` date NOT NULL, PRIMARY KEY (`ORDER_ID`), KEY `IDX_ORDER_ID_T_ORDER` (`ORDER_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 | +---------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (2.47 sec) mysql> SHOW INDEX FROM T_ORDER; +---------+------------+------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | +---------+------------+------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | T_ORDER | 0 | PRIMARY | 1 | ORDER_ID | A | 0 | NULL | NULL | | BTREE | | | | T_ORDER | 1 | IDX_ORDER_ID_T_ORDER_0 | 1 | ORDER_ID | A | 0 | NULL | NULL | | BTREE | | | +---------+------------+------------------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ 2 rows in set (0.04 sec) ``` ### Reason analyze (If you can) ```sql @Override protected void setCellValue(final MemoryQueryResultRow memoryResultSetRow, final String logicTableName, final String actualTableName, final ShardingSphereTable table, final ShardingRule shardingRule) { memoryResultSetRow.setCell(2, memoryResultSetRow.getCell(2).toString().replaceFirst(actualTableName, logicTableName)); for (String each : table.getIndexes().keySet()) { String actualIndexName = IndexMetaDataUtils.getActualIndexName(each, actualTableName); memoryResultSetRow.setCell(2, memoryResultSetRow.getCell(2).toString().replace(actualIndexName, each)); } for (Entry<String, ShardingSphereConstraint> entry : table.getConstraints().entrySet()) { String actualIndexName = IndexMetaDataUtils.getActualIndexName(entry.getKey(), actualTableName); memoryResultSetRow.setCell(2, memoryResultSetRow.getCell(2).toString().replace(actualIndexName, entry.getKey())); Optional<TableRule> tableRule = shardingRule.findTableRule(entry.getValue().getReferencedTableName()); if (!tableRule.isPresent()) { continue; } for (DataNode dataNode : tableRule.get().getActualDataNodes()) { memoryResultSetRow.setCell(2, memoryResultSetRow.getCell(2).toString().replace(dataNode.getTableName(), entry.getValue().getReferencedTableName())); } } } ``` table.getIndexes().keySet() method return lowercase index name, it cause following logic can not handle index name correctly. ### 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
