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 2021/09/09 11:07:04 UTC

[GitHub] [shardingsphere] soulasuna opened a new pull request #12316: Update statement route

soulasuna opened a new pull request #12316:
URL: https://github.com/apache/shardingsphere/pull/12316


   ## Add update statement route.
   For  #11661.
   
   Changes proposed in this pull request:
   - Add update case example.
   - Refactor shadow determiner.
   - Refactor abstract shadow route engine.
   - Add shadow update statement routing engine.
   - Fix shadow rule configuration yaml swapper.
   - Fix shadow ut.
   


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



[GitHub] [shardingsphere] codecov-commenter commented on pull request #12316: Update statement route

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


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/12316?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#12316](https://codecov.io/gh/apache/shardingsphere/pull/12316?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (30f7807) into [master](https://codecov.io/gh/apache/shardingsphere/commit/e5b1ba301c96578e994d2c2a11b15af2dc1b8d94?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e5b1ba3) will **decrease** coverage by `0.08%`.
   > The diff coverage is `29.41%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/12316/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/shardingsphere/pull/12316?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #12316      +/-   ##
   ============================================
   - Coverage     63.73%   63.64%   -0.09%     
   - Complexity     1260     1273      +13     
   ============================================
     Files          2351     2364      +13     
     Lines         35754    35963     +209     
     Branches       6211     6253      +42     
   ============================================
   + Hits          22787    22889     +102     
   - Misses        11142    11220      +78     
   - Partials       1825     1854      +29     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/12316?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...e/shardingsphere/shadow/route/ShadowSQLRouter.java](https://codecov.io/gh/apache/shardingsphere/pull/12316/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFkb3cvcm91dGUvU2hhZG93U1FMUm91dGVyLmphdmE=) | `88.88% <0.00%> (+7.25%)` | :arrow_up: |
   | [...ure/engine/determiner/ShadowDeterminerFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/12316/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFkb3cvcm91dGUvZnV0dXJlL2VuZ2luZS9kZXRlcm1pbmVyL1NoYWRvd0RldGVybWluZXJGYWN0b3J5LmphdmE=) | `50.00% <ø> (-12.50%)` | :arrow_down: |
   | [...miner/algorithm/NoteShadowAlgorithmDeterminer.java](https://codecov.io/gh/apache/shardingsphere/pull/12316/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFkb3cvcm91dGUvZnV0dXJlL2VuZ2luZS9kZXRlcm1pbmVyL2FsZ29yaXRobS9Ob3RlU2hhZG93QWxnb3JpdGhtRGV0ZXJtaW5lci5qYXZh) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...engine/dml/ShadowDeleteStatementRoutingEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/12316/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFkb3cvcm91dGUvZnV0dXJlL2VuZ2luZS9kbWwvU2hhZG93RGVsZXRlU3RhdGVtZW50Um91dGluZ0VuZ2luZS5qYXZh) | `0.00% <ø> (ø)` | |
   | [...engine/dml/ShadowSelectStatementRoutingEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/12316/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFkb3cvcm91dGUvZnV0dXJlL2VuZ2luZS9kbWwvU2hhZG93U2VsZWN0U3RhdGVtZW50Um91dGluZ0VuZ2luZS5qYXZh) | `0.00% <ø> (ø)` | |
   | [...engine/dml/ShadowUpdateStatementRoutingEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/12316/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFkb3cvcm91dGUvZnV0dXJlL2VuZ2luZS9kbWwvU2hhZG93VXBkYXRlU3RhdGVtZW50Um91dGluZ0VuZ2luZS5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...ngine/impl/ShadowNonMDLStatementRoutingEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/12316/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFkb3cvcm91dGUvZnV0dXJlL2VuZ2luZS9pbXBsL1NoYWRvd05vbk1ETFN0YXRlbWVudFJvdXRpbmdFbmdpbmUuamF2YQ==) | `0.00% <ø> (ø)` | |
   | [...adow/route/future/engine/util/ShadowExtractor.java](https://codecov.io/gh/apache/shardingsphere/pull/12316/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFkb3cvcm91dGUvZnV0dXJlL2VuZ2luZS91dGlsL1NoYWRvd0V4dHJhY3Rvci5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...ner/algorithm/ColumnShadowAlgorithmDeterminer.java](https://codecov.io/gh/apache/shardingsphere/pull/12316/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFkb3cvcm91dGUvZnV0dXJlL2VuZ2luZS9kZXRlcm1pbmVyL2FsZ29yaXRobS9Db2x1bW5TaGFkb3dBbGdvcml0aG1EZXRlcm1pbmVyLmphdmE=) | `58.82% <25.00%> (-31.18%)` | :arrow_down: |
   | [...route/future/engine/AbstractShadowRouteEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/12316/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFkb3cvcm91dGUvZnV0dXJlL2VuZ2luZS9BYnN0cmFjdFNoYWRvd1JvdXRlRW5naW5lLmphdmE=) | `35.71% <41.17%> (-55.96%)` | :arrow_down: |
   | ... and [98 more](https://codecov.io/gh/apache/shardingsphere/pull/12316/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/12316?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/12316?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [e5b1ba3...30f7807](https://codecov.io/gh/apache/shardingsphere/pull/12316?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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



[GitHub] [shardingsphere] tristaZero commented on a change in pull request #12316: Update statement route

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



##########
File path: shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/route/future/engine/util/ShadowExtractor.java
##########
@@ -0,0 +1,129 @@
+/*
+ * 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.shadow.route.future.engine.util;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.column.ColumnSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.BinaryOperationExpression;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ExpressionSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.InExpression;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ListExpression;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.simple.LiteralExpressionSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.simple.ParameterMarkerExpressionSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.simple.SimpleExpressionSegment;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * Shadow extractor.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class ShadowExtractor {
+    
+    /**
+     * Get left value binary operation Expression if left value expression is column segment.
+     *
+     * @param expression binary operation expression
+     * @return column name
+     */
+    public static Optional<String> extractColumnName(final BinaryOperationExpression expression) {

Review comment:
       @strongduanmu Please look at this coding, do you think we can get all necessary info from `statementContext`




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



[GitHub] [shardingsphere] strongduanmu commented on a change in pull request #12316: Update statement route

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



##########
File path: shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/route/future/engine/dml/ShadowUpdateStatementRoutingEngine.java
##########
@@ -17,20 +17,89 @@
 
 package org.apache.shardingsphere.shadow.route.future.engine.dml;
 
-import org.apache.shardingsphere.infra.binder.LogicSQL;
-import org.apache.shardingsphere.infra.config.properties.ConfigurationProperties;
-import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
-import org.apache.shardingsphere.infra.route.context.RouteContext;
-import org.apache.shardingsphere.shadow.route.future.engine.ShadowRouteEngine;
-import org.apache.shardingsphere.shadow.rule.ShadowRule;
+import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.infra.binder.statement.dml.UpdateStatementContext;
+import org.apache.shardingsphere.shadow.api.shadow.column.ShadowOperationType;
+import org.apache.shardingsphere.shadow.route.future.engine.AbstractShadowRouteEngine;
+import org.apache.shardingsphere.shadow.route.future.engine.determiner.ShadowDetermineCondition;
+import org.apache.shardingsphere.shadow.route.future.engine.util.ShadowExtractor;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.BinaryOperationExpression;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ExpressionSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.InExpression;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.predicate.WhereSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.util.ExpressionExtractUtil;
+
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
 
 /**
  * Shadow update statement routing engine.
  */
-public final class ShadowUpdateStatementRoutingEngine implements ShadowRouteEngine {
+@RequiredArgsConstructor
+public final class ShadowUpdateStatementRoutingEngine extends AbstractShadowRouteEngine {
+    
+    private final UpdateStatementContext updateStatementContext;
+    
+    private final List<Object> parameters;
+    
+    @Override
+    protected Optional<Map<String, Collection<Comparable<?>>>> parseColumnValuesMappings() {
+        Map<String, Collection<Comparable<?>>> result = new LinkedHashMap<>();
+        Optional<WhereSegment> where = updateStatementContext.getWhere();
+        where.ifPresent(whereSegment -> parseWhereSegment(whereSegment, result));
+        return result.isEmpty() ? Optional.empty() : Optional.of(result);
+    }
+    
+    private void parseWhereSegment(final WhereSegment whereSegment, final Map<String, Collection<Comparable<?>>> columnValuesMappings) {
+        ExpressionExtractUtil.getAndPredicates(whereSegment.getExpr()).forEach(each -> parseAndPredicate(each.getPredicates(), columnValuesMappings));
+    }
+    
+    private void parseAndPredicate(final Collection<ExpressionSegment> predicates, final Map<String, Collection<Comparable<?>>> columnValuesMappings) {
+        for (ExpressionSegment each : predicates) {
+            parseExpressionSegment(each, columnValuesMappings);
+        }
+    }
+    
+    private void parseExpressionSegment(final ExpressionSegment expressionSegment, final Map<String, Collection<Comparable<?>>> columnValuesMappings) {
+        if (expressionSegment instanceof BinaryOperationExpression) {
+            parseBinaryOperationExpression((BinaryOperationExpression) expressionSegment, columnValuesMappings);
+        }
+        if (expressionSegment instanceof InExpression) {
+            parseInExpression((InExpression) expressionSegment, columnValuesMappings);
+        }
+    }
+    
+    private void parseInExpression(final InExpression expression, final Map<String, Collection<Comparable<?>>> columnValuesMappings) {
+        Optional<String> columnName = ShadowExtractor.extractColumnName(expression);
+        columnName.ifPresent(s -> ShadowExtractor.extractValues(expression.getRight(), parameters).ifPresent(values -> columnValuesMappings.put(s, values)));
+    }
+    
+    private void parseBinaryOperationExpression(final BinaryOperationExpression expression, final Map<String, Collection<Comparable<?>>> columnValuesMappings) {
+        Optional<String> columnName = ShadowExtractor.extractColumnName(expression);
+        columnName.ifPresent(s -> ShadowExtractor.extractValues(expression.getRight(), parameters).ifPresent(values -> columnValuesMappings.put(s, values)));
+    }
+    
+    @Override
+    protected ShadowDetermineCondition createShadowDetermineCondition() {

Review comment:
       @soulasuna Why not consider extracting a ShadowConditionEngine to handle these logics like ShardingConditionEngine?




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



[GitHub] [shardingsphere] strongduanmu commented on a change in pull request #12316: Update statement route

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



##########
File path: shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/route/future/engine/util/ShadowExtractor.java
##########
@@ -0,0 +1,129 @@
+/*
+ * 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.shadow.route.future.engine.util;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.column.ColumnSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.BinaryOperationExpression;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ExpressionSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.InExpression;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ListExpression;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.simple.LiteralExpressionSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.simple.ParameterMarkerExpressionSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.simple.SimpleExpressionSegment;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * Shadow extractor.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class ShadowExtractor {
+    
+    /**
+     * Get left value binary operation Expression if left value expression is column segment.
+     *
+     * @param expression binary operation expression
+     * @return column name
+     */
+    public static Optional<String> extractColumnName(final BinaryOperationExpression expression) {

Review comment:
       > @strongduanmu Please look at this coding, do you think we can get all necessary info from `statementContext`
   
   @tristaZero We already have a tool to extract columns based on expression, and we can use ColumnExtractor to replace this logic.




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



[GitHub] [shardingsphere] strongduanmu merged pull request #12316: Update statement route

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


   


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