You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/06/30 08:34:39 UTC

[GitHub] [shardingsphere] terrymanu commented on a diff in pull request #18718: Pre-judgment database name is null.

terrymanu commented on code in PR #18718:
URL: https://github.com/apache/shardingsphere/pull/18718#discussion_r910757908


##########
shardingsphere-infra/shardingsphere-infra-binder/src/main/java/org/apache/shardingsphere/infra/binder/statement/dml/SelectStatementContext.java:
##########
@@ -128,15 +128,17 @@ private Map<Integer, SelectStatementContext> createSubqueryContexts(final Map<St
     }
     
     private Map<String, ShardingSphereSchema> getSchemas(final Map<String, ShardingSphereDatabase> databases, final String databaseName) {
-        ShardingSphereDatabase database = databases.get(databaseName);
-        if (null == database) {
+        if (null == databaseName) {
             if (tablesContext.getTables().isEmpty()) {
                 return Collections.emptyMap();
             } else {
-                throw new DatabaseNotExistedException(databaseName);
+                throw new DatabaseNotExistedException(null);

Review Comment:
   null parameter maybe not good, how about create a new exception?
   maybe `NoDatabaseException` is a good name.



##########
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/parse/PostgreSQLComParseExecutorTest.java:
##########
@@ -121,6 +125,13 @@ public void assertExecuteWithParameterizedSQL() {
         assertThat(actualPreparedStatement.getParameterTypes(), is(Arrays.asList(PostgreSQLColumnType.POSTGRESQL_TYPE_INT4, PostgreSQLColumnType.POSTGRESQL_TYPE_UNSPECIFIED)));
     }
     
+    @SneakyThrows

Review Comment:
   Please throw concrete exception 



-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org