You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2023/05/08 05:32:42 UTC
[shardingsphere] branch master updated: Re-design for ShardingSphere groovy expr (#25509)
This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 46135bb95e7 Re-design for ShardingSphere groovy expr (#25509)
46135bb95e7 is described below
commit 46135bb95e7929f41f1e39f21f1f0c0b724bc2f8
Author: Ling Hengqian <li...@outlook.com>
AuthorDate: Mon May 8 13:32:35 2023 +0800
Re-design for ShardingSphere groovy expr (#25509)
* Re-design for ShardingSphere groovy expr
* Delay the initialization of the Truffle Context class instance in the EspressoInlineExpressionParser
---
features/readwrite-splitting/core/pom.xml | 5 ++
...ReadwriteSplittingRuleConfigurationChecker.java | 2 +-
.../rule/ReadwriteSplittingRule.java | 2 +-
features/sharding/core/pom.xml | 5 ++
.../complex/ComplexInlineShardingAlgorithm.java | 2 +-
.../sharding/hint/HintInlineShardingAlgorithm.java | 2 +-
.../sharding/inline/InlineShardingAlgorithm.java | 2 +-
.../shardingsphere/sharding/rule/ShardingRule.java | 2 +-
.../shardingsphere/sharding/rule/TableRule.java | 2 +-
.../checker/ShardingTableRuleStatementChecker.java | 2 +-
.../sharding/CoreHintShardingAlgorithmFixture.java | 2 +-
infra/{util-groovy => expr/core}/pom.xml | 21 ++++-
.../infra/expr/core}/InlineExpressionParser.java | 16 ++--
.../expr/core}/InlineExpressionParserTest.java | 2 +-
infra/expr/espresso/pom.xml | 100 +++++++++++++++++++++
.../espresso}/EspressoInlineExpressionParser.java | 51 +++++++----
...sphere.infra.expr.spi.JVMInlineExpressionParser | 18 ++++
.../EspressoInlineExpressionParserTest.java} | 32 +++----
infra/{util-groovy => expr/hotsopt}/pom.xml | 11 ++-
.../hotsopt}/HotspotInlineExpressionParser.java | 13 ++-
...sphere.infra.expr.spi.JVMInlineExpressionParser | 18 ++++
.../HotspotInlineExpressionParserTest.java | 2 +-
infra/{util-groovy => expr}/pom.xml | 17 ++--
infra/{util-groovy => expr/spi}/pom.xml | 11 ++-
.../infra/expr/spi}/JVMInlineExpressionParser.java | 5 +-
infra/pom.xml | 2 +-
.../ShardingRuleConfigurationImportChecker.java | 2 +-
.../test/e2e/cases/dataset/DataSet.java | 2 +-
.../engine/composer/BatchE2EContainerComposer.java | 2 +-
.../test/e2e/engine/type/DDLE2EIT.java | 2 +-
.../test/e2e/engine/type/dml/BaseDMLE2EIT.java | 2 +-
.../test/e2e/env/DataSetEnvironmentManager.java | 2 +-
32 files changed, 283 insertions(+), 76 deletions(-)
diff --git a/features/readwrite-splitting/core/pom.xml b/features/readwrite-splitting/core/pom.xml
index 6e006029df0..32350f66335 100644
--- a/features/readwrite-splitting/core/pom.xml
+++ b/features/readwrite-splitting/core/pom.xml
@@ -49,6 +49,11 @@
<artifactId>shardingsphere-transaction-core</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-expr-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
diff --git a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationChecker.java b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationChecker.java
index 9379bd697ef..4f4c9fa5862 100644
--- a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationChecker.java
+++ b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationChecker.java
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChec
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.infra.rule.identifier.type.DataSourceContainedRule;
import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
-import org.apache.shardingsphere.infra.util.expr.InlineExpressionParser;
+import org.apache.shardingsphere.infra.expr.core.InlineExpressionParser;
import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.readwritesplitting.algorithm.loadbalance.WeightReadQueryLoadBalanceAlgorithm;
import org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration;
diff --git a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/ReadwriteSplittingRule.java b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/ReadwriteSplittingRule.java
index 88170f2b6a8..e89793f2403 100644
--- a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/ReadwriteSplittingRule.java
+++ b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/ReadwriteSplittingRule.java
@@ -33,7 +33,7 @@ import org.apache.shardingsphere.infra.rule.identifier.type.exportable.Exportabl
import org.apache.shardingsphere.infra.rule.identifier.type.exportable.constant.ExportableConstants;
import org.apache.shardingsphere.infra.rule.identifier.type.exportable.constant.ExportableItemConstants;
import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
-import org.apache.shardingsphere.infra.util.expr.InlineExpressionParser;
+import org.apache.shardingsphere.infra.expr.core.InlineExpressionParser;
import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.mode.event.storage.StorageNodeDataSourceChangedEvent;
import org.apache.shardingsphere.mode.event.storage.StorageNodeDataSourceDeletedEvent;
diff --git a/features/sharding/core/pom.xml b/features/sharding/core/pom.xml
index b3da9ef7dbd..8782870024c 100644
--- a/features/sharding/core/pom.xml
+++ b/features/sharding/core/pom.xml
@@ -84,6 +84,11 @@
<artifactId>shardingsphere-sharding-nanoid</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-expr-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/complex/ComplexInlineShardingAlgorithm.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/complex/ComplexInlineShardingAlgorithm.java
index 31daec4a48c..ee8a106aa58 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/complex/ComplexInlineShardingAlgorithm.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/complex/ComplexInlineShardingAlgorithm.java
@@ -21,7 +21,7 @@ import groovy.lang.Closure;
import groovy.util.Expando;
import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
import org.apache.shardingsphere.infra.util.exception.external.sql.type.generic.UnsupportedSQLOperationException;
-import org.apache.shardingsphere.infra.util.expr.InlineExpressionParser;
+import org.apache.shardingsphere.infra.expr.core.InlineExpressionParser;
import org.apache.shardingsphere.sharding.api.sharding.complex.ComplexKeysShardingAlgorithm;
import org.apache.shardingsphere.sharding.api.sharding.complex.ComplexKeysShardingValue;
import org.apache.shardingsphere.sharding.exception.algorithm.sharding.MismatchedComplexInlineShardingAlgorithmColumnAndValueSizeException;
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/hint/HintInlineShardingAlgorithm.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/hint/HintInlineShardingAlgorithm.java
index 0943cd340b6..08475dbbb29 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/hint/HintInlineShardingAlgorithm.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/hint/HintInlineShardingAlgorithm.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.sharding.algorithm.sharding.hint;
import groovy.lang.Closure;
import groovy.util.Expando;
import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
-import org.apache.shardingsphere.infra.util.expr.InlineExpressionParser;
+import org.apache.shardingsphere.infra.expr.core.InlineExpressionParser;
import org.apache.shardingsphere.sharding.api.sharding.hint.HintShardingAlgorithm;
import org.apache.shardingsphere.sharding.api.sharding.hint.HintShardingValue;
import org.apache.shardingsphere.sharding.exception.algorithm.sharding.ShardingAlgorithmInitializationException;
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/InlineShardingAlgorithm.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/InlineShardingAlgorithm.java
index e92265af5b0..b14198c93b1 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/InlineShardingAlgorithm.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/InlineShardingAlgorithm.java
@@ -22,7 +22,7 @@ import groovy.lang.MissingMethodException;
import groovy.util.Expando;
import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
import org.apache.shardingsphere.infra.util.exception.external.sql.type.generic.UnsupportedSQLOperationException;
-import org.apache.shardingsphere.infra.util.expr.InlineExpressionParser;
+import org.apache.shardingsphere.infra.expr.core.InlineExpressionParser;
import org.apache.shardingsphere.sharding.api.sharding.standard.PreciseShardingValue;
import org.apache.shardingsphere.sharding.api.sharding.standard.RangeShardingValue;
import org.apache.shardingsphere.sharding.api.sharding.standard.StandardShardingAlgorithm;
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
index d454f24a32c..9a4bf893502 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
@@ -33,7 +33,7 @@ import org.apache.shardingsphere.infra.rule.identifier.scope.DatabaseRule;
import org.apache.shardingsphere.infra.rule.identifier.type.DataNodeContainedRule;
import org.apache.shardingsphere.infra.rule.identifier.type.TableContainedRule;
import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
-import org.apache.shardingsphere.infra.util.expr.InlineExpressionParser;
+import org.apache.shardingsphere.infra.expr.core.InlineExpressionParser;
import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/TableRule.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/TableRule.java
index 4f8ca30d1f7..1c35ebc11ba 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/TableRule.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/TableRule.java
@@ -25,7 +25,7 @@ import org.apache.shardingsphere.infra.datanode.DataNode;
import org.apache.shardingsphere.infra.datanode.DataNodeInfo;
import org.apache.shardingsphere.infra.datanode.DataNodeUtils;
import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
-import org.apache.shardingsphere.infra.util.expr.InlineExpressionParser;
+import org.apache.shardingsphere.infra.expr.core.InlineExpressionParser;
import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.strategy.audit.ShardingAuditStrategyConfiguration;
diff --git a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java
index 9bd20ee40e6..0f0a72af4c1 100644
--- a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java
+++ b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java
@@ -32,7 +32,7 @@ import org.apache.shardingsphere.infra.datanode.DataNode;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.infra.rule.identifier.type.DataSourceContainedRule;
import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
-import org.apache.shardingsphere.infra.util.expr.InlineExpressionParser;
+import org.apache.shardingsphere.infra.expr.core.InlineExpressionParser;
import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/fixture/sharding/CoreHintShardingAlgorithmFixture.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/fixture/sharding/CoreHintShardingAlgorithmFixture.java
index 414858015b2..42efc968931 100644
--- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/fixture/sharding/CoreHintShardingAlgorithmFixture.java
+++ b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/fixture/sharding/CoreHintShardingAlgorithmFixture.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.sharding.distsql.fixture.sharding;
import com.google.common.base.Preconditions;
import groovy.lang.Closure;
import groovy.util.Expando;
-import org.apache.shardingsphere.infra.util.expr.InlineExpressionParser;
+import org.apache.shardingsphere.infra.expr.core.InlineExpressionParser;
import org.apache.shardingsphere.sharding.api.sharding.hint.HintShardingAlgorithm;
import org.apache.shardingsphere.sharding.api.sharding.hint.HintShardingValue;
diff --git a/infra/util-groovy/pom.xml b/infra/expr/core/pom.xml
similarity index 63%
copy from infra/util-groovy/pom.xml
copy to infra/expr/core/pom.xml
index 7a03e7deec2..b001d40e1ca 100644
--- a/infra/util-groovy/pom.xml
+++ b/infra/expr/core/pom.xml
@@ -21,13 +21,28 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-infra</artifactId>
+ <artifactId>shardingsphere-infra-expr</artifactId>
<version>5.3.3-SNAPSHOT</version>
</parent>
-
- <artifactId>shardingsphere-infra-util-groovy</artifactId>
+ <artifactId>shardingsphere-infra-expr-core</artifactId>
+ <name>${project.artifactId}</name>
<dependencies>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-expr-spi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-expr-hotsopt</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-expr-espresso</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy</artifactId>
diff --git a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/expr/InlineExpressionParser.java b/infra/expr/core/src/main/java/org/apache/shardingsphere/infra/expr/core/InlineExpressionParser.java
similarity index 75%
rename from infra/util/src/main/java/org/apache/shardingsphere/infra/util/expr/InlineExpressionParser.java
rename to infra/expr/core/src/main/java/org/apache/shardingsphere/infra/expr/core/InlineExpressionParser.java
index 4d53d4791da..c731378ac2d 100644
--- a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/expr/InlineExpressionParser.java
+++ b/infra/expr/core/src/main/java/org/apache/shardingsphere/infra/expr/core/InlineExpressionParser.java
@@ -15,11 +15,11 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.util.expr;
+package org.apache.shardingsphere.infra.expr.core;
import groovy.lang.Closure;
-import org.apache.shardingsphere.infra.util.groovy.expr.HotspotInlineExpressionParser;
-import org.apache.shardingsphere.infra.util.groovy.expr.JVMInlineExpressionParser;
+import org.apache.shardingsphere.infra.expr.spi.JVMInlineExpressionParser;
+import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPILoader;
import java.util.List;
@@ -38,7 +38,11 @@ public final class InlineExpressionParser {
}
public InlineExpressionParser() {
- jvmInlineExpressionParser = IS_SUBSTRATE_VM ? new EspressoInlineExpressionParser() : new HotspotInlineExpressionParser();
+ if (IS_SUBSTRATE_VM) {
+ jvmInlineExpressionParser = TypedSPILoader.getService(JVMInlineExpressionParser.class, "ESPRESSO");
+ } else {
+ jvmInlineExpressionParser = TypedSPILoader.getService(JVMInlineExpressionParser.class, "HOTSPOT");
+ }
}
/**
@@ -49,9 +53,9 @@ public final class InlineExpressionParser {
*/
public String handlePlaceHolder(final String inlineExpression) {
if (IS_SUBSTRATE_VM) {
- return new EspressoInlineExpressionParser().handlePlaceHolder(inlineExpression);
+ return TypedSPILoader.getService(JVMInlineExpressionParser.class, "ESPRESSO").handlePlaceHolder(inlineExpression);
} else {
- return new HotspotInlineExpressionParser().handlePlaceHolder(inlineExpression);
+ return TypedSPILoader.getService(JVMInlineExpressionParser.class, "HOTSPOT").handlePlaceHolder(inlineExpression);
}
}
diff --git a/infra/util/src/test/java/org/apache/shardingsphere/infra/util/expr/InlineExpressionParserTest.java b/infra/expr/core/src/test/java/org/apache/shardingsphere/infra/expr/core/InlineExpressionParserTest.java
similarity index 99%
copy from infra/util/src/test/java/org/apache/shardingsphere/infra/util/expr/InlineExpressionParserTest.java
copy to infra/expr/core/src/test/java/org/apache/shardingsphere/infra/expr/core/InlineExpressionParserTest.java
index 0504d41d2e8..5f3c43945fa 100644
--- a/infra/util/src/test/java/org/apache/shardingsphere/infra/util/expr/InlineExpressionParserTest.java
+++ b/infra/expr/core/src/test/java/org/apache/shardingsphere/infra/expr/core/InlineExpressionParserTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.util.expr;
+package org.apache.shardingsphere.infra.expr.core;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledInNativeImage;
diff --git a/infra/expr/espresso/pom.xml b/infra/expr/espresso/pom.xml
new file mode 100644
index 00000000000..3a6401f6c99
--- /dev/null
+++ b/infra/expr/espresso/pom.xml
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-expr</artifactId>
+ <version>5.3.3-SNAPSHOT</version>
+ </parent>
+ <artifactId>shardingsphere-infra-expr-espresso</artifactId>
+ <name>${project.artifactId}</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-expr-spi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-util</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <!--Explicitly importing this dependency is only for changing the packaging order-->
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-expr-hotsopt</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.graalvm.truffle</groupId>
+ <artifactId>truffle-api</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>${maven-dependency-plugin.version}</version>
+ <executions>
+ <execution>
+ <id>copy</id>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <phase>prepare-package</phase>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-expr-hotsopt</artifactId>
+ <version>${project.version}</version>
+ <type>jar</type>
+ <overWrite>true</overWrite>
+ <destFileName>shardingsphere-infra-expr-hotsopt.jar</destFileName>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.groovy</groupId>
+ <artifactId>groovy</artifactId>
+ <version>${groovy.version}</version>
+ <type>jar</type>
+ <overWrite>true</overWrite>
+ <destFileName>groovy.jar</destFileName>
+ </artifactItem>
+ <artifactItem>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>${guava.version}</version>
+ <type>jar</type>
+ <overWrite>true</overWrite>
+ <destFileName>guava.jar</destFileName>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.outputDirectory}/espresso-need-libs</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/expr/EspressoInlineExpressionParser.java b/infra/expr/espresso/src/main/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParser.java
similarity index 59%
rename from infra/util/src/main/java/org/apache/shardingsphere/infra/util/expr/EspressoInlineExpressionParser.java
rename to infra/expr/espresso/src/main/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParser.java
index 65e93f4dd07..ea4914a4144 100644
--- a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/expr/EspressoInlineExpressionParser.java
+++ b/infra/expr/espresso/src/main/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParser.java
@@ -15,11 +15,11 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.util.expr;
+package org.apache.shardingsphere.infra.expr.espresso;
import groovy.lang.Closure;
+import org.apache.shardingsphere.infra.expr.spi.JVMInlineExpressionParser;
import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
-import org.apache.shardingsphere.infra.util.groovy.expr.JVMInlineExpressionParser;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.TypeLiteral;
import org.graalvm.polyglot.Value;
@@ -33,27 +33,27 @@ import java.util.Objects;
* Espresso inline expression parser.
*/
public final class EspressoInlineExpressionParser implements JVMInlineExpressionParser {
-
- private static final Context POLYGLOT;
-
+
+ private static final String JAVA_HOME;
+
+ private static final String JAVA_CLASSPATH;
+
static {
// TODO https://github.com/oracle/graal/issues/4555 not yet closed
- String javaHome = System.getenv("JAVA_HOME");
- ShardingSpherePreconditions.checkNotNull(javaHome, () -> new RuntimeException("Failed to determine the system's environment variable JAVA_HOME!"));
- URL resource = Objects.requireNonNull(Thread.currentThread().getContextClassLoader().getResource("espresso-need-libs"));
+ JAVA_HOME = System.getenv("JAVA_HOME");
+ ShardingSpherePreconditions.checkNotNull(JAVA_HOME, () -> new RuntimeException("Failed to determine the system's environment variable JAVA_HOME!"));
+ URL resource = Objects.requireNonNull(EspressoInlineExpressionParser.class.getClassLoader().getResource("espresso-need-libs"));
String dir = resource.getPath();
- String javaClasspath = String.join(":", dir + "/groovy.jar", dir + "/guava.jar", dir + "/shardingsphere-infra-util-groovy.jar");
- POLYGLOT = Context.newBuilder().allowAllAccess(true)
- .option("java.Properties.org.graalvm.home", javaHome)
- .option("java.MultiThreaded", Boolean.TRUE.toString())
- .option("java.Classpath", javaClasspath)
- .build();
+ JAVA_CLASSPATH = String.join(":", dir + "/groovy.jar", dir + "/guava.jar", dir + "/shardingsphere-infra-expr-hotsopt.jar");
}
@Override
public String handlePlaceHolder(final String inlineExpression) {
- return POLYGLOT.getBindings("java")
- .getMember("org.apache.shardingsphere.infra.util.expr.InlineExpressionParser").invokeMember("handlePlaceHolder", inlineExpression).asString();
+ try (Context context = getContext()) {
+ return context.getBindings("java")
+ .getMember("org.apache.shardingsphere.infra.expr.hotsopt.HotspotInlineExpressionParser")
+ .invokeMember("handlePlaceHolder", inlineExpression).asString();
+ }
}
@Override
@@ -69,7 +69,24 @@ public final class EspressoInlineExpressionParser implements JVMInlineExpression
return getInlineExpressionParser().invokeMember("evaluateClosure", inlineExpression).as(Closure.class);
}
+ @Override
+ public String getType() {
+ return "ESPRESSO";
+ }
+
private Value getInlineExpressionParser() {
- return POLYGLOT.getBindings("java").getMember("org.apache.shardingsphere.infra.util.expr.InlineExpressionParser").newInstance();
+ try (Context context = getContext()) {
+ return context.getBindings("java")
+ .getMember("org.apache.shardingsphere.infra.expr.hotsopt.HotspotInlineExpressionParser")
+ .newInstance();
+ }
+ }
+
+ private Context getContext() {
+ return Context.newBuilder().allowAllAccess(true)
+ .option("java.Properties.org.graalvm.home", JAVA_HOME)
+ .option("java.MultiThreaded", Boolean.TRUE.toString())
+ .option("java.Classpath", JAVA_CLASSPATH)
+ .build();
}
}
diff --git a/infra/expr/espresso/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.JVMInlineExpressionParser b/infra/expr/espresso/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.JVMInlineExpressionParser
new file mode 100644
index 00000000000..12e69c796a8
--- /dev/null
+++ b/infra/expr/espresso/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.JVMInlineExpressionParser
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+org.apache.shardingsphere.infra.expr.espresso.EspressoInlineExpressionParser
diff --git a/infra/util/src/test/java/org/apache/shardingsphere/infra/util/expr/InlineExpressionParserTest.java b/infra/expr/espresso/src/test/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParserTest.java
similarity index 68%
rename from infra/util/src/test/java/org/apache/shardingsphere/infra/util/expr/InlineExpressionParserTest.java
rename to infra/expr/espresso/src/test/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParserTest.java
index 0504d41d2e8..6cbaefd6040 100644
--- a/infra/util/src/test/java/org/apache/shardingsphere/infra/util/expr/InlineExpressionParserTest.java
+++ b/infra/expr/espresso/src/test/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParserTest.java
@@ -15,10 +15,11 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.util.expr;
+package org.apache.shardingsphere.infra.expr.espresso;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledInNativeImage;
+import org.junit.jupiter.api.condition.EnabledInNativeImage;
import java.util.Collections;
import java.util.List;
@@ -27,66 +28,67 @@ import static org.hamcrest.CoreMatchers.hasItems;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-class InlineExpressionParserTest {
+@EnabledInNativeImage
+class EspressoInlineExpressionParserTest {
@Test
void assertEvaluateForExpressionIsNull() {
- List<String> expected = new InlineExpressionParser().splitAndEvaluate(null);
+ List<String> expected = new EspressoInlineExpressionParser().splitAndEvaluate(null);
assertThat(expected, is(Collections.<String>emptyList()));
}
@Test
void assertEvaluateForSimpleString() {
- List<String> expected = new InlineExpressionParser().splitAndEvaluate(" t_order_0, t_order_1 ");
+ List<String> expected = new EspressoInlineExpressionParser().splitAndEvaluate(" t_order_0, t_order_1 ");
assertThat(expected.size(), is(2));
assertThat(expected, hasItems("t_order_0", "t_order_1"));
}
@Test
void assertEvaluateForNull() {
- List<String> expected = new InlineExpressionParser().splitAndEvaluate("t_order_${null}");
+ List<String> expected = new EspressoInlineExpressionParser().splitAndEvaluate("t_order_${null}");
assertThat(expected.size(), is(1));
assertThat(expected, hasItems("t_order_"));
}
@Test
void assertEvaluateForLiteral() {
- List<String> expected = new InlineExpressionParser().splitAndEvaluate("t_order_${'xx'}");
+ List<String> expected = new EspressoInlineExpressionParser().splitAndEvaluate("t_order_${'xx'}");
assertThat(expected.size(), is(1));
assertThat(expected, hasItems("t_order_xx"));
}
@Test
void assertEvaluateForArray() {
- List<String> expected = new InlineExpressionParser().splitAndEvaluate("t_order_${[0, 1, 2]},t_order_item_${[0, 2]}");
+ List<String> expected = new EspressoInlineExpressionParser().splitAndEvaluate("t_order_${[0, 1, 2]},t_order_item_${[0, 2]}");
assertThat(expected.size(), is(5));
assertThat(expected, hasItems("t_order_0", "t_order_1", "t_order_2", "t_order_item_0", "t_order_item_2"));
}
@Test
void assertEvaluateForRange() {
- List<String> expected = new InlineExpressionParser().splitAndEvaluate("t_order_${0..2},t_order_item_${0..1}");
+ List<String> expected = new EspressoInlineExpressionParser().splitAndEvaluate("t_order_${0..2},t_order_item_${0..1}");
assertThat(expected.size(), is(5));
assertThat(expected, hasItems("t_order_0", "t_order_1", "t_order_2", "t_order_item_0", "t_order_item_1"));
}
@Test
void assertEvaluateForComplex() {
- List<String> expected = new InlineExpressionParser().splitAndEvaluate("t_${['new','old']}_order_${1..2}, t_config");
+ List<String> expected = new EspressoInlineExpressionParser().splitAndEvaluate("t_${['new','old']}_order_${1..2}, t_config");
assertThat(expected.size(), is(5));
assertThat(expected, hasItems("t_new_order_1", "t_new_order_2", "t_old_order_1", "t_old_order_2", "t_config"));
}
@Test
void assertEvaluateForCalculate() {
- List<String> expected = new InlineExpressionParser().splitAndEvaluate("t_${[\"new${1+2}\",'old']}_order_${1..2}");
+ List<String> expected = new EspressoInlineExpressionParser().splitAndEvaluate("t_${[\"new${1+2}\",'old']}_order_${1..2}");
assertThat(expected.size(), is(4));
assertThat(expected, hasItems("t_new3_order_1", "t_new3_order_2", "t_old_order_1", "t_old_order_2"));
}
@Test
void assertEvaluateForExpressionPlaceHolder() {
- List<String> expected = new InlineExpressionParser().splitAndEvaluate("t_$->{[\"new$->{1+2}\",'old']}_order_$->{1..2}");
+ List<String> expected = new EspressoInlineExpressionParser().splitAndEvaluate("t_$->{[\"new$->{1+2}\",'old']}_order_$->{1..2}");
assertThat(expected.size(), is(4));
assertThat(expected, hasItems("t_new3_order_1", "t_new3_order_2", "t_old_order_1", "t_old_order_2"));
}
@@ -103,15 +105,15 @@ class InlineExpressionParserTest {
expression.append(",");
}
}
- List<String> expected = new InlineExpressionParser().splitAndEvaluate(expression.toString());
+ List<String> expected = new EspressoInlineExpressionParser().splitAndEvaluate(expression.toString());
assertThat(expected.size(), is(1024));
assertThat(expected, hasItems("ds_0.t_user_0", "ds_15.t_user_1023"));
}
@Test
void assertHandlePlaceHolder() {
- assertThat(new InlineExpressionParser().handlePlaceHolder("t_$->{[\"new$->{1+2}\"]}"), is("t_${[\"new${1+2}\"]}"));
- assertThat(new InlineExpressionParser().handlePlaceHolder("t_${[\"new$->{1+2}\"]}"), is("t_${[\"new${1+2}\"]}"));
+ assertThat(new EspressoInlineExpressionParser().handlePlaceHolder("t_$->{[\"new$->{1+2}\"]}"), is("t_${[\"new${1+2}\"]}"));
+ assertThat(new EspressoInlineExpressionParser().handlePlaceHolder("t_${[\"new$->{1+2}\"]}"), is("t_${[\"new${1+2}\"]}"));
}
/**
@@ -123,6 +125,6 @@ class InlineExpressionParserTest {
@Test
@DisabledInNativeImage
void assertEvaluateClosure() {
- assertThat(new InlineExpressionParser().evaluateClosure("${1+2}").call().toString(), is("3"));
+ assertThat(new EspressoInlineExpressionParser().evaluateClosure("${1+2}").call().toString(), is("3"));
}
}
diff --git a/infra/util-groovy/pom.xml b/infra/expr/hotsopt/pom.xml
similarity index 79%
copy from infra/util-groovy/pom.xml
copy to infra/expr/hotsopt/pom.xml
index 7a03e7deec2..d1b961c8ccb 100644
--- a/infra/util-groovy/pom.xml
+++ b/infra/expr/hotsopt/pom.xml
@@ -21,13 +21,18 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-infra</artifactId>
+ <artifactId>shardingsphere-infra-expr</artifactId>
<version>5.3.3-SNAPSHOT</version>
</parent>
-
- <artifactId>shardingsphere-infra-util-groovy</artifactId>
+ <artifactId>shardingsphere-infra-expr-hotsopt</artifactId>
+ <name>${project.artifactId}</name>
<dependencies>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-expr-spi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy</artifactId>
diff --git a/infra/util-groovy/src/main/java/org/apache/shardingsphere/infra/util/groovy/expr/HotspotInlineExpressionParser.java b/infra/expr/hotsopt/src/main/java/org/apache/shardingsphere/infra/expr/hotsopt/HotspotInlineExpressionParser.java
similarity index 95%
rename from infra/util-groovy/src/main/java/org/apache/shardingsphere/infra/util/groovy/expr/HotspotInlineExpressionParser.java
rename to infra/expr/hotsopt/src/main/java/org/apache/shardingsphere/infra/expr/hotsopt/HotspotInlineExpressionParser.java
index 2ca5e9fde34..a27af55ac10 100644
--- a/infra/util-groovy/src/main/java/org/apache/shardingsphere/infra/util/groovy/expr/HotspotInlineExpressionParser.java
+++ b/infra/expr/hotsopt/src/main/java/org/apache/shardingsphere/infra/expr/hotsopt/HotspotInlineExpressionParser.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.util.groovy.expr;
+package org.apache.shardingsphere.infra.expr.hotsopt;
import com.google.common.base.Strings;
import com.google.common.collect.Sets;
@@ -24,6 +24,7 @@ import groovy.lang.GString;
import groovy.lang.GroovyShell;
import groovy.lang.Script;
import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.infra.expr.spi.JVMInlineExpressionParser;
import java.util.ArrayList;
import java.util.Collection;
@@ -62,6 +63,16 @@ public final class HotspotInlineExpressionParser implements JVMInlineExpressionP
return (Closure<?>) evaluate("{it -> \"" + inlineExpression + "\"}");
}
+ @Override
+ public String getType() {
+ return "HOTSPOT";
+ }
+
+ @Override
+ public boolean isDefault() {
+ return true;
+ }
+
private List<Object> evaluate(final List<String> inlineExpressions) {
List<Object> result = new ArrayList<>(inlineExpressions.size());
for (String each : inlineExpressions) {
diff --git a/infra/expr/hotsopt/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.JVMInlineExpressionParser b/infra/expr/hotsopt/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.JVMInlineExpressionParser
new file mode 100644
index 00000000000..48cf905c9a5
--- /dev/null
+++ b/infra/expr/hotsopt/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.expr.spi.JVMInlineExpressionParser
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+org.apache.shardingsphere.infra.expr.hotsopt.HotspotInlineExpressionParser
diff --git a/infra/util-groovy/src/test/java/org/apache/shardingsphere/infra/util/groovy/expr/HotspotInlineExpressionParserTest.java b/infra/expr/hotsopt/src/test/java/org/apache/shardingsphere/infra/expr/hotsopt/HotspotInlineExpressionParserTest.java
similarity index 98%
rename from infra/util-groovy/src/test/java/org/apache/shardingsphere/infra/util/groovy/expr/HotspotInlineExpressionParserTest.java
rename to infra/expr/hotsopt/src/test/java/org/apache/shardingsphere/infra/expr/hotsopt/HotspotInlineExpressionParserTest.java
index 3b35fed5ff2..9a836eff0f9 100644
--- a/infra/util-groovy/src/test/java/org/apache/shardingsphere/infra/util/groovy/expr/HotspotInlineExpressionParserTest.java
+++ b/infra/expr/hotsopt/src/test/java/org/apache/shardingsphere/infra/expr/hotsopt/HotspotInlineExpressionParserTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.util.groovy.expr;
+package org.apache.shardingsphere.infra.expr.hotsopt;
import org.junit.jupiter.api.Test;
diff --git a/infra/util-groovy/pom.xml b/infra/expr/pom.xml
similarity index 82%
copy from infra/util-groovy/pom.xml
copy to infra/expr/pom.xml
index 7a03e7deec2..60affc6aaed 100644
--- a/infra/util-groovy/pom.xml
+++ b/infra/expr/pom.xml
@@ -24,13 +24,14 @@
<artifactId>shardingsphere-infra</artifactId>
<version>5.3.3-SNAPSHOT</version>
</parent>
+ <artifactId>shardingsphere-infra-expr</artifactId>
+ <packaging>pom</packaging>
+ <name>${project.artifactId}</name>
- <artifactId>shardingsphere-infra-util-groovy</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.groovy</groupId>
- <artifactId>groovy</artifactId>
- </dependency>
- </dependencies>
+ <modules>
+ <module>spi</module>
+ <module>core</module>
+ <module>hotsopt</module>
+ <module>espresso</module>
+ </modules>
</project>
diff --git a/infra/util-groovy/pom.xml b/infra/expr/spi/pom.xml
similarity index 79%
rename from infra/util-groovy/pom.xml
rename to infra/expr/spi/pom.xml
index 7a03e7deec2..0271f33961c 100644
--- a/infra/util-groovy/pom.xml
+++ b/infra/expr/spi/pom.xml
@@ -21,13 +21,18 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-infra</artifactId>
+ <artifactId>shardingsphere-infra-expr</artifactId>
<version>5.3.3-SNAPSHOT</version>
</parent>
-
- <artifactId>shardingsphere-infra-util-groovy</artifactId>
+ <artifactId>shardingsphere-infra-expr-spi</artifactId>
+ <name>${project.artifactId}</name>
<dependencies>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-util</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy</artifactId>
diff --git a/infra/util-groovy/src/main/java/org/apache/shardingsphere/infra/util/groovy/expr/JVMInlineExpressionParser.java b/infra/expr/spi/src/main/java/org/apache/shardingsphere/infra/expr/spi/JVMInlineExpressionParser.java
similarity index 89%
rename from infra/util-groovy/src/main/java/org/apache/shardingsphere/infra/util/groovy/expr/JVMInlineExpressionParser.java
rename to infra/expr/spi/src/main/java/org/apache/shardingsphere/infra/expr/spi/JVMInlineExpressionParser.java
index 65a57a57537..1c1f09cf1eb 100644
--- a/infra/util-groovy/src/main/java/org/apache/shardingsphere/infra/util/groovy/expr/JVMInlineExpressionParser.java
+++ b/infra/expr/spi/src/main/java/org/apache/shardingsphere/infra/expr/spi/JVMInlineExpressionParser.java
@@ -15,16 +15,17 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.util.groovy.expr;
+package org.apache.shardingsphere.infra.expr.spi;
import groovy.lang.Closure;
+import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPI;
import java.util.List;
/**
* JVM inline expression parser.
*/
-public interface JVMInlineExpressionParser {
+public interface JVMInlineExpressionParser extends TypedSPI {
/**
* Replace all inline expression placeholders.
diff --git a/infra/pom.xml b/infra/pom.xml
index 625545b249c..6aae2804f92 100644
--- a/infra/pom.xml
+++ b/infra/pom.xml
@@ -39,6 +39,6 @@
<module>merge</module>
<module>context</module>
<module>util</module>
- <module>util-groovy</module>
+ <module>expr</module>
</modules>
</project>
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/ShardingRuleConfigurationImportChecker.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/ShardingRuleConfigurationImportChecker.java
index ca265943317..24a2045132b 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/ShardingRuleConfigurationImportChecker.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/ShardingRuleConfigurationImportChecker.java
@@ -24,7 +24,7 @@ import org.apache.shardingsphere.infra.datanode.DataNode;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.infra.rule.identifier.type.DataSourceContainedRule;
import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
-import org.apache.shardingsphere.infra.util.expr.InlineExpressionParser;
+import org.apache.shardingsphere.infra.expr.core.InlineExpressionParser;
import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/dataset/DataSet.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/dataset/DataSet.java
index 9fdf6f856e0..975f7a72916 100644
--- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/dataset/DataSet.java
+++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/cases/dataset/DataSet.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.test.e2e.cases.dataset;
import lombok.Getter;
import org.apache.shardingsphere.infra.datanode.DataNode;
-import org.apache.shardingsphere.infra.util.expr.InlineExpressionParser;
+import org.apache.shardingsphere.infra.expr.core.InlineExpressionParser;
import org.apache.shardingsphere.test.e2e.cases.dataset.metadata.DataSetMetaData;
import org.apache.shardingsphere.test.e2e.cases.dataset.row.DataSetRow;
diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/composer/BatchE2EContainerComposer.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/composer/BatchE2EContainerComposer.java
index bec66d487f3..0076521eb89 100644
--- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/composer/BatchE2EContainerComposer.java
+++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/composer/BatchE2EContainerComposer.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.test.e2e.engine.composer;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.infra.datanode.DataNode;
-import org.apache.shardingsphere.infra.util.expr.InlineExpressionParser;
+import org.apache.shardingsphere.infra.expr.core.InlineExpressionParser;
import org.apache.shardingsphere.test.e2e.cases.assertion.IntegrationTestCaseAssertion;
import org.apache.shardingsphere.test.e2e.cases.dataset.DataSet;
import org.apache.shardingsphere.test.e2e.cases.dataset.DataSetLoader;
diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DDLE2EIT.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DDLE2EIT.java
index 2bb18454b5b..089595ffccb 100644
--- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DDLE2EIT.java
+++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/DDLE2EIT.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.test.e2e.engine.type;
import com.google.common.base.Splitter;
import lombok.SneakyThrows;
import org.apache.shardingsphere.infra.datanode.DataNode;
-import org.apache.shardingsphere.infra.util.expr.InlineExpressionParser;
+import org.apache.shardingsphere.infra.expr.core.InlineExpressionParser;
import org.apache.shardingsphere.test.e2e.cases.SQLCommandType;
import org.apache.shardingsphere.test.e2e.cases.SQLExecuteType;
import org.apache.shardingsphere.test.e2e.cases.dataset.metadata.DataSetColumn;
diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/BaseDMLE2EIT.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/BaseDMLE2EIT.java
index 81be0fa95ca..1b8cb3d9f50 100644
--- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/BaseDMLE2EIT.java
+++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/engine/type/dml/BaseDMLE2EIT.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.test.e2e.engine.type.dml;
import org.apache.shardingsphere.infra.datanode.DataNode;
-import org.apache.shardingsphere.infra.util.expr.InlineExpressionParser;
+import org.apache.shardingsphere.infra.expr.core.InlineExpressionParser;
import org.apache.shardingsphere.test.e2e.cases.dataset.metadata.DataSetColumn;
import org.apache.shardingsphere.test.e2e.cases.dataset.metadata.DataSetMetaData;
import org.apache.shardingsphere.test.e2e.cases.dataset.row.DataSetRow;
diff --git a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/env/DataSetEnvironmentManager.java b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/env/DataSetEnvironmentManager.java
index b626e7fe4a0..d3b3598b067 100644
--- a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/env/DataSetEnvironmentManager.java
+++ b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/env/DataSetEnvironmentManager.java
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.database.type.DatabaseTypeEngine;
import org.apache.shardingsphere.infra.datanode.DataNode;
import org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine;
import org.apache.shardingsphere.infra.executor.kernel.thread.ExecutorServiceManager;
-import org.apache.shardingsphere.infra.util.expr.InlineExpressionParser;
+import org.apache.shardingsphere.infra.expr.core.InlineExpressionParser;
import org.apache.shardingsphere.test.e2e.cases.dataset.DataSet;
import org.apache.shardingsphere.test.e2e.cases.dataset.metadata.DataSetColumn;
import org.apache.shardingsphere.test.e2e.cases.dataset.metadata.DataSetMetaData;