RaigorJiang commented on a change in pull request #15415:
URL: https://github.com/apache/shardingsphere/pull/15415#discussion_r806706365



##########
File path: 
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/RALBackendHandlerFactory.java
##########
@@ -50,18 +70,39 @@
      * @throws SQLException SQL exception
      */
     public static TextProtocolBackendHandler newInstance(final DatabaseType 
databaseType, final RALStatement sqlStatement, final ConnectionSession 
connectionSession) throws SQLException {
+        TextProtocolBackendHandler result = null;
         if (sqlStatement instanceof QueryableRALStatement) {
-            return 
QueryableRALBackendHandlerFactory.newInstance((QueryableRALStatement) 
sqlStatement, connectionSession);
+            result = 
ScalingQueryableRALBackendHandlerFactory.newInstance((QueryableRALStatement) 
sqlStatement, connectionSession);
         }
         if (sqlStatement instanceof UpdatableRALStatement) {
-            return 
UpdatableRALBackendHandlerFactory.newInstance((UpdatableRALStatement) 
sqlStatement);
+            result = 
ScalingUpdatableRALBackendHandlerFactory.newInstance((UpdatableRALStatement) 
sqlStatement);
         }
         if (sqlStatement instanceof CommonDistSQLStatement) {
-            return 
CommonDistSQLBackendHandlerFactory.newInstance((CommonDistSQLStatement) 
sqlStatement, connectionSession);
+            result = 
CommonDistSQLBackendHandlerFactory.newInstance((CommonDistSQLStatement) 
sqlStatement, connectionSession);
         }
         if (sqlStatement instanceof AdvancedDistSQLStatement) {
-            return 
AdvancedDistSQLBackendHandlerFactory.newInstance(databaseType, 
(AdvancedDistSQLStatement) sqlStatement, connectionSession);
+            result = 
AdvancedDistSQLBackendHandlerFactory.newInstance(databaseType, 
(AdvancedDistSQLStatement) sqlStatement, connectionSession);
+        }
+        if (result == null) {
+            HandlerParameter parameter = new 
HandlerParameter().setStatement(sqlStatement).setConnectionSession(connectionSession).setDatabaseType(databaseType);

Review comment:
       Could it be more concise if using the constructor?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to