This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 1a85edf5705 Fix sonar issues (#31986)
1a85edf5705 is described below
commit 1a85edf5705cfb4a7c7602124cccaa477b907404
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Jul 5 17:03:27 2024 +0800
Fix sonar issues (#31986)
---
.../executor/enumerable/EnumerableScanExecutor.java | 3 +--
.../proxy/backend/connector/ProxySQLExecutorTest.java | 10 ----------
2 files changed, 1 insertion(+), 12 deletions(-)
diff --git
a/kernel/sql-federation/executor/src/main/java/org/apache/shardingsphere/sqlfederation/executor/enumerable/EnumerableScanExecutor.java
b/kernel/sql-federation/executor/src/main/java/org/apache/shardingsphere/sqlfederation/executor/enumerable/EnumerableScanExecutor.java
index 0c76f9af25f..3cd57100feb 100644
---
a/kernel/sql-federation/executor/src/main/java/org/apache/shardingsphere/sqlfederation/executor/enumerable/EnumerableScanExecutor.java
+++
b/kernel/sql-federation/executor/src/main/java/org/apache/shardingsphere/sqlfederation/executor/enumerable/EnumerableScanExecutor.java
@@ -112,13 +112,12 @@ public final class EnumerableScanExecutor implements
ScanExecutor {
return createMemoryEnumerable(databaseName, schemaName, table,
databaseType);
}
QueryContext queryContext =
createQueryContext(federationContext.getMetaData(), scanContext, databaseType,
federationContext.getQueryContext().isUseCache());
- ShardingSphereDatabase database =
federationContext.getMetaData().getDatabase(databaseName);
ExecutionContext executionContext = new
KernelProcessor().generateExecutionContext(queryContext, globalRuleMetaData,
executorContext.getProps(), new ConnectionContext(Collections::emptySet));
if (federationContext.isPreview()) {
federationContext.getPreviewExecutionUnits().addAll(executionContext.getExecutionUnits());
return createEmptyEnumerable();
}
- return createJDBCEnumerable(queryContext, database, executionContext);
+ return createJDBCEnumerable(queryContext,
federationContext.getMetaData().getDatabase(databaseName), executionContext);
}
private AbstractEnumerable<Object> createJDBCEnumerable(final QueryContext
queryContext, final ShardingSphereDatabase database, final ExecutionContext
context) {
diff --git
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/ProxySQLExecutorTest.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/ProxySQLExecutorTest.java
index da34cf6d53d..4f4ecd507f3 100644
---
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/ProxySQLExecutorTest.java
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/ProxySQLExecutorTest.java
@@ -48,15 +48,12 @@ import
org.apache.shardingsphere.mode.metadata.MetaDataContextsFactory;
import org.apache.shardingsphere.mode.spi.PersistRepository;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
-import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.item.ProjectionsSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.TableNameSegment;
-import
org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
import
org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
import
org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLCreateTableStatement;
import
org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLTruncateStatement;
import
org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLInsertStatement;
-import
org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLSelectStatement;
import
org.apache.shardingsphere.sql.parser.statement.postgresql.ddl.PostgreSQLCreateTableStatement;
import
org.apache.shardingsphere.sql.parser.statement.postgresql.ddl.PostgreSQLTruncateStatement;
import
org.apache.shardingsphere.sql.parser.statement.postgresql.dml.PostgreSQLInsertStatement;
@@ -271,13 +268,6 @@ class ProxySQLExecutorTest {
mock(RuleMetaData.class), mock(ConfigurationProperties.class));
}
- private SelectStatement createSelectStatement() {
- SelectStatement result = new MySQLSelectStatement();
- result.setFrom(new SimpleTableSegment(new TableNameSegment(10, 13, new
IdentifierValue("tbl"))));
- result.setProjections(new ProjectionsSegment(0, 0));
- return result;
- }
-
private InsertStatementContext createMySQLInsertStatementContext() {
MySQLInsertStatement sqlStatement = new MySQLInsertStatement();
sqlStatement.setTable(new SimpleTableSegment(new TableNameSegment(0,
0, new IdentifierValue("t_order"))));