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 beba832da3f Move SQLFederationFunctionRegister impls to dialect
modules (#37311)
beba832da3f is described below
commit beba832da3f77f5e6becf7b3e56950f235dcdc63
Author: Liang Zhang <[email protected]>
AuthorDate: Tue Dec 9 18:22:07 2025 +0800
Move SQLFederationFunctionRegister impls to dialect modules (#37311)
* Move SQLFederationFunctionRegister impls to dialect modules
* Move SQLFederationFunctionRegister impls to dialect modules
* Move SQLFederationFunctionRegister impls to dialect modules
---
distribution/bom/pom.xml | 10 ++++++++++
jdbc-dialect/opengauss/pom.xml | 6 ++++++
jdbc-dialect/postgresql/pom.xml | 6 ++++++
.../compiler/context/CompilerContextTest.java | 2 +-
.../sqlfederation}/mysql/MySQLFunctionRegister.java | 2 +-
....compiler.sql.function.SQLFederationFunctionRegister | 4 +---
kernel/sql-federation/dialect/{ => opengauss}/pom.xml | 11 +++--------
.../opengauss/OpenGaussFunctionRegister.java | 4 ++--
....compiler.sql.function.SQLFederationFunctionRegister | 4 +---
kernel/sql-federation/dialect/pom.xml | 7 +++++++
kernel/sql-federation/dialect/{ => postgresql}/pom.xml | 17 ++---------------
.../postgresql/PostgreSQLFunctionRegister.java | 2 +-
....compiler.sql.function.SQLFederationFunctionRegister | 4 +---
proxy/dialect/opengauss/pom.xml | 6 ++++++
proxy/dialect/postgresql/pom.xml | 6 ++++++
15 files changed, 54 insertions(+), 37 deletions(-)
diff --git a/distribution/bom/pom.xml b/distribution/bom/pom.xml
index 7aab00d4cee..919ac6b0c72 100644
--- a/distribution/bom/pom.xml
+++ b/distribution/bom/pom.xml
@@ -655,6 +655,16 @@
<artifactId>shardingsphere-sql-federation-mysql</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+
<artifactId>shardingsphere-sql-federation-postgresql</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+
<artifactId>shardingsphere-sql-federation-opengauss</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-sql-parser-api</artifactId>
diff --git a/jdbc-dialect/opengauss/pom.xml b/jdbc-dialect/opengauss/pom.xml
index 8713e0c5f5b..7fe3093af47 100644
--- a/jdbc-dialect/opengauss/pom.xml
+++ b/jdbc-dialect/opengauss/pom.xml
@@ -45,5 +45,11 @@
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-sql-federation-opengauss</artifactId>
+ <version>${project.version}</version>
+ <scope>runtime</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/jdbc-dialect/postgresql/pom.xml b/jdbc-dialect/postgresql/pom.xml
index 5ff0f5e1b72..38a6f0aa379 100644
--- a/jdbc-dialect/postgresql/pom.xml
+++ b/jdbc-dialect/postgresql/pom.xml
@@ -45,5 +45,11 @@
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-sql-federation-postgresql</artifactId>
+ <version>${project.version}</version>
+ <scope>runtime</scope>
+ </dependency>
</dependencies>
</project>
diff --git
a/kernel/sql-federation/compiler/src/test/java/org/apache/shardingsphere/sqlfederation/compiler/context/CompilerContextTest.java
b/kernel/sql-federation/compiler/src/test/java/org/apache/shardingsphere/sqlfederation/compiler/context/CompilerContextTest.java
index ed14d71e896..304bdf151af 100644
---
a/kernel/sql-federation/compiler/src/test/java/org/apache/shardingsphere/sqlfederation/compiler/context/CompilerContextTest.java
+++
b/kernel/sql-federation/compiler/src/test/java/org/apache/shardingsphere/sqlfederation/compiler/context/CompilerContextTest.java
@@ -56,7 +56,7 @@ class CompilerContextTest {
private ShardingSphereDatabase mockDatabase() {
ShardingSphereDatabase result = mock(ShardingSphereDatabase.class,
RETURNS_DEEP_STUBS);
when(result.getName()).thenReturn("foo_db");
-
when(result.getProtocolType()).thenReturn(TypedSPILoader.getService(DatabaseType.class,
"MySQL"));
+
when(result.getProtocolType()).thenReturn(TypedSPILoader.getService(DatabaseType.class,
"FIXTURE"));
return result;
}
}
diff --git
a/kernel/sql-federation/compiler/src/main/java/org/apache/shardingsphere/sqlfederation/compiler/sql/function/mysql/MySQLFunctionRegister.java
b/kernel/sql-federation/dialect/mysql/src/main/java/org/apache/shardingsphere/sqlfederation/mysql/MySQLFunctionRegister.java
similarity index 95%
rename from
kernel/sql-federation/compiler/src/main/java/org/apache/shardingsphere/sqlfederation/compiler/sql/function/mysql/MySQLFunctionRegister.java
rename to
kernel/sql-federation/dialect/mysql/src/main/java/org/apache/shardingsphere/sqlfederation/mysql/MySQLFunctionRegister.java
index 2fa83572a55..e64ff3cd4cb 100644
---
a/kernel/sql-federation/compiler/src/main/java/org/apache/shardingsphere/sqlfederation/compiler/sql/function/mysql/MySQLFunctionRegister.java
+++
b/kernel/sql-federation/dialect/mysql/src/main/java/org/apache/shardingsphere/sqlfederation/mysql/MySQLFunctionRegister.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sqlfederation.compiler.sql.function.mysql;
+package org.apache.shardingsphere.sqlfederation.mysql;
import org.apache.calcite.runtime.SqlFunctions;
import org.apache.calcite.schema.SchemaPlus;
diff --git
a/kernel/sql-federation/compiler/src/main/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.compiler.sql.function.SQLFederationFunctionRegister
b/kernel/sql-federation/dialect/mysql/src/main/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.compiler.sql.function.SQLFederationFunctionRegister
similarity index 73%
copy from
kernel/sql-federation/compiler/src/main/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.compiler.sql.function.SQLFederationFunctionRegister
copy to
kernel/sql-federation/dialect/mysql/src/main/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.compiler.sql.function.SQLFederationFunctionRegister
index ff6056c052e..7a9dd3b1086 100644
---
a/kernel/sql-federation/compiler/src/main/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.compiler.sql.function.SQLFederationFunctionRegister
+++
b/kernel/sql-federation/dialect/mysql/src/main/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.compiler.sql.function.SQLFederationFunctionRegister
@@ -15,6 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.sqlfederation.compiler.sql.function.mysql.MySQLFunctionRegister
-org.apache.shardingsphere.sqlfederation.compiler.sql.function.opengauss.OpenGaussFunctionRegister
-org.apache.shardingsphere.sqlfederation.compiler.sql.function.postgresql.PostgreSQLFunctionRegister
+org.apache.shardingsphere.sqlfederation.mysql.MySQLFunctionRegister
diff --git a/kernel/sql-federation/dialect/pom.xml
b/kernel/sql-federation/dialect/opengauss/pom.xml
similarity index 83%
copy from kernel/sql-federation/dialect/pom.xml
copy to kernel/sql-federation/dialect/opengauss/pom.xml
index 7df6dfc6508..1fbb2f7f33d 100644
--- a/kernel/sql-federation/dialect/pom.xml
+++ b/kernel/sql-federation/dialect/opengauss/pom.xml
@@ -20,21 +20,16 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-sql-federation</artifactId>
+ <artifactId>shardingsphere-sql-federation-dialect</artifactId>
<version>5.5.3-SNAPSHOT</version>
</parent>
- <artifactId>shardingsphere-sql-federation-dialect</artifactId>
- <packaging>pom</packaging>
+ <artifactId>shardingsphere-sql-federation-opengauss</artifactId>
<name>${project.artifactId}</name>
- <modules>
- <module>mysql</module>
- </modules>
-
<dependencies>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-sql-federation-core</artifactId>
+ <artifactId>shardingsphere-sql-federation-postgresql</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
diff --git
a/kernel/sql-federation/compiler/src/main/java/org/apache/shardingsphere/sqlfederation/compiler/sql/function/opengauss/OpenGaussFunctionRegister.java
b/kernel/sql-federation/dialect/opengauss/src/main/java/org/apache/shardingsphere/sqlfederation/opengauss/OpenGaussFunctionRegister.java
similarity index 92%
rename from
kernel/sql-federation/compiler/src/main/java/org/apache/shardingsphere/sqlfederation/compiler/sql/function/opengauss/OpenGaussFunctionRegister.java
rename to
kernel/sql-federation/dialect/opengauss/src/main/java/org/apache/shardingsphere/sqlfederation/opengauss/OpenGaussFunctionRegister.java
index 44821424bae..048605eecf3 100644
---
a/kernel/sql-federation/compiler/src/main/java/org/apache/shardingsphere/sqlfederation/compiler/sql/function/opengauss/OpenGaussFunctionRegister.java
+++
b/kernel/sql-federation/dialect/opengauss/src/main/java/org/apache/shardingsphere/sqlfederation/opengauss/OpenGaussFunctionRegister.java
@@ -15,13 +15,13 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.sqlfederation.compiler.sql.function.opengauss;
+package org.apache.shardingsphere.sqlfederation.opengauss;
import org.apache.calcite.schema.SchemaPlus;
import org.apache.calcite.schema.impl.ScalarFunctionImpl;
import
org.apache.shardingsphere.sqlfederation.compiler.sql.function.SQLFederationFunctionRegister;
import
org.apache.shardingsphere.sqlfederation.compiler.sql.function.opengauss.impl.OpenGaussSystemFunction;
-import
org.apache.shardingsphere.sqlfederation.compiler.sql.function.postgresql.PostgreSQLFunctionRegister;
+import
org.apache.shardingsphere.sqlfederation.postgresql.PostgreSQLFunctionRegister;
/**
* Opengauss function register.
diff --git
a/kernel/sql-federation/compiler/src/main/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.compiler.sql.function.SQLFederationFunctionRegister
b/kernel/sql-federation/dialect/opengauss/src/main/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.compiler.sql.function.SQLFederationFunctionRegister
similarity index 73%
copy from
kernel/sql-federation/compiler/src/main/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.compiler.sql.function.SQLFederationFunctionRegister
copy to
kernel/sql-federation/dialect/opengauss/src/main/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.compiler.sql.function.SQLFederationFunctionRegister
index ff6056c052e..74ae47412ba 100644
---
a/kernel/sql-federation/compiler/src/main/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.compiler.sql.function.SQLFederationFunctionRegister
+++
b/kernel/sql-federation/dialect/opengauss/src/main/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.compiler.sql.function.SQLFederationFunctionRegister
@@ -15,6 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.sqlfederation.compiler.sql.function.mysql.MySQLFunctionRegister
-org.apache.shardingsphere.sqlfederation.compiler.sql.function.opengauss.OpenGaussFunctionRegister
-org.apache.shardingsphere.sqlfederation.compiler.sql.function.postgresql.PostgreSQLFunctionRegister
+org.apache.shardingsphere.sqlfederation.opengauss.OpenGaussFunctionRegister
diff --git a/kernel/sql-federation/dialect/pom.xml
b/kernel/sql-federation/dialect/pom.xml
index 7df6dfc6508..57aae943d6a 100644
--- a/kernel/sql-federation/dialect/pom.xml
+++ b/kernel/sql-federation/dialect/pom.xml
@@ -29,6 +29,8 @@
<modules>
<module>mysql</module>
+ <module>postgresql</module>
+ <module>opengauss</module>
</modules>
<dependencies>
@@ -37,5 +39,10 @@
<artifactId>shardingsphere-sql-federation-core</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-sql-federation-compiler</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/kernel/sql-federation/dialect/pom.xml
b/kernel/sql-federation/dialect/postgresql/pom.xml
similarity index 72%
copy from kernel/sql-federation/dialect/pom.xml
copy to kernel/sql-federation/dialect/postgresql/pom.xml
index 7df6dfc6508..186485529d8 100644
--- a/kernel/sql-federation/dialect/pom.xml
+++ b/kernel/sql-federation/dialect/postgresql/pom.xml
@@ -20,22 +20,9 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-sql-federation</artifactId>
+ <artifactId>shardingsphere-sql-federation-dialect</artifactId>
<version>5.5.3-SNAPSHOT</version>
</parent>
- <artifactId>shardingsphere-sql-federation-dialect</artifactId>
- <packaging>pom</packaging>
+ <artifactId>shardingsphere-sql-federation-postgresql</artifactId>
<name>${project.artifactId}</name>
-
- <modules>
- <module>mysql</module>
- </modules>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-sql-federation-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
</project>
diff --git
a/kernel/sql-federation/compiler/src/main/java/org/apache/shardingsphere/sqlfederation/compiler/sql/function/postgresql/PostgreSQLFunctionRegister.java
b/kernel/sql-federation/dialect/postgresql/src/main/java/org/apache/shardingsphere/sqlfederation/postgresql/PostgreSQLFunctionRegister.java
similarity index 95%
rename from
kernel/sql-federation/compiler/src/main/java/org/apache/shardingsphere/sqlfederation/compiler/sql/function/postgresql/PostgreSQLFunctionRegister.java
rename to
kernel/sql-federation/dialect/postgresql/src/main/java/org/apache/shardingsphere/sqlfederation/postgresql/PostgreSQLFunctionRegister.java
index 1936b7d9cef..b8d2fdc69f7 100644
---
a/kernel/sql-federation/compiler/src/main/java/org/apache/shardingsphere/sqlfederation/compiler/sql/function/postgresql/PostgreSQLFunctionRegister.java
+++
b/kernel/sql-federation/dialect/postgresql/src/main/java/org/apache/shardingsphere/sqlfederation/postgresql/PostgreSQLFunctionRegister.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.sqlfederation.compiler.sql.function.postgresql;
+package org.apache.shardingsphere.sqlfederation.postgresql;
import org.apache.calcite.schema.SchemaPlus;
import org.apache.calcite.schema.impl.ScalarFunctionImpl;
diff --git
a/kernel/sql-federation/compiler/src/main/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.compiler.sql.function.SQLFederationFunctionRegister
b/kernel/sql-federation/dialect/postgresql/src/main/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.compiler.sql.function.SQLFederationFunctionRegister
similarity index 73%
rename from
kernel/sql-federation/compiler/src/main/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.compiler.sql.function.SQLFederationFunctionRegister
rename to
kernel/sql-federation/dialect/postgresql/src/main/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.compiler.sql.function.SQLFederationFunctionRegister
index ff6056c052e..1c21f5bd7f1 100644
---
a/kernel/sql-federation/compiler/src/main/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.compiler.sql.function.SQLFederationFunctionRegister
+++
b/kernel/sql-federation/dialect/postgresql/src/main/resources/META-INF/services/org.apache.shardingsphere.sqlfederation.compiler.sql.function.SQLFederationFunctionRegister
@@ -15,6 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.sqlfederation.compiler.sql.function.mysql.MySQLFunctionRegister
-org.apache.shardingsphere.sqlfederation.compiler.sql.function.opengauss.OpenGaussFunctionRegister
-org.apache.shardingsphere.sqlfederation.compiler.sql.function.postgresql.PostgreSQLFunctionRegister
+org.apache.shardingsphere.sqlfederation.postgresql.PostgreSQLFunctionRegister
diff --git a/proxy/dialect/opengauss/pom.xml b/proxy/dialect/opengauss/pom.xml
index 876a4b648d3..8e0da49d336 100644
--- a/proxy/dialect/opengauss/pom.xml
+++ b/proxy/dialect/opengauss/pom.xml
@@ -45,6 +45,12 @@
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-sql-federation-opengauss</artifactId>
+ <version>${project.version}</version>
+ <scope>runtime</scope>
+ </dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-protocol-opengauss</artifactId>
diff --git a/proxy/dialect/postgresql/pom.xml b/proxy/dialect/postgresql/pom.xml
index cd1ab9dfba0..92e042b528d 100644
--- a/proxy/dialect/postgresql/pom.xml
+++ b/proxy/dialect/postgresql/pom.xml
@@ -45,6 +45,12 @@
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-sql-federation-postgresql</artifactId>
+ <version>${project.version}</version>
+ <scope>runtime</scope>
+ </dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-protocol-postgresql</artifactId>