wgy8283335 commented on issue #7531:
URL: https://github.com/apache/shardingsphere/issues/7531#issuecomment-726438959


   I've move checkSubqueryShardingValues() to ShardingSQLRouter.java. but the 
check of sharding conditions is deprecated, as shardingConditions is not in the 
input parameters of preValidate().
   
   ```
   public final class ShardingSelectStatementValidator extends 
ShardingDMLStatementValidator<SelectStatement> {
       
       @Override
       public void preValidate(final ShardingRule shardingRule, final 
SQLStatementContext<SelectStatement> sqlStatementContext, 
                               final List<Object> parameters, final 
ShardingSphereSchema schema) {
           for (String each : 
sqlStatementContext.getTablesContext().getTableNames()) {
               Optional<TableRule> tableRule = shardingRule.findTableRule(each);
               if (tableRule.isPresent() && isRoutingByHint(shardingRule, 
tableRule.get())
                   && !HintManager.getDatabaseShardingValues(each).isEmpty() && 
!HintManager.getTableShardingValues(each).isEmpty()) {
                   return;
               }
           }
       }
       
       @Override
       public void postValidate(final SelectStatement sqlStatement, final 
RouteContext routeContext) {
   
       }
   
       private boolean isRoutingByHint(final ShardingRule shardingRule, final 
TableRule tableRule) {
           return 
shardingRule.getDatabaseShardingStrategyConfiguration(tableRule) instanceof 
HintShardingStrategyConfiguration
               && shardingRule.getTableShardingStrategyConfiguration(tableRule) 
instanceof HintShardingStrategyConfiguration;
       }
   }
   
   ```


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

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


Reply via email to