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 f9787bc65e1 Remove useless DriverPushDownExecutor (#31668)
f9787bc65e1 is described below
commit f9787bc65e1299d5df592621149cba020687237c
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Jun 12 18:26:15 2024 +0800
Remove useless DriverPushDownExecutor (#31668)
* Remove useless DriverPushDownExecutor
* Remove useless DriverPushDownExecutor
* Remove useless DriverPushDownExecutor
* Remove useless DriverPushDownExecutor
---
.../executor/engine/DriverExecuteExecutor.java | 34 +++++---
.../engine/DriverExecuteQueryExecutor.java | 15 +++-
.../engine/DriverExecuteUpdateExecutor.java | 15 +++-
.../pushdown/DriverPushDownExecuteExecutor.java | 95 ----------------------
.../DriverPushDownExecuteQueryExecutor.java | 78 ------------------
.../DriverPushDownExecuteUpdateExecutor.java | 73 -----------------
6 files changed, 46 insertions(+), 264 deletions(-)
diff --git
a/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/engine/DriverExecuteExecutor.java
b/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/engine/DriverExecuteExecutor.java
index b250ad61000..23315b3eefb 100644
---
a/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/engine/DriverExecuteExecutor.java
+++
b/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/engine/DriverExecuteExecutor.java
@@ -22,7 +22,8 @@ import
org.apache.shardingsphere.driver.executor.callback.add.StatementAddCallba
import
org.apache.shardingsphere.driver.executor.callback.execute.ExecuteQueryCallbackFactory;
import
org.apache.shardingsphere.driver.executor.callback.execute.StatementExecuteCallback;
import
org.apache.shardingsphere.driver.executor.callback.replay.StatementReplayCallback;
-import
org.apache.shardingsphere.driver.executor.engine.pushdown.DriverPushDownExecuteExecutor;
+import
org.apache.shardingsphere.driver.executor.engine.pushdown.jdbc.DriverJDBCPushDownExecuteExecutor;
+import
org.apache.shardingsphere.driver.executor.engine.pushdown.raw.DriverRawPushDownExecuteExecutor;
import
org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection;
import
org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext;
import org.apache.shardingsphere.infra.connection.kernel.KernelProcessor;
@@ -34,6 +35,7 @@ import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.DriverExecuti
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.infra.metadata.user.Grantee;
+import
org.apache.shardingsphere.infra.rule.attribute.raw.RawExecutionRuleAttribute;
import org.apache.shardingsphere.infra.session.query.QueryContext;
import org.apache.shardingsphere.sqlfederation.engine.SQLFederationEngine;
import
org.apache.shardingsphere.sqlfederation.executor.context.SQLFederationContext;
@@ -57,20 +59,22 @@ public final class DriverExecuteExecutor {
private final ShardingSphereMetaData metaData;
- private final DriverPushDownExecuteExecutor pushDownExecuteExecutor;
+ private final DriverJDBCPushDownExecuteExecutor jdbcPushDownExecutor;
+
+ private final DriverRawPushDownExecuteExecutor rawPushDownExecutor;
private final TrafficExecutor trafficExecutor;
private final SQLFederationEngine sqlFederationEngine;
- private ExecuteType executeType = ExecuteType.PUSH_DOWN;
+ private ExecuteType executeType;
public DriverExecuteExecutor(final ShardingSphereConnection connection,
final ShardingSphereMetaData metaData, final Grantee grantee,
- final JDBCExecutor jdbcExecutor, final
RawExecutor rawExecutor,
- final TrafficExecutor trafficExecutor, final
SQLFederationEngine sqlFederationEngine) {
+ final JDBCExecutor jdbcExecutor, final
RawExecutor rawExecutor, final TrafficExecutor trafficExecutor, final
SQLFederationEngine sqlFederationEngine) {
this.connection = connection;
this.metaData = metaData;
- pushDownExecuteExecutor = new
DriverPushDownExecuteExecutor(connection, metaData, grantee, jdbcExecutor,
rawExecutor);
+ jdbcPushDownExecutor = new
DriverJDBCPushDownExecuteExecutor(connection, metaData, grantee, jdbcExecutor);
+ rawPushDownExecutor = new DriverRawPushDownExecuteExecutor(connection,
metaData, grantee, rawExecutor);
this.trafficExecutor = trafficExecutor;
this.sqlFederationEngine = sqlFederationEngine;
}
@@ -103,7 +107,12 @@ public final class DriverExecuteExecutor {
}
ExecutionContext executionContext = new
KernelProcessor().generateExecutionContext(
queryContext, database, metaData.getGlobalRuleMetaData(),
metaData.getProps(),
connection.getDatabaseConnectionManager().getConnectionContext());
- return pushDownExecuteExecutor.execute(database, executionContext,
prepareEngine, executeCallback, addCallback, replayCallback);
+ if
(database.getRuleMetaData().getAttributes(RawExecutionRuleAttribute.class).isEmpty())
{
+ executeType = ExecuteType.JDBC_PUSH_DOWN;
+ return jdbcPushDownExecutor.execute(database, executionContext,
prepareEngine, executeCallback, addCallback, replayCallback);
+ }
+ executeType = ExecuteType.RAW_PUSH_DOWN;
+ return rawPushDownExecutor.execute(database, executionContext);
}
/**
@@ -118,13 +127,16 @@ public final class DriverExecuteExecutor {
*/
public Optional<ResultSet> getResultSet(final ShardingSphereDatabase
database, final SQLStatementContext sqlStatementContext,
final Statement statement, final
List<? extends Statement> statements) throws SQLException {
+ if (null == executeType) {
+ return Optional.empty();
+ }
switch (executeType) {
case TRAFFIC:
return Optional.of(trafficExecutor.getResultSet());
case FEDERATION:
return Optional.of(sqlFederationEngine.getResultSet());
- case PUSH_DOWN:
- return pushDownExecuteExecutor.getResultSet(database,
sqlStatementContext, statement, statements);
+ case JDBC_PUSH_DOWN:
+ return jdbcPushDownExecutor.getResultSet(database,
sqlStatementContext, statement, statements);
default:
return Optional.empty();
}
@@ -136,6 +148,8 @@ public final class DriverExecuteExecutor {
FEDERATION,
- PUSH_DOWN
+ JDBC_PUSH_DOWN,
+
+ RAW_PUSH_DOWN
}
}
diff --git
a/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/engine/DriverExecuteQueryExecutor.java
b/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/engine/DriverExecuteQueryExecutor.java
index 57d50dcd667..4d5e037fcb8 100644
---
a/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/engine/DriverExecuteQueryExecutor.java
+++
b/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/engine/DriverExecuteQueryExecutor.java
@@ -20,7 +20,8 @@ package org.apache.shardingsphere.driver.executor.engine;
import
org.apache.shardingsphere.driver.executor.callback.add.StatementAddCallback;
import
org.apache.shardingsphere.driver.executor.callback.execute.ExecuteQueryCallbackFactory;
import
org.apache.shardingsphere.driver.executor.callback.replay.StatementReplayCallback;
-import
org.apache.shardingsphere.driver.executor.engine.pushdown.DriverPushDownExecuteQueryExecutor;
+import
org.apache.shardingsphere.driver.executor.engine.pushdown.jdbc.DriverJDBCPushDownExecuteQueryExecutor;
+import
org.apache.shardingsphere.driver.executor.engine.pushdown.raw.DriverRawPushDownExecuteQueryExecutor;
import
org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection;
import
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutionUnit;
import
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor;
@@ -30,6 +31,7 @@ import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.JDBCDriv
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.infra.metadata.user.Grantee;
+import
org.apache.shardingsphere.infra.rule.attribute.raw.RawExecutionRuleAttribute;
import org.apache.shardingsphere.infra.session.query.QueryContext;
import org.apache.shardingsphere.sqlfederation.engine.SQLFederationEngine;
import
org.apache.shardingsphere.sqlfederation.executor.context.SQLFederationContext;
@@ -54,7 +56,9 @@ public final class DriverExecuteQueryExecutor {
private final ShardingSphereMetaData metaData;
- private final DriverPushDownExecuteQueryExecutor
pushDownExecuteQueryExecutor;
+ private final DriverJDBCPushDownExecuteQueryExecutor
driverJDBCPushDownExecutor;
+
+ private final DriverRawPushDownExecuteQueryExecutor
driverRawPushDownExecutor;
private final TrafficExecutor trafficExecutor;
@@ -65,7 +69,8 @@ public final class DriverExecuteQueryExecutor {
final TrafficExecutor trafficExecutor,
final SQLFederationEngine sqlFederationEngine) {
this.connection = connection;
this.metaData = metaData;
- pushDownExecuteQueryExecutor = new
DriverPushDownExecuteQueryExecutor(connection, metaData, grantee, jdbcExecutor,
rawExecutor);
+ driverJDBCPushDownExecutor = new
DriverJDBCPushDownExecuteQueryExecutor(connection, metaData, grantee,
jdbcExecutor);
+ driverRawPushDownExecutor = new
DriverRawPushDownExecuteQueryExecutor(connection, metaData, grantee,
rawExecutor);
this.trafficExecutor = trafficExecutor;
this.sqlFederationEngine = sqlFederationEngine;
}
@@ -96,7 +101,9 @@ public final class DriverExecuteQueryExecutor {
return sqlFederationEngine.executeQuery(prepareEngine,
new
ExecuteQueryCallbackFactory(prepareEngine.getType()).newInstance(database,
queryContext), new SQLFederationContext(false, queryContext, metaData,
connection.getProcessId()));
}
- return pushDownExecuteQueryExecutor.executeQuery(database,
queryContext, prepareEngine, statement, columnLabelAndIndexMap, addCallback,
replayCallback);
+ return
database.getRuleMetaData().getAttributes(RawExecutionRuleAttribute.class).isEmpty()
+ ? driverJDBCPushDownExecutor.executeQuery(database,
queryContext, prepareEngine, statement, columnLabelAndIndexMap, addCallback,
replayCallback)
+ : driverRawPushDownExecutor.executeQuery(database,
queryContext, statement, columnLabelAndIndexMap);
}
private TrafficExecutorCallback<ResultSet>
getTrafficExecuteQueryCallback(final String jdbcDriverType) {
diff --git
a/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/engine/DriverExecuteUpdateExecutor.java
b/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/engine/DriverExecuteUpdateExecutor.java
index e6af003b241..5fe29f16d1b 100644
---
a/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/engine/DriverExecuteUpdateExecutor.java
+++
b/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/engine/DriverExecuteUpdateExecutor.java
@@ -21,7 +21,8 @@ import lombok.RequiredArgsConstructor;
import
org.apache.shardingsphere.driver.executor.callback.add.StatementAddCallback;
import
org.apache.shardingsphere.driver.executor.callback.execute.StatementExecuteUpdateCallback;
import
org.apache.shardingsphere.driver.executor.callback.replay.StatementReplayCallback;
-import
org.apache.shardingsphere.driver.executor.engine.pushdown.DriverPushDownExecuteUpdateExecutor;
+import
org.apache.shardingsphere.driver.executor.engine.pushdown.jdbc.DriverJDBCPushDownExecuteUpdateExecutor;
+import
org.apache.shardingsphere.driver.executor.engine.pushdown.raw.DriverRawPushDownExecuteUpdateExecutor;
import
org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection;
import org.apache.shardingsphere.infra.connection.kernel.KernelProcessor;
import org.apache.shardingsphere.infra.executor.sql.context.ExecutionContext;
@@ -32,6 +33,7 @@ import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.DriverExecuti
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.infra.metadata.user.Grantee;
+import
org.apache.shardingsphere.infra.rule.attribute.raw.RawExecutionRuleAttribute;
import org.apache.shardingsphere.infra.session.query.QueryContext;
import org.apache.shardingsphere.traffic.executor.TrafficExecutor;
import org.apache.shardingsphere.traffic.rule.TrafficRule;
@@ -50,7 +52,9 @@ public final class DriverExecuteUpdateExecutor {
private final ShardingSphereMetaData metaData;
- private final DriverPushDownExecuteUpdateExecutor
pushDownExecuteUpdateExecutor;
+ private final DriverJDBCPushDownExecuteUpdateExecutor jdbcPushDownExecutor;
+
+ private final DriverRawPushDownExecuteUpdateExecutor rawPushDownExecutor;
private final TrafficExecutor trafficExecutor;
@@ -58,7 +62,8 @@ public final class DriverExecuteUpdateExecutor {
final Grantee grantee, final
JDBCExecutor jdbcExecutor, final RawExecutor rawExecutor, final TrafficExecutor
trafficExecutor) {
this.connection = connection;
this.metaData = metaData;
- pushDownExecuteUpdateExecutor = new
DriverPushDownExecuteUpdateExecutor(connection, metaData, grantee,
jdbcExecutor, rawExecutor);
+ jdbcPushDownExecutor = new
DriverJDBCPushDownExecuteUpdateExecutor(connection, metaData, grantee,
jdbcExecutor);
+ rawPushDownExecutor = new
DriverRawPushDownExecuteUpdateExecutor(connection, metaData, grantee,
rawExecutor);
this.trafficExecutor = trafficExecutor;
}
@@ -83,6 +88,8 @@ public final class DriverExecuteUpdateExecutor {
}
ExecutionContext executionContext = new
KernelProcessor().generateExecutionContext(
queryContext, database, metaData.getGlobalRuleMetaData(),
metaData.getProps(),
connection.getDatabaseConnectionManager().getConnectionContext());
- return pushDownExecuteUpdateExecutor.executeUpdate(database,
executionContext, prepareEngine, updateCallback, addCallback, replayCallback);
+ return
database.getRuleMetaData().getAttributes(RawExecutionRuleAttribute.class).isEmpty()
+ ? jdbcPushDownExecutor.executeUpdate(database,
executionContext, prepareEngine, updateCallback, addCallback, replayCallback)
+ : rawPushDownExecutor.executeUpdate(database,
executionContext);
}
}
diff --git
a/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/engine/pushdown/DriverPushDownExecuteExecutor.java
b/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/engine/pushdown/DriverPushDownExecuteExecutor.java
deleted file mode 100644
index 9e4466338ce..00000000000
---
a/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/engine/pushdown/DriverPushDownExecuteExecutor.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.driver.executor.engine.pushdown;
-
-import
org.apache.shardingsphere.driver.executor.callback.add.StatementAddCallback;
-import
org.apache.shardingsphere.driver.executor.callback.execute.StatementExecuteCallback;
-import
org.apache.shardingsphere.driver.executor.callback.replay.StatementReplayCallback;
-import
org.apache.shardingsphere.driver.executor.engine.pushdown.jdbc.DriverJDBCPushDownExecuteExecutor;
-import
org.apache.shardingsphere.driver.executor.engine.pushdown.raw.DriverRawPushDownExecuteExecutor;
-import
org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection;
-import
org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext;
-import org.apache.shardingsphere.infra.executor.sql.context.ExecutionContext;
-import
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutionUnit;
-import
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor;
-import
org.apache.shardingsphere.infra.executor.sql.execute.engine.raw.RawExecutor;
-import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.DriverExecutionPrepareEngine;
-import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
-import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.metadata.user.Grantee;
-import
org.apache.shardingsphere.infra.rule.attribute.raw.RawExecutionRuleAttribute;
-
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.List;
-import java.util.Optional;
-
-/**
- * Driver push down execute executor.
- */
-public final class DriverPushDownExecuteExecutor {
-
- private final DriverJDBCPushDownExecuteExecutor jdbcPushDownExecutor;
-
- private final DriverRawPushDownExecuteExecutor rawPushDownExecutor;
-
- public DriverPushDownExecuteExecutor(final ShardingSphereConnection
connection, final ShardingSphereMetaData metaData, final Grantee grantee,
- final JDBCExecutor jdbcExecutor,
final RawExecutor rawExecutor) {
- jdbcPushDownExecutor = new
DriverJDBCPushDownExecuteExecutor(connection, metaData, grantee, jdbcExecutor);
- rawPushDownExecutor = new DriverRawPushDownExecuteExecutor(connection,
metaData, grantee, rawExecutor);
- }
-
- /**
- * Execute.
- *
- * @param database database
- * @param executionContext execution context
- * @param prepareEngine prepare engine
- * @param executeCallback statement execute callback
- * @param addCallback statement add callback
- * @param replayCallback statement replay callback
- * @return is query
- * @throws SQLException SQL exception
- */
- @SuppressWarnings("rawtypes")
- public boolean execute(final ShardingSphereDatabase database, final
ExecutionContext executionContext, final
DriverExecutionPrepareEngine<JDBCExecutionUnit, Connection> prepareEngine,
- final StatementExecuteCallback executeCallback,
final StatementAddCallback addCallback, final StatementReplayCallback
replayCallback) throws SQLException {
- return
database.getRuleMetaData().getAttributes(RawExecutionRuleAttribute.class).isEmpty()
- ? jdbcPushDownExecutor.execute(database, executionContext,
prepareEngine, executeCallback, addCallback, replayCallback)
- : rawPushDownExecutor.execute(database, executionContext);
- }
-
- /**
- * Get result set.
- *
- * @param database database
- * @param sqlStatementContext SQL statement context
- * @param statement statement
- * @param statements statements
- * @return result set
- * @throws SQLException SQL exception
- */
- public Optional<ResultSet> getResultSet(final ShardingSphereDatabase
database, final SQLStatementContext sqlStatementContext,
- final Statement statement, final
List<? extends Statement> statements) throws SQLException {
- return
database.getRuleMetaData().getAttributes(RawExecutionRuleAttribute.class).isEmpty()
- ? jdbcPushDownExecutor.getResultSet(database,
sqlStatementContext, statement, statements)
- : Optional.empty();
- }
-}
diff --git
a/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/engine/pushdown/DriverPushDownExecuteQueryExecutor.java
b/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/engine/pushdown/DriverPushDownExecuteQueryExecutor.java
deleted file mode 100644
index ec6c7305dd5..00000000000
---
a/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/engine/pushdown/DriverPushDownExecuteQueryExecutor.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.driver.executor.engine.pushdown;
-
-import
org.apache.shardingsphere.driver.executor.callback.add.StatementAddCallback;
-import
org.apache.shardingsphere.driver.executor.callback.replay.StatementReplayCallback;
-import
org.apache.shardingsphere.driver.executor.engine.pushdown.jdbc.DriverJDBCPushDownExecuteQueryExecutor;
-import
org.apache.shardingsphere.driver.executor.engine.pushdown.raw.DriverRawPushDownExecuteQueryExecutor;
-import
org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection;
-import
org.apache.shardingsphere.driver.jdbc.core.resultset.ShardingSphereResultSet;
-import
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutionUnit;
-import
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor;
-import
org.apache.shardingsphere.infra.executor.sql.execute.engine.raw.RawExecutor;
-import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.DriverExecutionPrepareEngine;
-import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
-import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.metadata.user.Grantee;
-import
org.apache.shardingsphere.infra.rule.attribute.raw.RawExecutionRuleAttribute;
-import org.apache.shardingsphere.infra.session.query.QueryContext;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.Map;
-
-/**
- * Driver push down execute query executor.
- */
-public final class DriverPushDownExecuteQueryExecutor {
-
- private final DriverJDBCPushDownExecuteQueryExecutor
driverJDBCPushDownExecutor;
-
- private final DriverRawPushDownExecuteQueryExecutor
driverRawPushDownExecutor;
-
- public DriverPushDownExecuteQueryExecutor(final ShardingSphereConnection
connection, final ShardingSphereMetaData metaData, final Grantee grantee,
- final JDBCExecutor jdbcExecutor,
final RawExecutor rawExecutor) {
- driverJDBCPushDownExecutor = new
DriverJDBCPushDownExecuteQueryExecutor(connection, metaData, grantee,
jdbcExecutor);
- driverRawPushDownExecutor = new
DriverRawPushDownExecuteQueryExecutor(connection, metaData, grantee,
rawExecutor);
- }
-
- /**
- * Execute query.
- *
- * @param database database
- * @param queryContext query context
- * @param prepareEngine prepare engine
- * @param statement statement
- * @param columnLabelAndIndexMap column label and index map
- * @param addCallback statement add callback
- * @param replayCallback statement replay callback
- * @return result set
- * @throws SQLException SQL exception
- */
- @SuppressWarnings("rawtypes")
- public ShardingSphereResultSet executeQuery(final ShardingSphereDatabase
database, final QueryContext queryContext,
- final
DriverExecutionPrepareEngine<JDBCExecutionUnit, Connection> prepareEngine,
final Statement statement,
- final Map<String, Integer>
columnLabelAndIndexMap,
- final StatementAddCallback
addCallback, final StatementReplayCallback replayCallback) throws SQLException {
- return
database.getRuleMetaData().getAttributes(RawExecutionRuleAttribute.class).isEmpty()
- ? driverJDBCPushDownExecutor.executeQuery(database,
queryContext, prepareEngine, statement, columnLabelAndIndexMap, addCallback,
replayCallback)
- : driverRawPushDownExecutor.executeQuery(database,
queryContext, statement, columnLabelAndIndexMap);
- }
-}
diff --git
a/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/engine/pushdown/DriverPushDownExecuteUpdateExecutor.java
b/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/engine/pushdown/DriverPushDownExecuteUpdateExecutor.java
deleted file mode 100644
index 8ca3f327d59..00000000000
---
a/jdbc/src/main/java/org/apache/shardingsphere/driver/executor/engine/pushdown/DriverPushDownExecuteUpdateExecutor.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.driver.executor.engine.pushdown;
-
-import
org.apache.shardingsphere.driver.executor.callback.add.StatementAddCallback;
-import
org.apache.shardingsphere.driver.executor.callback.execute.StatementExecuteUpdateCallback;
-import
org.apache.shardingsphere.driver.executor.callback.replay.StatementReplayCallback;
-import
org.apache.shardingsphere.driver.executor.engine.pushdown.jdbc.DriverJDBCPushDownExecuteUpdateExecutor;
-import
org.apache.shardingsphere.driver.executor.engine.pushdown.raw.DriverRawPushDownExecuteUpdateExecutor;
-import
org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection;
-import org.apache.shardingsphere.infra.executor.sql.context.ExecutionContext;
-import
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutionUnit;
-import
org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor;
-import
org.apache.shardingsphere.infra.executor.sql.execute.engine.raw.RawExecutor;
-import
org.apache.shardingsphere.infra.executor.sql.prepare.driver.DriverExecutionPrepareEngine;
-import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
-import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.metadata.user.Grantee;
-import
org.apache.shardingsphere.infra.rule.attribute.raw.RawExecutionRuleAttribute;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-
-/**
- * Driver push down execute update executor.
- */
-public final class DriverPushDownExecuteUpdateExecutor {
-
- private final DriverJDBCPushDownExecuteUpdateExecutor jdbcPushDownExecutor;
-
- private final DriverRawPushDownExecuteUpdateExecutor rawPushDownExecutor;
-
- public DriverPushDownExecuteUpdateExecutor(final ShardingSphereConnection
connection, final ShardingSphereMetaData metaData, final Grantee grantee,
- final JDBCExecutor
jdbcExecutor, final RawExecutor rawExecutor) {
- jdbcPushDownExecutor = new
DriverJDBCPushDownExecuteUpdateExecutor(connection, metaData, grantee,
jdbcExecutor);
- rawPushDownExecutor = new
DriverRawPushDownExecuteUpdateExecutor(connection, metaData, grantee,
rawExecutor);
- }
-
- /**
- * Execute update.
- *
- * @param database database
- * @param executionContext execution context
- * @param prepareEngine prepare engine
- * @param updateCallback statement execute update callback
- * @param replayCallback statement replay callback
- * @param addCallback statement add callback
- * @return updated row count
- * @throws SQLException SQL exception
- */
- @SuppressWarnings("rawtypes")
- public int executeUpdate(final ShardingSphereDatabase database, final
ExecutionContext executionContext, final
DriverExecutionPrepareEngine<JDBCExecutionUnit, Connection> prepareEngine,
- final StatementExecuteUpdateCallback
updateCallback, final StatementAddCallback addCallback, final
StatementReplayCallback replayCallback) throws SQLException {
- return
database.getRuleMetaData().getAttributes(RawExecutionRuleAttribute.class).isEmpty()
- ? jdbcPushDownExecutor.executeUpdate(database,
executionContext, prepareEngine, updateCallback, addCallback, replayCallback)
- : rawPushDownExecutor.executeUpdate(database,
executionContext);
- }
-}