From a164726cb753fd6ae74c4e339d4401f6895c7c50 Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Sun, 24 Sep 2023 13:32:42 +0800 Subject: [PATCH] Rename PureListInlineExpressionParser to LiteralInlineExpressionParser (#28562) --- docs/document/content/dev-manual/sharding.cn.md | 8 ++++---- docs/document/content/dev-manual/sharding.en.md | 8 ++++---- .../common-config/builtin-algorithm/expr.cn.md | 4 ++-- .../common-config/builtin-algorithm/expr.en.md | 4 ++-- .../startup/graalvm-native-image.cn.md | 4 ++-- .../startup/graalvm-native-image.en.md | 6 +++--- infra/expr/core/pom.xml | 2 +- .../core/InlineExpressionParserFactoryTest.java | 4 ++-- infra/expr/type/{purelist => literal}/pom.xml | 2 +- .../literal/LiteralInlineExpressionParser.java} | 8 ++++---- ...gsphere.infra.expr.spi.InlineExpressionParser | 2 +- .../LiteralInlineExpressionParserTest.java} | 16 ++++++++-------- infra/expr/type/pom.xml | 2 +- 13 files changed, 35 insertions(+), 35 deletions(-) rename infra/expr/type/{purelist => literal}/pom.xml (96%) rename infra/expr/type/{purelist/src/main/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParser.java => literal/src/main/java/org/apache/shardingsphere/infra/expr/literal/LiteralInlineExpressionParser.java} (91%) rename infra/expr/type/{purelist => literal}/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser (91%) rename infra/expr/type/{purelist/src/test/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParserTest.java => literal/src/test/java/org/apache/shardingsphere/infra/expr/literal/LiteralInlineExpressionParserTest.java} (88%) diff --git a/docs/document/content/dev-manual/sharding.cn.md b/docs/document/content/dev-manual/sharding.cn.md index e419ccafd2b21..4458ff94ee3d0 100644 --- a/docs/document/content/dev-manual/sharding.cn.md +++ b/docs/document/content/dev-manual/sharding.cn.md @@ -92,7 +92,7 @@ chapter = true ### 已知实现 -| *配置标识* | *详细说明* | *全限定类名* | -|----------|-------------------|--------------------------------------------------------------------------------| -| GROOVY | 使用 Groovy 语法的行表达式 | `org.apache.shardingsphere.infra.expr.groovy.GroovyInlineExpressionParser` | -| PURELIST | 使用标准列表的行表达式 | `org.apache.shardingsphere.infra.expr.purelist.PureListInlineExpressionParser` | +| *配置标识* | *详细说明* | *全限定类名* | +|---------|-------------------|------------------------------------------------------------------------------| +| GROOVY | 使用 Groovy 语法的行表达式 | `org.apache.shardingsphere.infra.expr.groovy.GroovyInlineExpressionParser` | +| LITERAL | 使用标准列表的行表达式 | `org.apache.shardingsphere.infra.expr.literal.LiteralInlineExpressionParser` | diff --git a/docs/document/content/dev-manual/sharding.en.md b/docs/document/content/dev-manual/sharding.en.md index 0463e27c40cad..6721258529ae6 100644 --- a/docs/document/content/dev-manual/sharding.en.md +++ b/docs/document/content/dev-manual/sharding.en.md @@ -92,7 +92,7 @@ Row Value Expressions definition ### Implementation classes -| *Configuration Type* | *Description* | *Fully-qualified class name* | -|----------------------|---------------------------------------------------|--------------------------------------------------------------------------------| -| GROOVY | Row Value Expressions that uses the Groovy syntax | `org.apache.shardingsphere.infra.expr.groovy.GroovyInlineExpressionParser` | -| PURELIST | Row Value Expressions that uses a standard list | `org.apache.shardingsphere.infra.expr.purelist.PureListInlineExpressionParser` | +| *Configuration Type* | *Description* | *Fully-qualified class name* | +|----------------------|---------------------------------------------------|------------------------------------------------------------------------------| +| GROOVY | Row Value Expressions that uses the Groovy syntax | `org.apache.shardingsphere.infra.expr.groovy.GroovyInlineExpressionParser` | +| LITERAL | Row Value Expressions that uses a standard list | `org.apache.shardingsphere.infra.expr.literal.LiteralInlineExpressionParser` | diff --git a/docs/document/content/user-manual/common-config/builtin-algorithm/expr.cn.md b/docs/document/content/user-manual/common-config/builtin-algorithm/expr.cn.md index c55718e6b5711..2f67d5c1e95db 100644 --- a/docs/document/content/user-manual/common-config/builtin-algorithm/expr.cn.md +++ b/docs/document/content/user-manual/common-config/builtin-algorithm/expr.cn.md @@ -13,7 +13,7 @@ weight = 7 ## 使用标准列表的行表达式 -类型:PURELIST +类型:LITERAL 可配置属性: @@ -32,7 +32,7 @@ rules: - !SHARDING tables: t_order: - actualDataNodes: ds_0.t_order_0, ds_0.t_order_1, ds_1.t_order_0, ds_1.t_order_1 + actualDataNodes: ds_0.t_order_0, ds_0.t_order_1, ds_1.t_order_0, ds_1.t_order_1 tableStrategy: standard: shardingColumn: order_id diff --git a/docs/document/content/user-manual/common-config/builtin-algorithm/expr.en.md b/docs/document/content/user-manual/common-config/builtin-algorithm/expr.en.md index 216ce754d3943..5bd773d392e3f 100644 --- a/docs/document/content/user-manual/common-config/builtin-algorithm/expr.en.md +++ b/docs/document/content/user-manual/common-config/builtin-algorithm/expr.en.md @@ -13,7 +13,7 @@ None ## Row Value Expressions that uses a standard list -Type: PURELIST +Type: LITERAL Attributes: @@ -34,7 +34,7 @@ rules: - !SHARDING tables: t_order: - actualDataNodes: ds_0.t_order_0, ds_0.t_order_1, ds_1.t_order_0, ds_1.t_order_1 + actualDataNodes: ds_0.t_order_0, ds_0.t_order_1, ds_1.t_order_0, ds_1.t_order_1 tableStrategy: standard: shardingColumn: order_id diff --git a/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.cn.md b/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.cn.md index 501f9f99d00eb..d8e8486109d56 100644 --- a/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.cn.md +++ b/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.cn.md @@ -39,8 +39,8 @@ services: - 当前阶段,GraalVM Native Image 形态的 ShardingSphere Proxy 不支持使用 `InlineExpressionParser` SPI 的默认实现的 `行表达式`, 这首先导致 `数据分片` 功能的`actualDataNodes` 属性只能使用其他 `InlineExpressionParser` SPI 的实现来配置, 例如使用 - `InlineExpressionParser` SPI 实现为 `PURELIST` 的 `行表达式`, 即 `ds_0.t_order_0, ds_0.t_order_1` - 或 `ds_0.t_user_0, ds_15.t_user_1023`。 + `InlineExpressionParser` SPI 实现为 `LITERAL` 的 `行表达式`, 即 `ds_0.t_order_0, ds_0.t_order_1` + 或 `ds_0.t_user_0, ds_15.t_user_1023`。 - 本节假定处于 Linux(amd64,aarch64), MacOS(amd64)或 Windows(amd64)环境。 如果你位于 MacOS(aarch64/M1) 环境,你需要关注尚未关闭的 https://github.com/oracle/graal/issues/2666 。 diff --git a/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.en.md b/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.en.md index fe0d38acfa86c..12ffccfa253bd 100644 --- a/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.en.md +++ b/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.en.md @@ -45,9 +45,9 @@ services: - At this stage, ShardingSphere Proxy in the form of GraalVM Native Image does not support `row expressions` using the default implementation of the `InlineExpressionParser` SPI. This first results in the `actualDataNodes` property of the `data sharding` feature that can only be configured using - other implementations of the `InlineExpressionParser` SPI, for example using `PURELIST` implemented - `InlineExpressionParser` SPI for `row expression`, i.e. `ds_0.t_order_0, ds_0.t_order_1` - or `ds_0.t_user_0, ds_15.t_user_1023`. + other implementations of the `InlineExpressionParser` SPI, for example using `LITERAL` implemented + `InlineExpressionParser` SPI for `row expression`, i.e. `ds_0.t_order_0, ds_0.t_order_1` + or `ds_0.t_user_0, ds_15.t_user_1023`. - This section assumes a Linux (amd64, aarch64), MacOS (amd64) or Windows (amd64) environment. If you are on MacOS (aarch64/M1) environment, you need to follow https://github.com/oracle/graal/issues/2666 which is diff --git a/infra/expr/core/pom.xml b/infra/expr/core/pom.xml index a5fafdeba9e86..dc998ba856034 100644 --- a/infra/expr/core/pom.xml +++ b/infra/expr/core/pom.xml @@ -39,7 +39,7 @@ org.apache.shardingsphere - shardingsphere-infra-expr-purelist + shardingsphere-infra-expr-literal ${project.version} diff --git a/infra/expr/core/src/test/java/org/apache/shardingsphere/infra/expr/core/InlineExpressionParserFactoryTest.java b/infra/expr/core/src/test/java/org/apache/shardingsphere/infra/expr/core/InlineExpressionParserFactoryTest.java index 4ade13127fe0e..88b96845095b0 100644 --- a/infra/expr/core/src/test/java/org/apache/shardingsphere/infra/expr/core/InlineExpressionParserFactoryTest.java +++ b/infra/expr/core/src/test/java/org/apache/shardingsphere/infra/expr/core/InlineExpressionParserFactoryTest.java @@ -36,8 +36,8 @@ void assertNewInstance() { assertThat(InlineExpressionParserFactory.newInstance("t_order_0, t_order_1").handlePlaceHolder(), is("t_order_0, t_order_1")); assertThat(InlineExpressionParserFactory.newInstance("t_order_0, t_order_1").getType(), is("GROOVY")); assertThat(InlineExpressionParserFactory.newInstance("t_order_0, t_order_1").handlePlaceHolder(), is("t_order_0, t_order_1")); - assertThat(InlineExpressionParserFactory.newInstance("t_order_0, t_order_1").getType(), is("PURELIST")); - assertThat(InlineExpressionParserFactory.newInstance("t_order_0, t_order_1").handlePlaceHolder(), is("t_order_0, t_order_1")); + assertThat(InlineExpressionParserFactory.newInstance("t_order_0, t_order_1").getType(), is("LITERAL")); + assertThat(InlineExpressionParserFactory.newInstance("t_order_0, t_order_1").handlePlaceHolder(), is("t_order_0, t_order_1")); } @Test diff --git a/infra/expr/type/purelist/pom.xml b/infra/expr/type/literal/pom.xml similarity index 96% rename from infra/expr/type/purelist/pom.xml rename to infra/expr/type/literal/pom.xml index 0ac0438b150c7..9505aab514521 100644 --- a/infra/expr/type/purelist/pom.xml +++ b/infra/expr/type/literal/pom.xml @@ -23,7 +23,7 @@ shardingsphere-infra-expr-type 5.4.1-SNAPSHOT - shardingsphere-infra-expr-purelist + shardingsphere-infra-expr-literal ${project.artifactId} diff --git a/infra/expr/type/purelist/src/main/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParser.java b/infra/expr/type/literal/src/main/java/org/apache/shardingsphere/infra/expr/literal/LiteralInlineExpressionParser.java similarity index 91% rename from infra/expr/type/purelist/src/main/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParser.java rename to infra/expr/type/literal/src/main/java/org/apache/shardingsphere/infra/expr/literal/LiteralInlineExpressionParser.java index f84e5a7fee13a..c286e2c8b87bb 100644 --- a/infra/expr/type/purelist/src/main/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParser.java +++ b/infra/expr/type/literal/src/main/java/org/apache/shardingsphere/infra/expr/literal/LiteralInlineExpressionParser.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.expr.purelist; +package org.apache.shardingsphere.infra.expr.literal; import com.google.common.base.Strings; import org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser; @@ -26,9 +26,9 @@ import java.util.Properties; /** - * Pure List inline expression parser. + * literal inline expression parser. */ -public final class PureListInlineExpressionParser implements InlineExpressionParser { +public final class LiteralInlineExpressionParser implements InlineExpressionParser { private static final char SPLITTER = ','; @@ -69,6 +69,6 @@ private List split(final String inlineExpression) { @Override public String getType() { - return "PURELIST"; + return "LITERAL"; } } diff --git a/infra/expr/type/purelist/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser b/infra/expr/type/literal/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser similarity index 91% rename from infra/expr/type/purelist/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser rename to infra/expr/type/literal/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser index 9f038f1b9fb55..92c32bf922df6 100644 --- a/infra/expr/type/purelist/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser +++ b/infra/expr/type/literal/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser @@ -15,4 +15,4 @@ # limitations under the License. # -org.apache.shardingsphere.infra.expr.purelist.PureListInlineExpressionParser +org.apache.shardingsphere.infra.expr.literal.LiteralInlineExpressionParser diff --git a/infra/expr/type/purelist/src/test/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParserTest.java b/infra/expr/type/literal/src/test/java/org/apache/shardingsphere/infra/expr/literal/LiteralInlineExpressionParserTest.java similarity index 88% rename from infra/expr/type/purelist/src/test/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParserTest.java rename to infra/expr/type/literal/src/test/java/org/apache/shardingsphere/infra/expr/literal/LiteralInlineExpressionParserTest.java index 2ddeacdd7b45f..75538527b1f2c 100644 --- a/infra/expr/type/purelist/src/test/java/org/apache/shardingsphere/infra/expr/purelist/PureListInlineExpressionParserTest.java +++ b/infra/expr/type/literal/src/test/java/org/apache/shardingsphere/infra/expr/literal/LiteralInlineExpressionParserTest.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.shardingsphere.infra.expr.purelist; +package org.apache.shardingsphere.infra.expr.literal; import org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser; import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; @@ -31,18 +31,18 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; -class PureListInlineExpressionParserTest { +class LiteralInlineExpressionParserTest { @Test void assertEvaluateForExpressionIsNull() { - InlineExpressionParser parser = TypedSPILoader.getService(InlineExpressionParser.class, "PURELIST", new Properties()); + InlineExpressionParser parser = TypedSPILoader.getService(InlineExpressionParser.class, "LITERAL", new Properties()); List expected = parser.splitAndEvaluate(); assertThat(expected, is(Collections.emptyList())); } @Test void assertEvaluateForSimpleString() { - List expected = TypedSPILoader.getService(InlineExpressionParser.class, "PURELIST", PropertiesBuilder.build( + List expected = TypedSPILoader.getService(InlineExpressionParser.class, "LITERAL", PropertiesBuilder.build( new PropertiesBuilder.Property(InlineExpressionParser.INLINE_EXPRESSION_KEY, " t_order_0, t_order_1 "))).splitAndEvaluate(); assertThat(expected.size(), is(2)); assertThat(expected, hasItems("t_order_0", "t_order_1")); @@ -60,7 +60,7 @@ void assertEvaluateForLong() { expression.append(","); } } - List expected = TypedSPILoader.getService(InlineExpressionParser.class, "PURELIST", PropertiesBuilder.build( + List expected = TypedSPILoader.getService(InlineExpressionParser.class, "LITERAL", PropertiesBuilder.build( new PropertiesBuilder.Property(InlineExpressionParser.INLINE_EXPRESSION_KEY, expression.toString()))).splitAndEvaluate(); assertThat(expected.size(), is(1024)); assertThat(expected, hasItems("ds_0.t_user_0", "ds_15.t_user_1023")); @@ -68,15 +68,15 @@ void assertEvaluateForLong() { @Test void assertHandlePlaceHolder() { - assertThat(TypedSPILoader.getService(InlineExpressionParser.class, "PURELIST", PropertiesBuilder.build( + assertThat(TypedSPILoader.getService(InlineExpressionParser.class, "LITERAL", PropertiesBuilder.build( new PropertiesBuilder.Property(InlineExpressionParser.INLINE_EXPRESSION_KEY, "t_$->{[\"new$->{1+2}\"]}"))).handlePlaceHolder(), is("t_$->{[\"new$->{1+2}\"]}")); - assertThat(TypedSPILoader.getService(InlineExpressionParser.class, "PURELIST", PropertiesBuilder.build( + assertThat(TypedSPILoader.getService(InlineExpressionParser.class, "LITERAL", PropertiesBuilder.build( new PropertiesBuilder.Property(InlineExpressionParser.INLINE_EXPRESSION_KEY, "t_${[\"new$->{1+2}\"]}"))).handlePlaceHolder(), is("t_${[\"new$->{1+2}\"]}")); } @Test void assertEvaluateClosure() { - assertThrows(UnsupportedOperationException.class, () -> TypedSPILoader.getService(InlineExpressionParser.class, "PURELIST", PropertiesBuilder.build( + assertThrows(UnsupportedOperationException.class, () -> TypedSPILoader.getService(InlineExpressionParser.class, "LITERAL", PropertiesBuilder.build( new PropertiesBuilder.Property(InlineExpressionParser.INLINE_EXPRESSION_KEY, "${1+2}"))).evaluateClosure().call().toString()); } } diff --git a/infra/expr/type/pom.xml b/infra/expr/type/pom.xml index 12131f0ae98db..8283b9eb8a811 100644 --- a/infra/expr/type/pom.xml +++ b/infra/expr/type/pom.xml @@ -29,7 +29,7 @@ groovy - purelist + literal espresso