You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2022/07/15 08:35:43 UTC

[shardingsphere] branch master updated: Fixes #19113. (#19218)

This is an automated email from the ASF dual-hosted git repository.

duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 3886f2db389 Fixes #19113. (#19218)
3886f2db389 is described below

commit 3886f2db389dec53d7dd713c15798a203994c103
Author: Raigor <ra...@gmail.com>
AuthorDate: Fri Jul 15 16:35:34 2022 +0800

    Fixes #19113. (#19218)
---
 .../handler/checker/ShardingTableRuleStatementChecker.java  |  2 +-
 .../shardingsphere/infra/expr/InlineExpressionParser.java   | 10 ----------
 .../infra/expr/InlineExpressionParserTest.java              | 13 -------------
 3 files changed, 1 insertion(+), 24 deletions(-)

diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java
index 848f117ebff..8ecb3185519 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java
@@ -158,7 +158,7 @@ public final class ShardingTableRuleStatementChecker {
     }
     
     private static Collection<String> parseDateSource(final String dateSource) {
-        return InlineExpressionParser.isInlineExpression(dateSource) ? new InlineExpressionParser(dateSource).splitAndEvaluate() : Collections.singletonList(dateSource);
+        return new InlineExpressionParser(dateSource).splitAndEvaluate();
     }
     
     private static Collection<String> getDataSourceNames(final Collection<String> actualDataNodes) {
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/expr/InlineExpressionParser.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/expr/InlineExpressionParser.java
index f8bebaa2871..14a140e6691 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/expr/InlineExpressionParser.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/expr/InlineExpressionParser.java
@@ -49,16 +49,6 @@ public final class InlineExpressionParser {
     
     private final String inlineExpression;
     
-    /**
-     * Judge whether the expression is an inline expression.
-     *
-     * @param expression expression to be judged
-     * @return whether the expression is an inline expression
-     */
-    public static boolean isInlineExpression(final String expression) {
-        return expression.contains("${") || expression.contains("$->{");
-    }
-    
     /**
      * Replace all inline expression placeholders.
      * 
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/expr/InlineExpressionParserTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/expr/InlineExpressionParserTest.java
index 401cda22088..d6211a82803 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/expr/InlineExpressionParserTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/expr/InlineExpressionParserTest.java
@@ -24,9 +24,7 @@ import java.util.List;
 
 import static org.hamcrest.CoreMatchers.hasItems;
 import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
 
 public final class InlineExpressionParserTest {
     
@@ -109,17 +107,6 @@ public final class InlineExpressionParserTest {
         assertThat(expected, hasItems("ds_0.t_user_0", "ds_15.t_user_1023"));
     }
     
-    @Test
-    public void assertValidInlineExpression() {
-        assertTrue(InlineExpressionParser.isInlineExpression("t_$->{\"new_order1\"}"));
-        assertTrue(InlineExpressionParser.isInlineExpression("t_${\"new_order2\"}"));
-    }
-    
-    @Test
-    public void assertInValidInLineExpression() {
-        assertFalse(InlineExpressionParser.isInlineExpression("t_>{\"new_order1\"}"));
-    }
-    
     @Test
     public void assertHandlePlaceHolder() {
         assertThat(InlineExpressionParser.handlePlaceHolder("t_$->{[\"new$->{1+2}\"]}"), is("t_${[\"new${1+2}\"]}"));