strongduanmu commented on a change in pull request #11464:
URL: https://github.com/apache/shardingsphere/pull/11464#discussion_r675290097



##########
File path: 
shardingsphere-infra/shardingsphere-infra-binder/src/main/java/org/apache/shardingsphere/infra/binder/statement/dml/SelectStatementContext.java
##########
@@ -113,6 +113,9 @@ public SelectStatementContext(final Map<String, 
ShardingSphereMetaData> metaData
     private ShardingSphereSchema getSchema(final Map<String, 
ShardingSphereMetaData> metaDataMap, final String defaultSchemaName) {
         String schemaName = 
tablesContext.getSchemaName().orElse(defaultSchemaName);
         ShardingSphereMetaData metaData = metaDataMap.get(schemaName);
+        if (null == metaData && tablesContext.getTables().isEmpty()) {
+            return null;
+        }
         Preconditions.checkState(null != metaData, "Can not get meta data by 
schema mame `%s`.", schemaName);

Review comment:
       > Unnecessary code?
   
   @menghaoranss For sql without table, like `select 1`, it doesn't need 
metaData.
   




-- 
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