You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by wu...@apache.org on 2021/06/18 15:47:53 UTC

[shardingsphere] branch master updated: Refactor DistSQLBackendHandlerFactory (#10877)

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

wuweijie 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 546e465  Refactor DistSQLBackendHandlerFactory (#10877)
546e465 is described below

commit 546e465b99f65ad616f6fbdba220b71e1bcb0f25
Author: Liang Zhang <te...@163.com>
AuthorDate: Fri Jun 18 23:47:26 2021 +0800

    Refactor DistSQLBackendHandlerFactory (#10877)
---
 .../backend/text/distsql/DistSQLBackendHandlerFactory.java | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/DistSQLBackendHandlerFactory.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/DistSQLBackendHandlerFactory.java
index 48fb2cb..aa431de 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/DistSQLBackendHandlerFactory.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/DistSQLBackendHandlerFactory.java
@@ -19,7 +19,8 @@ package org.apache.shardingsphere.proxy.backend.text.distsql;
 
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.distsql.parser.statement.ral.RALStatement;
+import org.apache.shardingsphere.distsql.parser.statement.rdl.RDLStatement;
+import org.apache.shardingsphere.distsql.parser.statement.rql.RQLStatement;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
 import org.apache.shardingsphere.proxy.backend.text.TextProtocolBackendHandler;
@@ -47,13 +48,12 @@ public final class DistSQLBackendHandlerFactory {
      * @throws SQLException SQL exception
      */
     public static Optional<TextProtocolBackendHandler> newInstance(final DatabaseType databaseType, final SQLStatement sqlStatement, final BackendConnection backendConnection) throws SQLException {
-        Optional<TextProtocolBackendHandler> rqlBackendHandler = RQLBackendHandlerFactory.newInstance(sqlStatement, backendConnection);
-        if (rqlBackendHandler.isPresent()) {
-            return rqlBackendHandler;
+        if (sqlStatement instanceof RQLStatement) {
+            return RQLBackendHandlerFactory.newInstance(sqlStatement, backendConnection);
         }
-        if (sqlStatement instanceof RALStatement) {
-            return RALBackendHandlerFactory.newInstance(sqlStatement);
+        if (sqlStatement instanceof RDLStatement) {
+            return RDLBackendHandlerFactory.newInstance(databaseType, sqlStatement, backendConnection);
         }
-        return RDLBackendHandlerFactory.newInstance(databaseType, sqlStatement, backendConnection);
+        return RALBackendHandlerFactory.newInstance(sqlStatement);
     }
 }