From 6e90c7c2354b4e59f759f5b6354b68278d2540e6 Mon Sep 17 00:00:00 2001 From: ZhangCheng <chengzhang@apache.org> Date: Tue, 3 Sep 2024 09:59:54 +0800 Subject: [PATCH] Fix sonar issue of InsertStatementContext --- .../binder/context/statement/dml/InsertStatementContext.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/dml/InsertStatementContext.java b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/dml/InsertStatementContext.java index f86867aa3d7a6..73d77adbc3150 100644 --- a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/dml/InsertStatementContext.java +++ b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/context/statement/dml/InsertStatementContext.java @@ -103,11 +103,11 @@ public InsertStatementContext(final ShardingSphereMetaData metaData, final List< ShardingSphereSchema schema = getSchema(metaData, currentDatabaseName); columnNames = containsInsertColumns() ? insertColumnNames : Optional.ofNullable(sqlStatement.getTable()).map(optional -> schema.getVisibleColumnNames(optional.getTableName().getIdentifier().getValue())).orElseGet(Collections::emptyList); - insertColumnNamesAndIndexes = createInsertColumnNamesAndIndexes(sqlStatement, schema, insertColumnNames); + insertColumnNamesAndIndexes = createInsertColumnNamesAndIndexes(insertColumnNames); generatedKeyContext = new GeneratedKeyContextEngine(sqlStatement, schema).createGenerateKeyContext(insertColumnNamesAndIndexes, insertValueContexts, params).orElse(null); } - private Map<String, Integer> createInsertColumnNamesAndIndexes(final InsertStatement sqlStatement, final ShardingSphereSchema schema, final List<String> insertColumnNames) { + private Map<String, Integer> createInsertColumnNamesAndIndexes(final List<String> insertColumnNames) { if (containsInsertColumns()) { Map<String, Integer> result = new CaseInsensitiveMap<>(insertColumnNames.size(), 1F); int index = 0;