strongduanmu commented on a change in pull request #10816:
URL: https://github.com/apache/shardingsphere/pull/10816#discussion_r652270681
##########
File path:
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateIndexStatementValidator.java
##########
@@ -38,7 +39,9 @@ public void preValidate(final ShardingRule shardingRule,
final SQLStatementConte
final List<Object> parameters, final
ShardingSphereSchema schema) {
validateTableExist(schema,
Collections.singletonList(sqlStatementContext.getSqlStatement().getTable()));
String tableName =
sqlStatementContext.getSqlStatement().getTable().getTableName().getIdentifier().getValue();
- String indexName =
sqlStatementContext.getSqlStatement().getIndex().getIdentifier().getValue();
+ String indexName = null !=
sqlStatementContext.getSqlStatement().getIndex()
+ ?
sqlStatementContext.getSqlStatement().getIndex().getIdentifier().getValue()
+ :
IndexMetaDataUtil.getGeneratedLogicIndexName(sqlStatementContext.getSqlStatement().getColumns());
Review comment:
> How about `sqlStatementContext.getIndexName()`?
@tristaZero Great idea, I have extracted the logic into the getIndexes
method in sqlStatementContext.
--
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]