This is an automated email from the ASF dual-hosted git repository.

zhaojinchao 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 8896645cea4 Remove useless field for RawExecutor (#23706)
8896645cea4 is described below

commit 8896645cea4268cc6724632b73018317964e57f7
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Jan 23 16:39:00 2023 +0800

    Remove useless field for RawExecutor (#23706)
    
    * Simple refactor for ProxySQLExecutor and RawExecutor
    
    * Remove useless field for RawExecutor
---
 .../infra/executor/sql/execute/engine/raw/RawExecutor.java       | 9 +++------
 .../apache/shardingsphere/driver/executor/DriverExecutor.java    | 2 +-
 .../proxy/backend/communication/ProxySQLExecutor.java            | 8 +++-----
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git 
a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/raw/RawExecutor.java
 
b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/raw/RawExecutor.java
index 0f070bbfc51..865739df8be 100644
--- 
a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/raw/RawExecutor.java
+++ 
b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/raw/RawExecutor.java
@@ -19,9 +19,7 @@ package 
org.apache.shardingsphere.infra.executor.sql.execute.engine.raw;
 
 import lombok.RequiredArgsConstructor;
 import org.apache.shardingsphere.infra.binder.QueryContext;
-import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
 import org.apache.shardingsphere.infra.context.ConnectionContext;
-import org.apache.shardingsphere.infra.util.eventbus.EventBusContext;
 import org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine;
 import 
org.apache.shardingsphere.infra.executor.kernel.model.ExecutionGroupContext;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.engine.SQLExecutorExceptionHandler;
@@ -29,6 +27,7 @@ import 
org.apache.shardingsphere.infra.executor.sql.execute.engine.raw.callback.
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.ExecuteResult;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.update.UpdateResult;
 import 
org.apache.shardingsphere.infra.executor.sql.process.ExecuteProcessEngine;
+import org.apache.shardingsphere.infra.util.eventbus.EventBusContext;
 
 import java.sql.SQLException;
 import java.util.Collections;
@@ -45,8 +44,6 @@ public final class RawExecutor {
     
     private final ConnectionContext connectionContext;
     
-    private final ConfigurationProperties props;
-    
     private final EventBusContext eventBusContext;
     
     /**
@@ -58,8 +55,8 @@ public final class RawExecutor {
      * @return execute results
      * @throws SQLException SQL exception
      */
-    public List<ExecuteResult> execute(final 
ExecutionGroupContext<RawSQLExecutionUnit> executionGroupContext, final 
QueryContext queryContext,
-                                       final RawSQLExecutorCallback callback) 
throws SQLException {
+    public List<ExecuteResult> execute(final 
ExecutionGroupContext<RawSQLExecutionUnit> executionGroupContext,
+                                       final QueryContext queryContext, final 
RawSQLExecutorCallback callback) throws SQLException {
         ExecuteProcessEngine executeProcessEngine = new ExecuteProcessEngine();
         try {
             executeProcessEngine.initializeExecution(queryContext, 
executionGroupContext);
diff --git 
a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/executor/DriverExecutor.java
 
b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/executor/DriverExecutor.java
index 261e01a07ab..3fc1d1214fa 100644
--- 
a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/executor/DriverExecutor.java
+++ 
b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/executor/DriverExecutor.java
@@ -52,7 +52,7 @@ public final class DriverExecutor implements AutoCloseable {
         EventBusContext eventBusContext = 
connection.getContextManager().getInstanceContext().getEventBusContext();
         JDBCExecutor jdbcExecutor = new JDBCExecutor(executorEngine, 
connection.getConnectionContext());
         regularExecutor = new DriverJDBCExecutor(connection.getDatabaseName(), 
connection.getContextManager(), jdbcExecutor);
-        rawExecutor = new RawExecutor(executorEngine, 
connection.getConnectionContext(), metaDataContexts.getMetaData().getProps(), 
eventBusContext);
+        rawExecutor = new RawExecutor(executorEngine, 
connection.getConnectionContext(), eventBusContext);
         DatabaseType protocolType = 
metaDataContexts.getMetaData().getDatabase(connection.getDatabaseName()).getProtocolType();
         String schemaName = 
DatabaseTypeEngine.getDefaultSchemaName(protocolType, 
connection.getDatabaseName());
         SQLFederationRule sqlFederationRule = 
metaDataContexts.getMetaData().getGlobalRuleMetaData().getSingleRule(SQLFederationRule.class);
diff --git 
a/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java
 
b/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java
index ba99bec52ae..5e36e87e41f 100644
--- 
a/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java
+++ 
b/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java
@@ -41,7 +41,6 @@ import 
org.apache.shardingsphere.infra.executor.sql.prepare.raw.RawExecutionPrep
 import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.infra.rule.identifier.type.RawExecutionRule;
 import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPIRegistry;
-import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
 import 
org.apache.shardingsphere.proxy.backend.communication.jdbc.executor.ProxyJDBCExecutor;
 import 
org.apache.shardingsphere.proxy.backend.communication.jdbc.statement.JDBCBackendStatement;
 import 
org.apache.shardingsphere.proxy.backend.communication.jdbc.transaction.BackendTransactionManager;
@@ -86,10 +85,9 @@ public final class ProxySQLExecutor {
         this.type = type;
         this.backendConnection = backendConnection;
         ExecutorEngine executorEngine = 
BackendExecutorContext.getInstance().getExecutorEngine();
-        MetaDataContexts metaDataContexts = 
ProxyContext.getInstance().getContextManager().getMetaDataContexts();
         ConnectionContext connectionContext = 
backendConnection.getConnectionSession().getConnectionContext();
         jdbcExecutor = new ProxyJDBCExecutor(type, 
backendConnection.getConnectionSession(), databaseCommunicationEngine, new 
JDBCExecutor(executorEngine, connectionContext));
-        rawExecutor = new RawExecutor(executorEngine, connectionContext, 
metaDataContexts.getMetaData().getProps(), 
ProxyContext.getInstance().getContextManager().getInstanceContext()
+        rawExecutor = new RawExecutor(executorEngine, connectionContext, 
ProxyContext.getInstance().getContextManager().getInstanceContext()
                 .getEventBusContext());
     }
     
@@ -203,9 +201,9 @@ public final class ProxySQLExecutor {
         } catch (final SQLException ex) {
             return getSaneExecuteResults(executionContext, ex);
         }
+        
executionGroupContext.setExecutionID(backendConnection.getConnectionSession().getExecutionId());
         
executionGroupContext.setDatabaseName(backendConnection.getConnectionSession().getDatabaseName());
         
executionGroupContext.setGrantee(backendConnection.getConnectionSession().getGrantee());
-        
executionGroupContext.setExecutionID(backendConnection.getConnectionSession().getExecutionId());
         // TODO handle query header
         return rawExecutor.execute(executionGroupContext, 
executionContext.getQueryContext(), new RawSQLExecutorCallback());
     }
@@ -222,9 +220,9 @@ public final class ProxySQLExecutor {
         } catch (final SQLException ex) {
             return getSaneExecuteResults(executionContext, ex);
         }
+        
executionGroupContext.setExecutionID(backendConnection.getConnectionSession().getExecutionId());
         
executionGroupContext.setDatabaseName(backendConnection.getConnectionSession().getDatabaseName());
         
executionGroupContext.setGrantee(backendConnection.getConnectionSession().getGrantee());
-        
executionGroupContext.setExecutionID(backendConnection.getConnectionSession().getExecutionId());
         return jdbcExecutor.execute(executionContext.getQueryContext(), 
executionGroupContext, isReturnGeneratedKeys, isExceptionThrown);
     }
     

Reply via email to