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 2020/11/13 02:01:30 UTC

[GitHub] [shardingsphere] wgy8283335 removed a comment on issue #7531: Improvement on subquery handling in ShardingRouteDecorator

wgy8283335 removed a comment 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:
users@infra.apache.org