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/24 06:26:00 UTC

[GitHub] [shardingsphere] wgy8283335 opened a new pull request #8310: feature: add subquery valid in ShardingInsertStatementValidator and ShardingSelectStatementValidator

wgy8283335 opened a new pull request #8310:
URL: https://github.com/apache/shardingsphere/pull/8310


   Add subquery valid in ShardingInsertStatementValidator and ShardingSelectStatementValidator.
   
   Fixes #7531.
   
   Changes proposed in this pull request:
   -
   -
   -
   


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



[GitHub] [shardingsphere] strongduanmu commented on pull request #8310: feature: add subquery valid in ShardingInsertStatementValidator and ShardingSelectStatementValidator

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on pull request #8310:
URL: https://github.com/apache/shardingsphere/pull/8310#issuecomment-732822162


   @wgy8283335 Can you solve the CI build exception first?
   


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



[GitHub] [shardingsphere] strongduanmu commented on a change in pull request #8310: feature: add subquery valid in ShardingInsertStatementValidator and ShardingSelectStatementValidator

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on a change in pull request #8310:
URL: https://github.com/apache/shardingsphere/pull/8310#discussion_r532045481



##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingInsertStatementValidator.java
##########
@@ -84,6 +103,94 @@ private boolean isContainsKeyGenerateColumn(final ShardingRule shardingRule, fin
     private boolean isAllSameTables(final Collection<String> tableNames) {
         return 1 == tableNames.stream().distinct().count();
     }
+
+    private void checkSubqueryShardingValues(final ShardingRule shardingRule, final SQLStatementContext<InsertStatement> sqlStatementContext,

Review comment:
       The `checkSubqueryShardingValues` method is duplicated with the method in `ShardingSelectStatementValidator` class, and it might be better to extract it into `ShardingDMLStatementValidator` class.

##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingSelectStatementValidator.java
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sharding.route.engine.validator.dml.impl;
+
+import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
+import org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementContext;
+import org.apache.shardingsphere.infra.hint.HintManager;
+import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
+import org.apache.shardingsphere.infra.route.context.RouteContext;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.HintShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.route.engine.condition.ShardingCondition;
+import org.apache.shardingsphere.sharding.route.engine.condition.ShardingConditions;
+import org.apache.shardingsphere.sharding.route.engine.condition.engine.ShardingConditionEngine;
+import org.apache.shardingsphere.sharding.route.engine.condition.engine.impl.WhereClauseShardingConditionEngine;
+import org.apache.shardingsphere.sharding.route.engine.condition.value.ListShardingConditionValue;
+import org.apache.shardingsphere.sharding.route.engine.condition.value.RangeShardingConditionValue;
+import org.apache.shardingsphere.sharding.route.engine.condition.value.ShardingConditionValue;
+import org.apache.shardingsphere.sharding.route.engine.validator.dml.ShardingDMLStatementValidator;
+import org.apache.shardingsphere.sharding.rule.BindingTableRule;
+import org.apache.shardingsphere.sharding.rule.ShardingRule;
+import org.apache.shardingsphere.sharding.rule.TableRule;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.DMLStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.util.SafeNumberOperationUtils;
+
+import com.google.common.base.Preconditions;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * Sharding select statement validator.
+ */
+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) {
+        if (isNeedMergeShardingValues(sqlStatementContext, shardingRule)) {
+            checkSubqueryShardingValues(shardingRule, sqlStatementContext, parameters, schema);
+        }
+    }
+    
+    private boolean isNeedMergeShardingValues(final SQLStatementContext<?> sqlStatementContext, final ShardingRule rule) {
+        boolean selectContainsSubquery = sqlStatementContext instanceof SelectStatementContext && ((SelectStatementContext) sqlStatementContext).isContainsSubquery();
+        return selectContainsSubquery && !rule.getShardingLogicTableNames(sqlStatementContext.getTablesContext().getTableNames()).isEmpty();
+    }
+    
+    private void checkSubqueryShardingValues(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;
+            }
+        }
+        ShardingConditions shardingConditions = createShardingConditions(sqlStatementContext, parameters, schema, shardingRule);
+        if (shardingConditions.getConditions().size() > 1) {
+            Preconditions.checkState(isSameShardingCondition(shardingRule, shardingConditions), "Sharding value must same with subquery.");
+        }
+    }
+    
+    private boolean isRoutingByHint(final ShardingRule shardingRule, final TableRule tableRule) {
+        return shardingRule.getDatabaseShardingStrategyConfiguration(tableRule) instanceof HintShardingStrategyConfiguration
+            && shardingRule.getTableShardingStrategyConfiguration(tableRule) instanceof HintShardingStrategyConfiguration;
+    }
+    
+    private boolean isSameShardingCondition(final ShardingRule shardingRule, final ShardingConditions shardingConditions) {
+        ShardingCondition example = shardingConditions.getConditions().remove(shardingConditions.getConditions().size() - 1);
+        for (ShardingCondition each : shardingConditions.getConditions()) {
+            if (!isSameShardingCondition(shardingRule, example, each)) {
+                return false;
+            }
+        }
+        return true;
+    }
+    
+    private boolean isSameShardingCondition(final ShardingRule shardingRule, final ShardingCondition shardingCondition1, final ShardingCondition shardingCondition2) {
+        if (shardingCondition1.getValues().size() != shardingCondition2.getValues().size()) {
+            return false;
+        }
+        for (int i = 0; i < shardingCondition1.getValues().size(); i++) {
+            ShardingConditionValue shardingConditionValue1 = shardingCondition1.getValues().get(i);
+            ShardingConditionValue shardingConditionValue2 = shardingCondition2.getValues().get(i);
+            if (!isSameShardingConditionValue(shardingRule, shardingConditionValue1, shardingConditionValue2)) {
+                return false;
+            }
+        }
+        return true;
+    }
+    
+    private boolean isSameShardingConditionValue(final ShardingRule shardingRule, final ShardingConditionValue shardingConditionValue1, final ShardingConditionValue shardingConditionValue2) {
+        return isSameLogicTable(shardingRule, shardingConditionValue1, shardingConditionValue2) && shardingConditionValue1.getColumnName().equals(shardingConditionValue2.getColumnName());
+    }
+    
+    private boolean isSameLogicTable(final ShardingRule shardingRule, final ShardingConditionValue shardingValue1, final ShardingConditionValue shardingValue2) {
+        return shardingValue1.getTableName().equals(shardingValue2.getTableName()) || isBindingTable(shardingRule, shardingValue1, shardingValue2);
+    }
+    
+    private boolean isBindingTable(final ShardingRule shardingRule, final ShardingConditionValue shardingValue1, final ShardingConditionValue shardingValue2) {
+        Optional<BindingTableRule> bindingRule = shardingRule.findBindingTableRule(shardingValue1.getTableName());
+        return bindingRule.isPresent() && bindingRule.get().hasLogicTable(shardingValue2.getTableName());
+    }
+    
+    @SuppressWarnings({"rawtypes", "unchecked"})
+    private boolean isSameValue(final ShardingConditionValue shardingConditionValue1, final ShardingConditionValue shardingConditionValue2) {
+        if (shardingConditionValue1 instanceof ListShardingConditionValue && shardingConditionValue2 instanceof ListShardingConditionValue) {
+            return SafeNumberOperationUtils.safeCollectionEquals(
+                ((ListShardingConditionValue) shardingConditionValue1).getValues(), ((ListShardingConditionValue) shardingConditionValue2).getValues());
+        } else if (shardingConditionValue1 instanceof RangeShardingConditionValue && shardingConditionValue2 instanceof RangeShardingConditionValue) {
+            return SafeNumberOperationUtils.safeRangeEquals(
+                ((RangeShardingConditionValue) shardingConditionValue1).getValueRange(), ((RangeShardingConditionValue) shardingConditionValue2).getValueRange());
+        }
+        return false;
+    }
+    
+    private ShardingConditions createShardingConditions(final SQLStatementContext<SelectStatement> sqlStatementContext,
+        final List<Object> parameters, final ShardingSphereSchema schema, final ShardingRule rule) {
+        List<ShardingCondition> shardingConditions;
+        if (sqlStatementContext.getSqlStatement() instanceof DMLStatement) {
+            ShardingConditionEngine shardingConditionEngine = new WhereClauseShardingConditionEngine(rule, schema);
+            shardingConditions = shardingConditionEngine.createShardingConditions(sqlStatementContext, parameters);
+        } else {
+            shardingConditions = Collections.emptyList();
+        }
+        return new ShardingConditions(shardingConditions);
+    }
+    
+    @Override
+    public void postValidate(final SelectStatement sqlStatement, final RouteContext routeContext) {
+    }
+    

Review comment:
       Please remove this extra blank line. 😉

##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingInsertStatementValidator.java
##########
@@ -84,6 +103,94 @@ private boolean isContainsKeyGenerateColumn(final ShardingRule shardingRule, fin
     private boolean isAllSameTables(final Collection<String> tableNames) {
         return 1 == tableNames.stream().distinct().count();
     }
+
+    private void checkSubqueryShardingValues(final ShardingRule shardingRule, final SQLStatementContext<InsertStatement> 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;
+            }
+        }
+        ShardingConditions shardingConditions = createShardingConditions(sqlStatementContext, parameters, schema, shardingRule);
+        if (shardingConditions.getConditions().size() > 1) {
+            Preconditions.checkState(isSameShardingCondition(shardingRule, shardingConditions), "Sharding value must same with subquery.");
+        }
+    }
+
+    private boolean isRoutingByHint(final ShardingRule shardingRule, final TableRule tableRule) {
+        return shardingRule.getDatabaseShardingStrategyConfiguration(tableRule) instanceof HintShardingStrategyConfiguration
+            && shardingRule.getTableShardingStrategyConfiguration(tableRule) instanceof HintShardingStrategyConfiguration;
+    }
+
+    private boolean isSameShardingCondition(final ShardingRule shardingRule, final ShardingConditions shardingConditions) {
+        ShardingCondition example = shardingConditions.getConditions().remove(shardingConditions.getConditions().size() - 1);
+        for (ShardingCondition each : shardingConditions.getConditions()) {
+            if (!isSameShardingCondition(shardingRule, example, each)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    private boolean isSameShardingCondition(final ShardingRule shardingRule, final ShardingCondition shardingCondition1, final ShardingCondition shardingCondition2) {
+        if (shardingCondition1.getValues().size() != shardingCondition2.getValues().size()) {
+            return false;
+        }
+        for (int i = 0; i < shardingCondition1.getValues().size(); i++) {
+            ShardingConditionValue shardingConditionValue1 = shardingCondition1.getValues().get(i);
+            ShardingConditionValue shardingConditionValue2 = shardingCondition2.getValues().get(i);
+            if (!isSameShardingConditionValue(shardingRule, shardingConditionValue1, shardingConditionValue2)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    private boolean isSameShardingConditionValue(final ShardingRule shardingRule, final ShardingConditionValue shardingConditionValue1, final ShardingConditionValue shardingConditionValue2) {
+        return isSameLogicTable(shardingRule, shardingConditionValue1, shardingConditionValue2) && shardingConditionValue1.getColumnName().equals(shardingConditionValue2.getColumnName())
+            && isSameValue(shardingConditionValue1, shardingConditionValue2);
+    }
+
+    private boolean isSameLogicTable(final ShardingRule shardingRule, final ShardingConditionValue shardingValue1, final ShardingConditionValue shardingValue2) {
+        return shardingValue1.getTableName().equals(shardingValue2.getTableName()) || isBindingTable(shardingRule, shardingValue1, shardingValue2);
+    }
+
+    private boolean isBindingTable(final ShardingRule shardingRule, final ShardingConditionValue shardingValue1, final ShardingConditionValue shardingValue2) {
+        Optional<BindingTableRule> bindingRule = shardingRule.findBindingTableRule(shardingValue1.getTableName());
+        return bindingRule.isPresent() && bindingRule.get().hasLogicTable(shardingValue2.getTableName());
+    }
+
+    @SuppressWarnings({"rawtypes", "unchecked"})
+    private boolean isSameValue(final ShardingConditionValue shardingConditionValue1, final ShardingConditionValue shardingConditionValue2) {
+        if (shardingConditionValue1 instanceof ListShardingConditionValue && shardingConditionValue2 instanceof ListShardingConditionValue) {
+            return SafeNumberOperationUtils.safeCollectionEquals(
+                ((ListShardingConditionValue) shardingConditionValue1).getValues(), ((ListShardingConditionValue) shardingConditionValue2).getValues());
+        } else if (shardingConditionValue1 instanceof RangeShardingConditionValue && shardingConditionValue2 instanceof RangeShardingConditionValue) {
+            return SafeNumberOperationUtils.safeRangeEquals(
+                ((RangeShardingConditionValue) shardingConditionValue1).getValueRange(), ((RangeShardingConditionValue) shardingConditionValue2).getValueRange());
+        }
+        return false;
+    }
+
+    private ShardingConditions createShardingConditions(final SQLStatementContext<InsertStatement> sqlStatementContext,
+        final List<Object> parameters, final ShardingSphereSchema schema, final ShardingRule rule) {
+        List<ShardingCondition> shardingConditions;
+        if (sqlStatementContext.getSqlStatement() instanceof DMLStatement) {
+            ShardingConditionEngine shardingConditionEngine = new WhereClauseShardingConditionEngine(rule, schema);
+            shardingConditions = shardingConditionEngine.createShardingConditions(sqlStatementContext, parameters);
+        } else {
+            shardingConditions = Collections.emptyList();
+        }
+        return new ShardingConditions(shardingConditions);
+    }
+
+    private boolean isNeedMergeShardingValues(final SQLStatementContext<?> sqlStatementContext, final ShardingRule rule) {
+        boolean insertSelectContainsSubquery = sqlStatementContext instanceof InsertStatementContext && null != ((InsertStatementContext) sqlStatementContext).getInsertSelectContext()
+            && ((InsertStatementContext) sqlStatementContext).getInsertSelectContext().getSelectStatementContext().isContainsSubquery();

Review comment:
       I think this check is redundant because we've already judged `insertSelectSegment.isPresent()`, and we can use `insertSelectStatement` directly to determine whether sub-queries are included. BTW, this method can also be extracted into the `ShardingDMLStatementValidator` class. What do you think ?

##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingInsertStatementValidator.java
##########
@@ -62,6 +78,9 @@ public void preValidate(final ShardingRule shardingRule, final SQLStatementConte
         if (insertSelectSegment.isPresent() && !isAllSameTables(tablesContext.getTableNames()) && !shardingRule.isAllBindingTables(tablesContext.getTableNames())) {
             throw new ShardingSphereException("The table inserted and the table selected must be the same or bind tables.");
         }
+        if (insertSelectSegment.isPresent() && isNeedMergeShardingValues(sqlStatementContext, shardingRule)) {
+            checkSubqueryShardingValues(shardingRule, sqlStatementContext, parameters, schema);

Review comment:
       Have you forgotten to remove the `checkSubqueryShardingValues` method from the `ShardingSQLRouter` class? 😉




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



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #8310: feature: add subquery valid in ShardingInsertStatementValidator and ShardingSelectStatementValidator

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #8310:
URL: https://github.com/apache/shardingsphere/pull/8310#discussion_r532296876



##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingInsertStatementValidator.java
##########
@@ -62,6 +78,9 @@ public void preValidate(final ShardingRule shardingRule, final SQLStatementConte
         if (insertSelectSegment.isPresent() && !isAllSameTables(tablesContext.getTableNames()) && !shardingRule.isAllBindingTables(tablesContext.getTableNames())) {
             throw new ShardingSphereException("The table inserted and the table selected must be the same or bind tables.");
         }
+        if (insertSelectSegment.isPresent() && isNeedMergeShardingValues(sqlStatementContext, shardingRule)) {
+            checkSubqueryShardingValues(shardingRule, sqlStatementContext, parameters, schema);

Review comment:
       OK




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



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #8310: feature: add subquery valid in ShardingInsertStatementValidator and ShardingSelectStatementValidator

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #8310:
URL: https://github.com/apache/shardingsphere/pull/8310#discussion_r532297530



##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingInsertStatementValidator.java
##########
@@ -84,6 +103,94 @@ private boolean isContainsKeyGenerateColumn(final ShardingRule shardingRule, fin
     private boolean isAllSameTables(final Collection<String> tableNames) {
         return 1 == tableNames.stream().distinct().count();
     }
+
+    private void checkSubqueryShardingValues(final ShardingRule shardingRule, final SQLStatementContext<InsertStatement> 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;
+            }
+        }
+        ShardingConditions shardingConditions = createShardingConditions(sqlStatementContext, parameters, schema, shardingRule);
+        if (shardingConditions.getConditions().size() > 1) {
+            Preconditions.checkState(isSameShardingCondition(shardingRule, shardingConditions), "Sharding value must same with subquery.");
+        }
+    }
+
+    private boolean isRoutingByHint(final ShardingRule shardingRule, final TableRule tableRule) {
+        return shardingRule.getDatabaseShardingStrategyConfiguration(tableRule) instanceof HintShardingStrategyConfiguration
+            && shardingRule.getTableShardingStrategyConfiguration(tableRule) instanceof HintShardingStrategyConfiguration;
+    }
+
+    private boolean isSameShardingCondition(final ShardingRule shardingRule, final ShardingConditions shardingConditions) {
+        ShardingCondition example = shardingConditions.getConditions().remove(shardingConditions.getConditions().size() - 1);
+        for (ShardingCondition each : shardingConditions.getConditions()) {
+            if (!isSameShardingCondition(shardingRule, example, each)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    private boolean isSameShardingCondition(final ShardingRule shardingRule, final ShardingCondition shardingCondition1, final ShardingCondition shardingCondition2) {
+        if (shardingCondition1.getValues().size() != shardingCondition2.getValues().size()) {
+            return false;
+        }
+        for (int i = 0; i < shardingCondition1.getValues().size(); i++) {
+            ShardingConditionValue shardingConditionValue1 = shardingCondition1.getValues().get(i);
+            ShardingConditionValue shardingConditionValue2 = shardingCondition2.getValues().get(i);
+            if (!isSameShardingConditionValue(shardingRule, shardingConditionValue1, shardingConditionValue2)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    private boolean isSameShardingConditionValue(final ShardingRule shardingRule, final ShardingConditionValue shardingConditionValue1, final ShardingConditionValue shardingConditionValue2) {
+        return isSameLogicTable(shardingRule, shardingConditionValue1, shardingConditionValue2) && shardingConditionValue1.getColumnName().equals(shardingConditionValue2.getColumnName())
+            && isSameValue(shardingConditionValue1, shardingConditionValue2);
+    }
+
+    private boolean isSameLogicTable(final ShardingRule shardingRule, final ShardingConditionValue shardingValue1, final ShardingConditionValue shardingValue2) {
+        return shardingValue1.getTableName().equals(shardingValue2.getTableName()) || isBindingTable(shardingRule, shardingValue1, shardingValue2);
+    }
+
+    private boolean isBindingTable(final ShardingRule shardingRule, final ShardingConditionValue shardingValue1, final ShardingConditionValue shardingValue2) {
+        Optional<BindingTableRule> bindingRule = shardingRule.findBindingTableRule(shardingValue1.getTableName());
+        return bindingRule.isPresent() && bindingRule.get().hasLogicTable(shardingValue2.getTableName());
+    }
+
+    @SuppressWarnings({"rawtypes", "unchecked"})
+    private boolean isSameValue(final ShardingConditionValue shardingConditionValue1, final ShardingConditionValue shardingConditionValue2) {
+        if (shardingConditionValue1 instanceof ListShardingConditionValue && shardingConditionValue2 instanceof ListShardingConditionValue) {
+            return SafeNumberOperationUtils.safeCollectionEquals(
+                ((ListShardingConditionValue) shardingConditionValue1).getValues(), ((ListShardingConditionValue) shardingConditionValue2).getValues());
+        } else if (shardingConditionValue1 instanceof RangeShardingConditionValue && shardingConditionValue2 instanceof RangeShardingConditionValue) {
+            return SafeNumberOperationUtils.safeRangeEquals(
+                ((RangeShardingConditionValue) shardingConditionValue1).getValueRange(), ((RangeShardingConditionValue) shardingConditionValue2).getValueRange());
+        }
+        return false;
+    }
+
+    private ShardingConditions createShardingConditions(final SQLStatementContext<InsertStatement> sqlStatementContext,
+        final List<Object> parameters, final ShardingSphereSchema schema, final ShardingRule rule) {
+        List<ShardingCondition> shardingConditions;
+        if (sqlStatementContext.getSqlStatement() instanceof DMLStatement) {
+            ShardingConditionEngine shardingConditionEngine = new WhereClauseShardingConditionEngine(rule, schema);
+            shardingConditions = shardingConditionEngine.createShardingConditions(sqlStatementContext, parameters);
+        } else {
+            shardingConditions = Collections.emptyList();
+        }
+        return new ShardingConditions(shardingConditions);
+    }
+
+    private boolean isNeedMergeShardingValues(final SQLStatementContext<?> sqlStatementContext, final ShardingRule rule) {
+        boolean insertSelectContainsSubquery = sqlStatementContext instanceof InsertStatementContext && null != ((InsertStatementContext) sqlStatementContext).getInsertSelectContext()
+            && ((InsertStatementContext) sqlStatementContext).getInsertSelectContext().getSelectStatementContext().isContainsSubquery();

Review comment:
       I think to move this method to the ShardingDMLStatementValidator is better.




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



[GitHub] [shardingsphere] strongduanmu merged pull request #8310: feature: add subquery valid in ShardingInsertStatementValidator and ShardingSelectStatementValidator

Posted by GitBox <gi...@apache.org>.
strongduanmu merged pull request #8310:
URL: https://github.com/apache/shardingsphere/pull/8310


   


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



[GitHub] [shardingsphere] wgy8283335 commented on pull request #8310: feature: add subquery valid in ShardingInsertStatementValidator and ShardingSelectStatementValidator

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on pull request #8310:
URL: https://github.com/apache/shardingsphere/pull/8310#issuecomment-735572786


   > @wgy8283335 Great job, and merged. Are you interested in `Aim-2` of issue #7531?
   
   OK


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



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #8310: feature: add subquery valid in ShardingInsertStatementValidator and ShardingSelectStatementValidator

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #8310:
URL: https://github.com/apache/shardingsphere/pull/8310#discussion_r532296862



##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingInsertStatementValidator.java
##########
@@ -84,6 +103,94 @@ private boolean isContainsKeyGenerateColumn(final ShardingRule shardingRule, fin
     private boolean isAllSameTables(final Collection<String> tableNames) {
         return 1 == tableNames.stream().distinct().count();
     }
+
+    private void checkSubqueryShardingValues(final ShardingRule shardingRule, final SQLStatementContext<InsertStatement> sqlStatementContext,

Review comment:
       OK




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



[GitHub] [shardingsphere] wgy8283335 commented on pull request #8310: feature: add subquery valid in ShardingInsertStatementValidator and ShardingSelectStatementValidator

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on pull request #8310:
URL: https://github.com/apache/shardingsphere/pull/8310#issuecomment-734046246


   > @wgy8283335 Can you solve the CI build exception first?
   
   I have fixed the bugs.


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



[GitHub] [shardingsphere] wgy8283335 commented on a change in pull request #8310: feature: add subquery valid in ShardingInsertStatementValidator and ShardingSelectStatementValidator

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on a change in pull request #8310:
URL: https://github.com/apache/shardingsphere/pull/8310#discussion_r532293181



##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/impl/ShardingSelectStatementValidator.java
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sharding.route.engine.validator.dml.impl;
+
+import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
+import org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementContext;
+import org.apache.shardingsphere.infra.hint.HintManager;
+import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
+import org.apache.shardingsphere.infra.route.context.RouteContext;
+import org.apache.shardingsphere.sharding.api.config.strategy.sharding.HintShardingStrategyConfiguration;
+import org.apache.shardingsphere.sharding.route.engine.condition.ShardingCondition;
+import org.apache.shardingsphere.sharding.route.engine.condition.ShardingConditions;
+import org.apache.shardingsphere.sharding.route.engine.condition.engine.ShardingConditionEngine;
+import org.apache.shardingsphere.sharding.route.engine.condition.engine.impl.WhereClauseShardingConditionEngine;
+import org.apache.shardingsphere.sharding.route.engine.condition.value.ListShardingConditionValue;
+import org.apache.shardingsphere.sharding.route.engine.condition.value.RangeShardingConditionValue;
+import org.apache.shardingsphere.sharding.route.engine.condition.value.ShardingConditionValue;
+import org.apache.shardingsphere.sharding.route.engine.validator.dml.ShardingDMLStatementValidator;
+import org.apache.shardingsphere.sharding.rule.BindingTableRule;
+import org.apache.shardingsphere.sharding.rule.ShardingRule;
+import org.apache.shardingsphere.sharding.rule.TableRule;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.DMLStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.util.SafeNumberOperationUtils;
+
+import com.google.common.base.Preconditions;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * Sharding select statement validator.
+ */
+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) {
+        if (isNeedMergeShardingValues(sqlStatementContext, shardingRule)) {
+            checkSubqueryShardingValues(shardingRule, sqlStatementContext, parameters, schema);
+        }
+    }
+    
+    private boolean isNeedMergeShardingValues(final SQLStatementContext<?> sqlStatementContext, final ShardingRule rule) {
+        boolean selectContainsSubquery = sqlStatementContext instanceof SelectStatementContext && ((SelectStatementContext) sqlStatementContext).isContainsSubquery();
+        return selectContainsSubquery && !rule.getShardingLogicTableNames(sqlStatementContext.getTablesContext().getTableNames()).isEmpty();
+    }
+    
+    private void checkSubqueryShardingValues(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;
+            }
+        }
+        ShardingConditions shardingConditions = createShardingConditions(sqlStatementContext, parameters, schema, shardingRule);
+        if (shardingConditions.getConditions().size() > 1) {
+            Preconditions.checkState(isSameShardingCondition(shardingRule, shardingConditions), "Sharding value must same with subquery.");
+        }
+    }
+    
+    private boolean isRoutingByHint(final ShardingRule shardingRule, final TableRule tableRule) {
+        return shardingRule.getDatabaseShardingStrategyConfiguration(tableRule) instanceof HintShardingStrategyConfiguration
+            && shardingRule.getTableShardingStrategyConfiguration(tableRule) instanceof HintShardingStrategyConfiguration;
+    }
+    
+    private boolean isSameShardingCondition(final ShardingRule shardingRule, final ShardingConditions shardingConditions) {
+        ShardingCondition example = shardingConditions.getConditions().remove(shardingConditions.getConditions().size() - 1);
+        for (ShardingCondition each : shardingConditions.getConditions()) {
+            if (!isSameShardingCondition(shardingRule, example, each)) {
+                return false;
+            }
+        }
+        return true;
+    }
+    
+    private boolean isSameShardingCondition(final ShardingRule shardingRule, final ShardingCondition shardingCondition1, final ShardingCondition shardingCondition2) {
+        if (shardingCondition1.getValues().size() != shardingCondition2.getValues().size()) {
+            return false;
+        }
+        for (int i = 0; i < shardingCondition1.getValues().size(); i++) {
+            ShardingConditionValue shardingConditionValue1 = shardingCondition1.getValues().get(i);
+            ShardingConditionValue shardingConditionValue2 = shardingCondition2.getValues().get(i);
+            if (!isSameShardingConditionValue(shardingRule, shardingConditionValue1, shardingConditionValue2)) {
+                return false;
+            }
+        }
+        return true;
+    }
+    
+    private boolean isSameShardingConditionValue(final ShardingRule shardingRule, final ShardingConditionValue shardingConditionValue1, final ShardingConditionValue shardingConditionValue2) {
+        return isSameLogicTable(shardingRule, shardingConditionValue1, shardingConditionValue2) && shardingConditionValue1.getColumnName().equals(shardingConditionValue2.getColumnName());
+    }
+    
+    private boolean isSameLogicTable(final ShardingRule shardingRule, final ShardingConditionValue shardingValue1, final ShardingConditionValue shardingValue2) {
+        return shardingValue1.getTableName().equals(shardingValue2.getTableName()) || isBindingTable(shardingRule, shardingValue1, shardingValue2);
+    }
+    
+    private boolean isBindingTable(final ShardingRule shardingRule, final ShardingConditionValue shardingValue1, final ShardingConditionValue shardingValue2) {
+        Optional<BindingTableRule> bindingRule = shardingRule.findBindingTableRule(shardingValue1.getTableName());
+        return bindingRule.isPresent() && bindingRule.get().hasLogicTable(shardingValue2.getTableName());
+    }
+    
+    @SuppressWarnings({"rawtypes", "unchecked"})
+    private boolean isSameValue(final ShardingConditionValue shardingConditionValue1, final ShardingConditionValue shardingConditionValue2) {
+        if (shardingConditionValue1 instanceof ListShardingConditionValue && shardingConditionValue2 instanceof ListShardingConditionValue) {
+            return SafeNumberOperationUtils.safeCollectionEquals(
+                ((ListShardingConditionValue) shardingConditionValue1).getValues(), ((ListShardingConditionValue) shardingConditionValue2).getValues());
+        } else if (shardingConditionValue1 instanceof RangeShardingConditionValue && shardingConditionValue2 instanceof RangeShardingConditionValue) {
+            return SafeNumberOperationUtils.safeRangeEquals(
+                ((RangeShardingConditionValue) shardingConditionValue1).getValueRange(), ((RangeShardingConditionValue) shardingConditionValue2).getValueRange());
+        }
+        return false;
+    }
+    
+    private ShardingConditions createShardingConditions(final SQLStatementContext<SelectStatement> sqlStatementContext,
+        final List<Object> parameters, final ShardingSphereSchema schema, final ShardingRule rule) {
+        List<ShardingCondition> shardingConditions;
+        if (sqlStatementContext.getSqlStatement() instanceof DMLStatement) {
+            ShardingConditionEngine shardingConditionEngine = new WhereClauseShardingConditionEngine(rule, schema);
+            shardingConditions = shardingConditionEngine.createShardingConditions(sqlStatementContext, parameters);
+        } else {
+            shardingConditions = Collections.emptyList();
+        }
+        return new ShardingConditions(shardingConditions);
+    }
+    
+    @Override
+    public void postValidate(final SelectStatement sqlStatement, final RouteContext routeContext) {
+    }
+    

Review comment:
       OK




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



[GitHub] [shardingsphere] codecov-io commented on pull request #8310: feature: add subquery valid in ShardingInsertStatementValidator and ShardingSelectStatementValidator

Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #8310:
URL: https://github.com/apache/shardingsphere/pull/8310#issuecomment-734044973


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8310?src=pr&el=h1) Report
   > Merging [#8310](https://codecov.io/gh/apache/shardingsphere/pull/8310?src=pr&el=desc) (e0d71de) into [master](https://codecov.io/gh/apache/shardingsphere/commit/5687ee847b30511b2b8269e29f6a96a051fa5827?el=desc) (5687ee8) will **decrease** coverage by `1.52%`.
   > The diff coverage is `29.70%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/8310/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so)](https://codecov.io/gh/apache/shardingsphere/pull/8310?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #8310      +/-   ##
   ============================================
   - Coverage     74.73%   73.21%   -1.53%     
   - Complexity      600      626      +26     
   ============================================
     Files          1483     1502      +19     
     Lines         23431    24065     +634     
     Branches       4174     4287     +113     
   ============================================
   + Hits          17512    17619     +107     
   - Misses         4768     5265     +497     
   - Partials       1151     1181      +30     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/8310?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...tor/dml/impl/ShardingInsertStatementValidator.java](https://codecov.io/gh/apache/shardingsphere/pull/8310/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctcm91dGUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NoYXJkaW5nL3JvdXRlL2VuZ2luZS92YWxpZGF0b3IvZG1sL2ltcGwvU2hhcmRpbmdJbnNlcnRTdGF0ZW1lbnRWYWxpZGF0b3IuamF2YQ==) | `31.08% <0.00%> (-60.92%)` | `0.00 <0.00> (ø)` | |
   | [...e/validator/ShardingStatementValidatorFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/8310/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctcm91dGUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NoYXJkaW5nL3JvdXRlL2VuZ2luZS92YWxpZGF0b3IvU2hhcmRpbmdTdGF0ZW1lbnRWYWxpZGF0b3JGYWN0b3J5LmphdmE=) | `16.00% <50.00%> (-1.40%)` | `0.00 <0.00> (ø)` | |
   | [...tor/dml/impl/ShardingSelectStatementValidator.java](https://codecov.io/gh/apache/shardingsphere/pull/8310/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctcm91dGUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NoYXJkaW5nL3JvdXRlL2VuZ2luZS92YWxpZGF0b3IvZG1sL2ltcGwvU2hhcmRpbmdTZWxlY3RTdGF0ZW1lbnRWYWxpZGF0b3IuamF2YQ==) | `58.00% <58.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...l/prepare/driver/DriverExecutionPrepareEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/8310/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtZXhlY3V0b3Ivc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2luZnJhL2V4ZWN1dG9yL3NxbC9wcmVwYXJlL2RyaXZlci9Ecml2ZXJFeGVjdXRpb25QcmVwYXJlRW5naW5lLmphdmE=) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (-1.00%)` | |
   | [...a/spring/namespace/handler/HANamespaceHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/8310/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtaGEvc2hhcmRpbmdzcGhlcmUtaGEtc3ByaW5nL3NoYXJkaW5nc3BoZXJlLWhhLXNwcmluZy1uYW1lc3BhY2Uvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2hhL3NwcmluZy9uYW1lc3BhY2UvaGFuZGxlci9IQU5hbWVzcGFjZUhhbmRsZXIuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (-1.00%)` | |
   | [...g/namespace/parser/HARuleBeanDefinitionParser.java](https://codecov.io/gh/apache/shardingsphere/pull/8310/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtaGEvc2hhcmRpbmdzcGhlcmUtaGEtc3ByaW5nL3NoYXJkaW5nc3BoZXJlLWhhLXNwcmluZy1uYW1lc3BhY2Uvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2hhL3NwcmluZy9uYW1lc3BhY2UvcGFyc2VyL0hBUnVsZUJlYW5EZWZpbml0aW9uUGFyc2VyLmphdmE=) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (-1.00%)` | |
   | [...rybean/ReplicaLoadBalanceAlgorithmFactoryBean.java](https://codecov.io/gh/apache/shardingsphere/pull/8310/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtaGEvc2hhcmRpbmdzcGhlcmUtaGEtc3ByaW5nL3NoYXJkaW5nc3BoZXJlLWhhLXNwcmluZy1uYW1lc3BhY2Uvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2hhL3NwcmluZy9uYW1lc3BhY2UvZmFjdG9yeWJlYW4vUmVwbGljYUxvYWRCYWxhbmNlQWxnb3JpdGhtRmFjdG9yeUJlYW4uamF2YQ==) | `0.00% <0.00%> (-100.00%)` | `0.00% <0.00%> (ø%)` | |
   | [...or/sql/prepare/AbstractExecutionPrepareEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/8310/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtZXhlY3V0b3Ivc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2luZnJhL2V4ZWN1dG9yL3NxbC9wcmVwYXJlL0Fic3RyYWN0RXhlY3V0aW9uUHJlcGFyZUVuZ2luZS5qYXZh) | `0.00% <0.00%> (-89.66%)` | `0.00% <0.00%> (ø%)` | |
   | [...cutor/sql/prepare/driver/jdbc/StatementOption.java](https://codecov.io/gh/apache/shardingsphere/pull/8310/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtZXhlY3V0b3Ivc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2luZnJhL2V4ZWN1dG9yL3NxbC9wcmVwYXJlL2RyaXZlci9qZGJjL1N0YXRlbWVudE9wdGlvbi5qYXZh) | `0.00% <0.00%> (-50.00%)` | `0.00% <0.00%> (ø%)` | |
   | [...java/org/apache/shardingsphere/ha/rule/HARule.java](https://codecov.io/gh/apache/shardingsphere/pull/8310/diff?src=pr&el=tree#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtaGEvc2hhcmRpbmdzcGhlcmUtaGEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9oYS9ydWxlL0hBUnVsZS5qYXZh) | `54.54% <0.00%> (-31.57%)` | `0.00% <0.00%> (ø%)` | |
   | ... and [83 more](https://codecov.io/gh/apache/shardingsphere/pull/8310/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8310?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/8310?src=pr&el=footer). Last update [5687ee8...e0d71de](https://codecov.io/gh/apache/shardingsphere/pull/8310?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


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



[GitHub] [shardingsphere] wgy8283335 edited a comment on pull request #8310: feature: add subquery valid in ShardingInsertStatementValidator and ShardingSelectStatementValidator

Posted by GitBox <gi...@apache.org>.
wgy8283335 edited a comment on pull request #8310:
URL: https://github.com/apache/shardingsphere/pull/8310#issuecomment-734046246


   > @wgy8283335 Can you solve the CI build exception first?
   
   @strongduanmu  I have fixed the bugs.


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