This is an automated email from the ASF dual-hosted git repository.
zhonghongsheng 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 b54c814cb8b Refactor HiveServer2's nativeTest (#37401)
b54c814cb8b is described below
commit b54c814cb8b42ca72cb98430506e5d0c27e25786
Author: Ling Hengqian <[email protected]>
AuthorDate: Tue Dec 16 20:04:15 2025 +0800
Refactor HiveServer2's nativeTest (#37401)
---
.../graalvm-native-image/_index.cn.md | 6 +-
.../graalvm-native-image/_index.en.md | 6 +-
.../optional-plugins/hiveserver2/_index.cn.md | 88 ++-------------------
.../optional-plugins/hiveserver2/_index.en.md | 89 ++--------------------
.../optional-plugins/presto/_index.cn.md | 4 +-
.../optional-plugins/presto/_index.en.md | 4 +-
.../special-api/transaction/seata.cn.md | 2 +-
.../special-api/transaction/seata.en.md | 2 +-
.../reachability-metadata.json | 12 +++
pom.xml | 14 +---
.../commons/repository/AddressRepository.java | 15 ++++
.../commons/repository/OrderItemRepository.java | 17 +++++
.../commons/repository/OrderRepository.java | 17 +++++
.../test/natived/jdbc/databases/MySQLTest.java | 2 +-
.../test/natived/jdbc/databases/PrestoTest.java | 2 +-
.../test/natived/jdbc/databases/SQLServerTest.java | 12 +++
.../natived/jdbc/databases/hive/IcebergTest.java | 29 +------
.../jdbc/databases/hive/SystemSchemasTest.java | 31 +-------
.../hive/ZookeeperServiceDiscoveryTest.java | 45 +++--------
.../test/natived/proxy/databases/MySQLTest.java | 2 +-
.../test/natived/proxy/databases/PostgresTest.java | 2 +-
.../natived/proxy/transactions/base/SeataTest.java | 2 +-
.../resources/container-license-acceptance.txt | 2 +-
.../yaml/jdbc/databases/postgresql.yaml | 6 +-
.../test-native/yaml/jdbc/databases/sqlserver.yaml | 6 +-
.../yaml/jdbc/transactions/base/seata.yaml | 6 +-
26 files changed, 131 insertions(+), 292 deletions(-)
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.cn.md
b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.cn.md
index d7944b233bb..67103d87c42 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.cn.md
@@ -52,7 +52,7 @@ java.beans.Introspector was unintentionally initialized at
build time. To see wh
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
- <version>0.11.0</version>
+ <version>0.11.3</version>
<extensions>true</extensions>
<configuration>
<buildArgs>
@@ -92,12 +92,12 @@ java.beans.Introspector was unintentionally initialized at
build time. To see wh
```groovy
plugins {
- id 'org.graalvm.buildtools.native' version '0.11.0'
+ id 'org.graalvm.buildtools.native' version '0.11.3'
}
dependencies {
implementation
'org.apache.shardingsphere:shardingsphere-jdbc:${shardingsphere.version}'
- implementation(group: 'org.graalvm.buildtools', name:
'graalvm-reachability-metadata', version: '0.11.0', classifier: 'repository',
ext: 'zip')
+ implementation(group: 'org.graalvm.buildtools', name:
'graalvm-reachability-metadata', version: '0.11.3', classifier: 'repository',
ext: 'zip')
}
graalvmNative {
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.en.md
b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.en.md
index 310639c02ae..472bd64d707 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.en.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.en.md
@@ -53,7 +53,7 @@ and the documentation of GraalVM Native Build Tools shall
prevail.
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
- <version>0.11.0</version>
+ <version>0.11.3</version>
<extensions>true</extensions>
<configuration>
<buildArgs>
@@ -95,12 +95,12 @@ Reference
https://github.com/graalvm/native-build-tools/issues/572 .
```groovy
plugins {
- id 'org.graalvm.buildtools.native' version '0.11.0'
+ id 'org.graalvm.buildtools.native' version '0.11.3'
}
dependencies {
implementation
'org.apache.shardingsphere:shardingsphere-jdbc:${shardingsphere.version}'
- implementation(group: 'org.graalvm.buildtools', name:
'graalvm-reachability-metadata', version: '0.11.0', classifier: 'repository',
ext: 'zip')
+ implementation(group: 'org.graalvm.buildtools', name:
'graalvm-reachability-metadata', version: '0.11.3', classifier: 'repository',
ext: 'zip')
}
graalvmNative {
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/hiveserver2/_index.cn.md
b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/hiveserver2/_index.cn.md
index 6aeb82bc8e5..423171971cf 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/hiveserver2/_index.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/hiveserver2/_index.cn.md
@@ -59,7 +59,7 @@ ShardingSphere 对 HiveServer2 JDBC Driver 的支持位于可选模块中。
<dependency>
<groupId>io.github.linghengqian</groupId>
<artifactId>hive-server2-jdbc-driver-thin</artifactId>
- <version>1.7.0</version>
+ <version>1.8.2</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.woodstox</groupId>
@@ -111,22 +111,6 @@ CREATE DATABASE demo_ds_1;
CREATE DATABASE demo_ds_2;
```
-分别使用 `jdbc:hive2://localhost:10000/demo_ds_0` ,
-`jdbc:hive2://localhost:10000/demo_ds_1` 和
`jdbc:hive2://localhost:10000/demo_ds_2` 的 `standardJdbcUrl` 连接至 HiveServer2
来执行如下 SQL,
-
-```sql
--- noinspection SqlNoDataSourceInspectionForFile
-CREATE TABLE IF NOT EXISTS t_order
-(
- order_id BIGINT NOT NULL,
- order_type INT,
- user_id INT NOT NULL,
- address_id BIGINT NOT NULL,
- status string,
- PRIMARY KEY (order_id) disable novalidate
-) STORED BY ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2');
-```
-
### 在业务项目创建 ShardingSphere 数据源
在业务项目引入`前提条件`涉及的依赖后,在业务项目的 classpath 上编写 ShardingSphere 数据源的配置文件`demo.yaml`,
@@ -185,6 +169,7 @@ public class ExampleUtils {
try (HikariDataSource dataSource = new HikariDataSource(config);
Connection connection = dataSource.getConnection();
Statement statement = connection.createStatement()) {
+ statement.execute("CREATE TABLE IF NOT EXISTS t_order (order_id
BIGINT NOT NULL, order_type INT, user_id INT NOT NULL, address_id BIGINT NOT
NULL, status string, PRIMARY KEY (order_id) disable novalidate) STORED BY
ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2')");
statement.execute("TRUNCATE TABLE t_order");
statement.execute("INSERT INTO t_order (user_id, order_type,
address_id, status) VALUES (1, 1, 1, 'INSERT_TEST')");
statement.executeQuery("SELECT * FROM t_order");
@@ -237,24 +222,6 @@ CREATE DATABASE demo_ds_1;
CREATE DATABASE demo_ds_2;
```
-分别使用
`jdbc:hive2://127.0.0.1:2181/demo_ds_0;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2`
,
-`jdbc:hive2://127.0.0.1:2181/demo_ds_1;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2`
和
-`jdbc:hive2://127.0.0.1:2181/demo_ds_2;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2`
-的 `standardJdbcUrl` 连接至 HiveServer2 来执行如下 SQL,
-
-```sql
--- noinspection SqlNoDataSourceInspectionForFile
-CREATE TABLE IF NOT EXISTS t_order
-(
- order_id BIGINT NOT NULL,
- order_type INT,
- user_id INT NOT NULL,
- address_id BIGINT NOT NULL,
- status string,
- PRIMARY KEY (order_id) disable novalidate
-) STORED BY ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2');
-```
-
在业务项目引入`前提条件`涉及的依赖后,在业务项目的 classpath 上编写 ShardingSphere 数据源的配置文件`demo.yaml`,
```yaml
@@ -309,6 +276,7 @@ public class ExampleUtils {
try (HikariDataSource dataSource = new HikariDataSource(config);
Connection connection = dataSource.getConnection();
Statement statement = connection.createStatement()) {
+ statement.execute("CREATE TABLE IF NOT EXISTS t_order (order_id
BIGINT NOT NULL, order_type INT, user_id INT NOT NULL, address_id BIGINT NOT
NULL, status string, PRIMARY KEY (order_id) disable novalidate) STORED BY
ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2')");
statement.execute("TRUNCATE TABLE t_order");
statement.execute("INSERT INTO t_order (user_id, order_type,
address_id, status) VALUES (1, 1, 1, 'INSERT_TEST')");
statement.executeQuery("SELECT * FROM t_order");
@@ -354,24 +322,6 @@ CREATE DATABASE demo_ds_1;
CREATE DATABASE demo_ds_2;
```
-分别使用
`jdbc:hive2://127.0.0.1:2181/demo_ds_0;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2`
,
-`jdbc:hive2://127.0.0.1:2181/demo_ds_1;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2`
和
-`jdbc:hive2://127.0.0.1:2181/demo_ds_2;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2`
-的 `standardJdbcUrl` 连接至 HiveServer2 来执行如下 SQL,
-
-```sql
--- noinspection SqlNoDataSourceInspectionForFile
-CREATE TABLE IF NOT EXISTS t_order
-(
- order_id BIGINT NOT NULL,
- order_type INT,
- user_id INT NOT NULL,
- address_id BIGINT NOT NULL,
- status string,
- PRIMARY KEY (order_id) disable novalidate
-) STORED BY ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2');
-```
-
此时,旧的 ShardingSphere JDBC DataSource 仍可在不重新创建 JDBC DataSource 的情况下,
正常切换到 `service` 名为 `apache-hive-2` 的 HiveServer2 实例执行逻辑 SQL,
@@ -384,6 +334,7 @@ public class ExampleUtils {
void test(HikariDataSource dataSource) throws SQLException {
try (Connection connection = dataSource.getConnection();
Statement statement = connection.createStatement()) {
+ statement.execute("CREATE TABLE IF NOT EXISTS t_order (order_id
BIGINT NOT NULL, order_type INT, user_id INT NOT NULL, address_id BIGINT NOT
NULL, status string, PRIMARY KEY (order_id) disable novalidate) STORED BY
ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2')");
statement.execute("TRUNCATE TABLE t_order");
statement.execute("INSERT INTO t_order (user_id, order_type,
address_id, status) VALUES (1, 1, 1, 'INSERT_TEST')");
statement.executeQuery("SELECT * FROM t_order");
@@ -419,35 +370,6 @@ HiveServer2 并不能保证每一条 `insert` 相关的 DML SQL 都能成功执
ShardingSphere JDBC DataSource 尚不支持执行 HiveServer2 的 `set` 语句。
-ShardingSphere JDBC DataSource 当前支持通过执行 `create table` 语句创建普通表,但不支持通过执行
`create table` 语句创建 Iceberg 表。
-这意味着 ShardingSphere JDBC DataSource 可执行类似如下的语句,
-
-```sql
--- noinspection SqlNoDataSourceInspectionForFile
-create table IF NOT EXISTS t_order (
- order_id BIGINT NOT NULL,
- order_type INT,
- user_id INT NOT NULL,
- address_id BIGINT NOT NULL,
- status VARCHAR(50),
- PRIMARY KEY (order_id) disable novalidate
-) CLUSTERED BY (order_id) INTO 2 BUCKETS STORED AS ORC TBLPROPERTIES
('transactional' = 'true');
-```
-
-但 ShardingSphere JDBC DataSource 无法执行类似如下的语句,
-
-```sql
--- noinspection SqlNoDataSourceInspectionForFile
-CREATE TABLE IF NOT EXISTS t_order (
- order_id BIGINT NOT NULL,
- order_type INT,
- user_id INT NOT NULL,
- address_id BIGINT NOT NULL,
- status string,
- PRIMARY KEY (order_id) disable novalidate
-) STORED BY ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2');
-```
-
#### 使用 `initFile` 参数部分绕开 SQL 限制
受 https://issues.apache.org/jira/browse/HIVE-28835 影响,HiveServer2 JDBC Driver
的`initFile` 参数仅可在 Linux 环境下使用。
@@ -581,7 +503,7 @@ CREATE TABLE IF NOT EXISTS t_order
```
Iceberg 表格式支持的 Hive type 相对较少,为 HiveServer2 执行 SQL `set
iceberg.mr.schema.auto.conversion=true;`有助于缓解这一问题。
-SQL `set iceberg.mr.schema.auto.conversion=true;` 存在
https://issues.apache.org/jira/browse/HIVE-26507 涉及的弊端。
+但 SQL `set iceberg.mr.schema.auto.conversion=true;` 存在
https://issues.apache.org/jira/browse/HIVE-26507 涉及的弊端。
### 事务限制
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/hiveserver2/_index.en.md
b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/hiveserver2/_index.en.md
index 9e0d4b65f70..c6d350df793 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/hiveserver2/_index.en.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/hiveserver2/_index.en.md
@@ -61,7 +61,7 @@ The following is an example of a possible configuration,
<dependency>
<groupId>io.github.linghengqian</groupId>
<artifactId>hive-server2-jdbc-driver-thin</artifactId>
- <version>1.7.0</version>
+ <version>1.8.2</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.woodstox</groupId>
@@ -114,22 +114,6 @@ CREATE DATABASE demo_ds_1;
CREATE DATABASE demo_ds_2;
```
-Use the `standardJdbcUrl` of `jdbc:hive2://localhost:10000/demo_ds_0`,
-`jdbc:hive2://localhost:10000/demo_ds_1` and
`jdbc:hive2://localhost:10000/demo_ds_2` to connect to HiveServer2 to execute
the following SQL,
-
-```sql
--- noinspection SqlNoDataSourceInspectionForFile
-CREATE TABLE IF NOT EXISTS t_order
-(
- order_id BIGINT NOT NULL,
- order_type INT,
- user_id INT NOT NULL,
- address_id BIGINT NOT NULL,
- status string,
- PRIMARY KEY (order_id) disable novalidate
-) STORED BY ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2');
-```
-
### Create ShardingSphere data source in business projects
After the business project introduces the dependencies involved in
`prerequisites`,
@@ -189,6 +173,7 @@ public class ExampleUtils {
try (HikariDataSource dataSource = new HikariDataSource(config);
Connection connection = dataSource.getConnection();
Statement statement = connection.createStatement()) {
+ statement.execute("CREATE TABLE IF NOT EXISTS t_order (order_id
BIGINT NOT NULL, order_type INT, user_id INT NOT NULL, address_id BIGINT NOT
NULL, status string, PRIMARY KEY (order_id) disable novalidate) STORED BY
ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2')");
statement.execute("TRUNCATE TABLE t_order");
statement.execute("INSERT INTO t_order (user_id, order_type,
address_id, status) VALUES (1, 1, 1, 'INSERT_TEST')");
statement.executeQuery("SELECT * FROM t_order");
@@ -241,24 +226,6 @@ CREATE DATABASE demo_ds_1;
CREATE DATABASE demo_ds_2;
```
-Use `standardJdbcUrl` of
`jdbc:hive2://127.0.0.1:2181/demo_ds_0;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2`,
-`jdbc:hive2://127.0.0.1:2181/demo_ds_1;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2`
-and
`jdbc:hive2://127.0.0.1:2181/demo_ds_2;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2`
-to connect to HiveServer2 and execute the following SQL,
-
-```sql
--- noinspection SqlNoDataSourceInspectionForFile
-CREATE TABLE IF NOT EXISTS t_order
-(
- order_id BIGINT NOT NULL,
- order_type INT,
- user_id INT NOT NULL,
- address_id BIGINT NOT NULL,
- status string,
- PRIMARY KEY (order_id) disable novalidate
-) STORED BY ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2');
-```
-
After the business project introduces the dependencies involved in the
`prerequisites`,
write the ShardingSphere data source configuration file `demo.yaml` on the
classpath of the business project.
@@ -314,6 +281,7 @@ public class ExampleUtils {
try (HikariDataSource dataSource = new HikariDataSource(config);
Connection connection = dataSource.getConnection();
Statement statement = connection.createStatement()) {
+ statement.execute("CREATE TABLE IF NOT EXISTS t_order (order_id
BIGINT NOT NULL, order_type INT, user_id INT NOT NULL, address_id BIGINT NOT
NULL, status string, PRIMARY KEY (order_id) disable novalidate) STORED BY
ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2')");
statement.execute("TRUNCATE TABLE t_order");
statement.execute("INSERT INTO t_order (user_id, order_type,
address_id, status) VALUES (1, 1, 1, 'INSERT_TEST')");
statement.executeQuery("SELECT * FROM t_order");
@@ -359,24 +327,6 @@ CREATE DATABASE demo_ds_1;
CREATE DATABASE demo_ds_2;
```
-Use `standardJdbcUrl` of
`jdbc:hive2://127.0.0.1:2181/demo_ds_0;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2`,
-`jdbc:hive2://127.0.0.1:2181/demo_ds_1;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2`
-and
`jdbc:hive2://127.0.0.1:2181/demo_ds_2;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2`
-to connect to HiveServer2 and execute the following SQL,
-
-```sql
--- noinspection SqlNoDataSourceInspectionForFile
-CREATE TABLE IF NOT EXISTS t_order
-(
- order_id BIGINT NOT NULL,
- order_type INT,
- user_id INT NOT NULL,
- address_id BIGINT NOT NULL,
- status string,
- PRIMARY KEY (order_id) disable novalidate
-) STORED BY ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2');
-```
-
At this point,
the old ShardingSphere JDBC DataSource can still be switched to the
HiveServer2 instance named `apache-hive-2` in the `service` to execute the
logical SQL without recreating the JDBC DataSource.
@@ -389,6 +339,7 @@ public class ExampleUtils {
void test(HikariDataSource dataSource) throws SQLException {
try (Connection connection = dataSource.getConnection();
Statement statement = connection.createStatement()) {
+ statement.execute("CREATE TABLE IF NOT EXISTS t_order (order_id
BIGINT NOT NULL, order_type INT, user_id INT NOT NULL, address_id BIGINT NOT
NULL, status string, PRIMARY KEY (order_id) disable novalidate) STORED BY
ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2')");
statement.execute("TRUNCATE TABLE t_order");
statement.execute("INSERT INTO t_order (user_id, order_type,
address_id, status) VALUES (1, 1, 1, 'INSERT_TEST')");
statement.executeQuery("SELECT * FROM t_order");
@@ -425,36 +376,6 @@ HiveServer2 does not guarantee that every `insert` related
DML SQL can be execut
ShardingSphere JDBC DataSource does not yet support executing the `set`
statement of HiveServer2.
-ShardingSphere JDBC DataSource currently supports creating normal tables by
executing the `create table` statement,
-but does not support creating Iceberg tables by executing the `create table`
statement.
-This means that ShardingSphere JDBC DataSource can execute statements similar
to the following,
-
-```sql
--- noinspection SqlNoDataSourceInspectionForFile
-create table IF NOT EXISTS t_order (
- order_id BIGINT NOT NULL,
- order_type INT,
- user_id INT NOT NULL,
- address_id BIGINT NOT NULL,
- status VARCHAR(50),
- PRIMARY KEY (order_id) disable novalidate
-) CLUSTERED BY (order_id) INTO 2 BUCKETS STORED AS ORC TBLPROPERTIES
('transactional' = 'true');
-```
-
-But ShardingSphere JDBC DataSource cannot execute statements like the
following,
-
-```sql
--- noinspection SqlNoDataSourceInspectionForFile
-CREATE TABLE IF NOT EXISTS t_order (
- order_id BIGINT NOT NULL,
- order_type INT,
- user_id INT NOT NULL,
- address_id BIGINT NOT NULL,
- status string,
- PRIMARY KEY (order_id) disable novalidate
-) STORED BY ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2');
-```
-
#### Use `initFile` parameter to partially bypass SQL restrictions
Affected by https://issues.apache.org/jira/browse/HIVE-28835 ,
@@ -593,7 +514,7 @@ CREATE TABLE IF NOT EXISTS t_order
Iceberg table format supports relatively few Hive types.
Executing SQL `set iceberg.mr.schema.auto.conversion=true;` for HiveServer2
can help alleviate this problem.
-SQL `set iceberg.mr.schema.auto.conversion=true;` has the drawbacks mentioned
in https://issues.apache.org/jira/browse/HIVE-26507 .
+However, the SQL statement `set iceberg.mr.schema.auto.conversion=true;` has
the drawbacks mentioned in https://issues.apache.org/jira/browse/HIVE-26507 .
### Transaction Limitations
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/presto/_index.cn.md
b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/presto/_index.cn.md
index 95ac6b394b5..ba91bbc1e07 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/presto/_index.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/presto/_index.cn.md
@@ -28,7 +28,7 @@ ShardingSphere 对 Presto JDBC Driver 的支持位于可选模块中。
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-jdbc</artifactId>
- <version>0.292</version>
+ <version>0.296</version>
</dependency>
</dependencies>
```
@@ -43,7 +43,7 @@ ShardingSphere 对 Presto JDBC Driver 的支持位于可选模块中。
```yaml
services:
presto:
- image: prestodb/presto:0.292
+ image: prestodb/presto:0.296
ports:
- "8080:8080"
volumes:
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/presto/_index.en.md
b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/presto/_index.en.md
index b43765cb4bb..4dc3bbefbb4 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/presto/_index.en.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/presto/_index.en.md
@@ -28,7 +28,7 @@ Possible Maven dependencies are as follows,
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-jdbc</artifactId>
- <version>0.292</version>
+ <version>0.296</version>
</dependency>
</dependencies>
```
@@ -44,7 +44,7 @@ In addition, this Iceberg Connector will start a Hive
Metastore Server using a l
```yaml
services:
presto:
- image: prestodb/presto:0.292
+ image: prestodb/presto:0.296
ports:
- "8080:8080"
volumes:
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/seata.cn.md
b/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/seata.cn.md
index 7c50f7ee6d4..318aaa9cbd2 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/seata.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/seata.cn.md
@@ -118,7 +118,7 @@ services:
environment:
MYSQL_ROOT_PASSWORD: example
volumes:
- - ./mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
+ - ./docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
ports:
- "3306:3306"
```
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/seata.en.md
b/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/seata.en.md
index 8daf23e79ca..c433bb5f736 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/seata.en.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/seata.en.md
@@ -129,7 +129,7 @@ services:
environment:
MYSQL_ROOT_PASSWORD: example
volumes:
- - ./mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
+ - ./docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
ports:
- "3306:3306"
```
diff --git
a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/reachability-metadata.json
b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/reachability-metadata.json
index 411e6407ef8..d58c1d1f5d8 100644
---
a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/reachability-metadata.json
+++
b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/reachability-metadata.json
@@ -261,6 +261,18 @@
"type":
"org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereIndex",
"allPublicMethods": true
},
+ {
+ "condition": {
+ "typeReached":
"org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereIndex"
+ },
+ "type":
"org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereIndexBeanInfo"
+ },
+ {
+ "condition": {
+ "typeReached":
"org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereIndex"
+ },
+ "type":
"org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereIndexCustomizer"
+ },
{
"condition": {
"typeReached":
"org.apache.shardingsphere.infra.metadata.database.schema.builder.SystemSchemaBuilder"
diff --git a/pom.xml b/pom.xml
index 39bc6362a5a..9b69d2603e8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -127,12 +127,12 @@
<clickhouse-jdbc.version>0.6.3</clickhouse-jdbc.version>
<hive-jdbc.version>4.0.1</hive-jdbc.version>
<hive-server2-jdbc-driver-thin.version>1.8.2</hive-server2-jdbc-driver-thin.version>
- <presto.version>0.292</presto.version>
+ <presto.version>0.296</presto.version>
<jaybird.version>5.0.6.java8</jaybird.version>
<hikari-cp.version>4.0.3</hikari-cp.version>
- <junit.version>5.13.4</junit.version>
+ <junit.version>5.14.1</junit.version>
<hamcrest.version>3.0</hamcrest.version>
<mockito.version>4.11.0</mockito.version>
<awaitility.version>4.3.0</awaitility.version>
@@ -145,7 +145,7 @@
<protobuf-maven-plugin.version>0.6.1</protobuf-maven-plugin.version>
<dockerfile-maven.version>1.4.13</dockerfile-maven.version>
<os-detector-maven-plugin.version>0.3.1</os-detector-maven-plugin.version>
- <native-maven-plugin.version>0.11.0</native-maven-plugin.version>
+ <native-maven-plugin.version>0.11.3</native-maven-plugin.version>
<!-- Compile plugin versions -->
<maven-antrun-plugin.version>3.1.0</maven-antrun-plugin.version>
@@ -1177,14 +1177,6 @@
</goals>
<phase>integration-test</phase>
</execution>
- <!--TODO See
https://github.com/graalvm/native-build-tools/pull/748 -->
- <execution>
- <id>metadata-copy-manually</id>
- <goals>
- <goal>metadata-copy</goal>
- </goals>
- <phase>deploy</phase>
- </execution>
</executions>
</plugin>
</plugins>
diff --git
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/repository/AddressRepository.java
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/repository/AddressRepository.java
index 2717254b9bf..6df1b1c39ab 100644
---
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/repository/AddressRepository.java
+++
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/repository/AddressRepository.java
@@ -97,6 +97,21 @@ public final class AddressRepository {
}
}
+ /**
+ * Create Iceberg table in HiveServer2.
+ *
+ * @throws SQLException SQL exception
+ */
+ public void createIcebergTableInHiveServer2() throws SQLException {
+ String sql = "CREATE TABLE IF NOT EXISTS t_address (address_id BIGINT
NOT NULL,address_name string NOT NULL, "
+ + "PRIMARY KEY (address_id) disable novalidate) STORED BY
ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2')";
+ try (
+ Connection connection = dataSource.getConnection();
+ Statement statement = connection.createStatement()) {
+ statement.executeUpdate(sql);
+ }
+ }
+
/**
* Drop table t_address in MySQL.
*
diff --git
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/repository/OrderItemRepository.java
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/repository/OrderItemRepository.java
index 02346261536..eb5859e035b 100644
---
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/repository/OrderItemRepository.java
+++
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/repository/OrderItemRepository.java
@@ -118,6 +118,23 @@ public final class OrderItemRepository {
}
}
+ /**
+ * Create Iceberg table in HiveServer2.
+ * Hive does not support `AUTO_INCREMENT`,
+ * refer to <a
href="https://issues.apache.org/jira/browse/HIVE-6905">HIVE-6905</a>.
+ *
+ * @throws SQLException SQL exception
+ */
+ public void createIcebergTableInHiveServer2() throws SQLException {
+ String sql = "CREATE TABLE IF NOT EXISTS t_order_item (order_item_id
BIGINT NOT NULL,order_id BIGINT NOT NULL,user_id INT NOT NULL,phone
string,status string, "
+ + "PRIMARY KEY (order_item_id) disable novalidate) STORED BY
ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2')";
+ try (
+ Connection connection = dataSource.getConnection();
+ Statement statement = connection.createStatement()) {
+ statement.executeUpdate(sql);
+ }
+ }
+
/**
* drop table in MySQL.
*
diff --git
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/repository/OrderRepository.java
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/repository/OrderRepository.java
index 42c9e22adc1..0e6c661c9b2 100644
---
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/repository/OrderRepository.java
+++
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/repository/OrderRepository.java
@@ -114,6 +114,23 @@ public final class OrderRepository {
}
}
+ /**
+ * Create Iceberg table in HiveServer2.
+ * Hive does not support `AUTO_INCREMENT`,
+ * refer to <a
href="https://issues.apache.org/jira/browse/HIVE-6905">HIVE-6905</a>.
+ *
+ * @throws SQLException SQL exception
+ */
+ public void createIcebergTableInHiveServer2() throws SQLException {
+ String sql = "CREATE TABLE IF NOT EXISTS t_order (order_id BIGINT NOT
NULL, order_type INT, user_id INT NOT NULL, address_id BIGINT NOT NULL,status
string, "
+ + "PRIMARY KEY (order_id) disable novalidate) STORED BY
ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2')";
+ try (
+ Connection connection = dataSource.getConnection();
+ Statement statement = connection.createStatement()) {
+ statement.executeUpdate(sql);
+ }
+ }
+
/**
* Drop table in MySQL.
*
diff --git
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/MySQLTest.java
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/MySQLTest.java
index 0a415441283..15c79e4b054 100644
---
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/MySQLTest.java
+++
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/MySQLTest.java
@@ -57,7 +57,7 @@ class MySQLTest {
@SuppressWarnings("resource")
@Container
- private final GenericContainer<?> container = new
GenericContainer<>("mysql:9.4.0-oraclelinux9")
+ private final GenericContainer<?> container = new
GenericContainer<>("mysql:9.5.0-oraclelinux9")
.withEnv("MYSQL_ROOT_PASSWORD", password)
.withExposedPorts(3306);
diff --git
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/PrestoTest.java
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/PrestoTest.java
index a75c8059e2f..fa0073e8b07 100644
---
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/PrestoTest.java
+++
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/PrestoTest.java
@@ -59,7 +59,7 @@ class PrestoTest {
private String baseJdbcUrl;
@Container
- private final GenericContainer<?> container = new
GenericContainer<>("prestodb/presto:0.292")
+ private final GenericContainer<?> container = new
GenericContainer<>("prestodb/presto:0.296")
.withExposedPorts(8080)
.withCopyFileToContainer(
MountableFile.forHostPath(Paths.get("src/test/resources/test-native/properties/presto-iceberg.properties").toAbsolutePath()),
diff --git
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/SQLServerTest.java
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/SQLServerTest.java
index 8fa8d6ebde0..512049999bd 100644
---
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/SQLServerTest.java
+++
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/SQLServerTest.java
@@ -22,12 +22,15 @@ import com.zaxxer.hikari.HikariDataSource;
import org.apache.shardingsphere.test.natived.commons.TestShardingService;
import org.apache.shardingsphere.test.natived.commons.util.ResourceUtils;
import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledInNativeImage;
import org.testcontainers.jdbc.ContainerDatabaseDriver;
import javax.sql.DataSource;
import java.sql.SQLException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
@EnabledInNativeImage
class SQLServerTest {
@@ -36,6 +39,15 @@ class SQLServerTest {
private TestShardingService testShardingService;
+ /**
+ * Related to <a
href="https://github.com/testcontainers/testcontainers-java/issues/3079">testcontainers/testcontainers-java#3079</a>
+ * and {@link com.microsoft.sqlserver.jdbc.SQLServerConnection}.
+ */
+ @BeforeEach
+ void beforeEach() {
+
Logger.getLogger("com.microsoft.sqlserver.jdbc.internals.SQLServerConnection").setLevel(Level.SEVERE);
+ }
+
@AfterEach
void afterEach() throws SQLException {
ResourceUtils.closeJdbcDataSource(logicDataSource);
diff --git
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/hive/IcebergTest.java
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/hive/IcebergTest.java
index 409e90d4549..af329f35d8a 100644
---
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/hive/IcebergTest.java
+++
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/hive/IcebergTest.java
@@ -36,7 +36,6 @@ import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.time.Duration;
-import java.util.stream.Stream;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
@@ -87,6 +86,9 @@ class IcebergTest {
}
private void initEnvironment() throws SQLException {
+
testShardingService.getOrderRepository().createIcebergTableInHiveServer2();
+
testShardingService.getOrderItemRepository().createIcebergTableInHiveServer2();
+
testShardingService.getAddressRepository().createIcebergTableInHiveServer2();
testShardingService.getOrderRepository().truncateTable();
testShardingService.getOrderItemRepository().truncateTable();
testShardingService.getAddressRepository().truncateTable();
@@ -104,7 +106,6 @@ class IcebergTest {
statement.execute("CREATE DATABASE demo_ds_1");
statement.execute("CREATE DATABASE demo_ds_2");
}
- Stream.of("demo_ds_0", "demo_ds_1",
"demo_ds_2").parallel().forEach(this::initTable);
HikariConfig config = new HikariConfig();
config.setDriverClassName("org.apache.shardingsphere.driver.ShardingSphereDriver");
config.setJdbcUrl("jdbc:shardingsphere:classpath:test-native/yaml/jdbc/databases/hive/iceberg.yaml?placeholder-type=system_props");
@@ -113,28 +114,4 @@ class IcebergTest {
System.setProperty(systemPropKeyPrefix + "ds2.jdbc-url", jdbcUrlPrefix
+ "demo_ds_2");
return new HikariDataSource(config);
}
-
- /**
- * TODO `shardingsphere-parser-sql-engine-hive` module does not support
`set`, `create table` statements yet,
- * we always need to execute the following Hive Session-level SQL in the
current {@link javax.sql.DataSource}.
- * Hive does not support `AUTO_INCREMENT`,
- * refer to <a
href="https://issues.apache.org/jira/browse/HIVE-6905">HIVE-6905</a>.
- *
- * @param databaseName database name
- * @throws RuntimeException SQL exception
- */
- private void initTable(final String databaseName) {
- try (
- Connection connection =
DriverManager.getConnection(jdbcUrlPrefix + databaseName);
- Statement statement = connection.createStatement()) {
- statement.execute("CREATE TABLE IF NOT EXISTS t_order (order_id
BIGINT NOT NULL,order_type INT,user_id INT NOT NULL,address_id BIGINT NOT
NULL,status string,"
- + "PRIMARY KEY (order_id) disable novalidate) STORED BY
ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2')");
- statement.execute("CREATE TABLE IF NOT EXISTS t_order_item
(order_item_id BIGINT NOT NULL,order_id BIGINT NOT NULL,user_id INT NOT
NULL,phone string,status string,"
- + "PRIMARY KEY (order_item_id) disable novalidate) STORED
BY ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2')");
- statement.execute("CREATE TABLE IF NOT EXISTS t_address
(address_id BIGINT NOT NULL,address_name string NOT NULL,"
- + "PRIMARY KEY (address_id) disable novalidate) STORED BY
ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2')");
- } catch (final SQLException exception) {
- throw new RuntimeException(exception);
- }
- }
}
diff --git
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/hive/SystemSchemasTest.java
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/hive/SystemSchemasTest.java
index d591703cfee..db9bbcfdd28 100644
---
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/hive/SystemSchemasTest.java
+++
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/hive/SystemSchemasTest.java
@@ -40,7 +40,6 @@ import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.time.Duration;
-import java.util.stream.Stream;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
@@ -56,7 +55,7 @@ class SystemSchemasTest {
@Container
@AutoClose
- private final GenericContainer<?> postgres = new
GenericContainer<>("postgres:17.5-bookworm")
+ private final GenericContainer<?> postgres = new
GenericContainer<>("postgres:18.1-trixie")
.withEnv("POSTGRES_PASSWORD", "example")
.withNetwork(network)
.withNetworkAliases("some-postgres");
@@ -120,6 +119,9 @@ class SystemSchemasTest {
}
private void initEnvironment() throws SQLException {
+
testShardingService.getOrderRepository().createIcebergTableInHiveServer2();
+
testShardingService.getOrderItemRepository().createIcebergTableInHiveServer2();
+
testShardingService.getAddressRepository().createIcebergTableInHiveServer2();
testShardingService.getOrderRepository().truncateTable();
testShardingService.getOrderItemRepository().truncateTable();
testShardingService.getAddressRepository().truncateTable();
@@ -137,7 +139,6 @@ class SystemSchemasTest {
statement.execute("CREATE DATABASE demo_ds_1");
statement.execute("CREATE DATABASE demo_ds_2");
}
- Stream.of("demo_ds_0", "demo_ds_1",
"demo_ds_2").parallel().forEach(this::initTable);
HikariConfig config = new HikariConfig();
config.setDriverClassName("org.apache.shardingsphere.driver.ShardingSphereDriver");
config.setJdbcUrl("jdbc:shardingsphere:classpath:test-native/yaml/jdbc/databases/hive/system-schemas.yaml?placeholder-type=system_props");
@@ -146,28 +147,4 @@ class SystemSchemasTest {
System.setProperty(systemPropKeyPrefix + "ds2.jdbc-url", jdbcUrlPrefix
+ "demo_ds_2");
return new HikariDataSource(config);
}
-
- /**
- * TODO `shardingsphere-parser-sql-engine-hive` module does not support
`set`, `create table` statements yet,
- * we always need to execute the following Hive Session-level SQL in the
current {@link javax.sql.DataSource}.
- * Hive does not support `AUTO_INCREMENT`,
- * refer to <a
href="https://issues.apache.org/jira/browse/HIVE-6905">HIVE-6905</a>.
- *
- * @param databaseName database name
- * @throws RuntimeException SQL exception
- */
- private void initTable(final String databaseName) {
- try (
- Connection connection =
DriverManager.getConnection(jdbcUrlPrefix + databaseName);
- Statement statement = connection.createStatement()) {
- statement.execute("CREATE TABLE IF NOT EXISTS t_order (order_id
BIGINT NOT NULL,order_type INT,user_id INT NOT NULL,address_id BIGINT NOT
NULL,status string,"
- + "PRIMARY KEY (order_id) disable novalidate) STORED BY
ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2')");
- statement.execute("CREATE TABLE IF NOT EXISTS t_order_item
(order_item_id BIGINT NOT NULL,order_id BIGINT NOT NULL,user_id INT NOT
NULL,phone string,status string,"
- + "PRIMARY KEY (order_item_id) disable novalidate) STORED
BY ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2')");
- statement.execute("CREATE TABLE IF NOT EXISTS t_address
(address_id BIGINT NOT NULL,address_name string NOT NULL,"
- + "PRIMARY KEY (address_id) disable novalidate) STORED BY
ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2')");
- } catch (final SQLException exception) {
- throw new RuntimeException(exception);
- }
- }
}
diff --git
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/hive/ZookeeperServiceDiscoveryTest.java
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/hive/ZookeeperServiceDiscoveryTest.java
index ed8ce20e602..91538249d8b 100644
---
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/hive/ZookeeperServiceDiscoveryTest.java
+++
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/databases/hive/ZookeeperServiceDiscoveryTest.java
@@ -44,7 +44,6 @@ import java.sql.SQLException;
import java.sql.Statement;
import java.time.Duration;
import java.util.List;
-import java.util.stream.Stream;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
@@ -112,7 +111,7 @@ class ZookeeperServiceDiscoveryTest {
.dependsOn(zookeeperContainer)) {
hs2Container.start();
jdbcUrlPrefix = "jdbc:hive2://" + zookeeperContainer.getHost() +
":" + zookeeperContainer.getMappedPort(2181) + "/";
- logicDataSource =
createDataSource(hs2Container.getMappedPort(randomPortFirst));
+ logicDataSource =
createLogicDataSource(hs2Container.getMappedPort(randomPortFirst));
testShardingService = new TestShardingService(logicDataSource);
initEnvironment();
testShardingService.processSuccessInHive();
@@ -129,20 +128,24 @@ class ZookeeperServiceDiscoveryTest {
.withFixedExposedPort(randomPortSecond,
randomPortSecond)
.dependsOn(zookeeperContainer)) {
hs2Container.start();
- extracted(hs2Container.getMappedPort(randomPortSecond));
+ initRealDatabase(hs2Container.getMappedPort(randomPortSecond));
+ initEnvironment();
testShardingService.processSuccessInHive();
testShardingService.cleanEnvironment();
}
}
private void initEnvironment() throws SQLException {
+
testShardingService.getOrderRepository().createIcebergTableInHiveServer2();
+
testShardingService.getOrderItemRepository().createIcebergTableInHiveServer2();
+
testShardingService.getAddressRepository().createIcebergTableInHiveServer2();
testShardingService.getOrderRepository().truncateTable();
testShardingService.getOrderItemRepository().truncateTable();
testShardingService.getAddressRepository().truncateTable();
}
- private DataSource createDataSource(final Integer hiveServer2Port) throws
SQLException {
- extracted(hiveServer2Port);
+ private DataSource createLogicDataSource(final Integer hiveServer2Port)
throws SQLException {
+ initRealDatabase(hiveServer2Port);
HikariConfig config = new HikariConfig();
config.setDriverClassName("org.apache.shardingsphere.driver.ShardingSphereDriver");
config.setJdbcUrl("jdbc:shardingsphere:classpath:test-native/yaml/jdbc/databases/hive/zsd.yaml?placeholder-type=system_props");
@@ -152,12 +155,11 @@ class ZookeeperServiceDiscoveryTest {
return new HikariDataSource(config);
}
- private void extracted(final int hiveServer2Port) throws SQLException {
- String connectionString = zookeeperContainer.getHost() + ":" +
zookeeperContainer.getMappedPort(2181);
+ private void initRealDatabase(final int hiveServer2Port) throws
SQLException {
+ String connectString = zookeeperContainer.getHost() + ":" +
zookeeperContainer.getMappedPort(2181);
Awaitility.await().atMost(Duration.ofMinutes(2L)).ignoreExceptions().until(()
-> {
try (
- CuratorFramework client =
CuratorFrameworkFactory.builder().connectString(connectionString)
- .retryPolicy(new ExponentialBackoffRetry(1000,
3)).build()) {
+ CuratorFramework client =
CuratorFrameworkFactory.builder().connectString(connectString).retryPolicy(new
ExponentialBackoffRetry(1000, 3)).build()) {
client.start();
List<String> children =
client.getChildren().forPath("/hiveserver2");
assertThat(children.size(), is(1));
@@ -175,30 +177,5 @@ class ZookeeperServiceDiscoveryTest {
statement.execute("CREATE DATABASE demo_ds_1");
statement.execute("CREATE DATABASE demo_ds_2");
}
- Stream.of("demo_ds_0", "demo_ds_1",
"demo_ds_2").parallel().forEach(this::initTable);
- }
-
- /**
- * TODO `shardingsphere-parser-sql-engine-hive` module does not support
`set`, `create table` statements yet,
- * we always need to execute the following Hive Session-level SQL in the
current {@link javax.sql.DataSource}.
- * Hive does not support `AUTO_INCREMENT`,
- * refer to <a
href="https://issues.apache.org/jira/browse/HIVE-6905">HIVE-6905</a>.
- *
- * @param databaseName database name
- * @throws RuntimeException SQL exception
- */
- private void initTable(final String databaseName) {
- try (
- Connection connection =
DriverManager.getConnection(jdbcUrlPrefix + databaseName + jdbcUrlSuffix);
- Statement statement = connection.createStatement()) {
- statement.execute("CREATE TABLE IF NOT EXISTS t_order (order_id
BIGINT NOT NULL,order_type INT,user_id INT NOT NULL,address_id BIGINT NOT
NULL,status string,"
- + "PRIMARY KEY (order_id) disable novalidate) STORED BY
ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2')");
- statement.execute("CREATE TABLE IF NOT EXISTS t_order_item
(order_item_id BIGINT NOT NULL,order_id BIGINT NOT NULL,user_id INT NOT
NULL,phone string,status string,"
- + "PRIMARY KEY (order_item_id) disable novalidate) STORED
BY ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2')");
- statement.execute("CREATE TABLE IF NOT EXISTS t_address
(address_id BIGINT NOT NULL,address_name string NOT NULL,"
- + "PRIMARY KEY (address_id) disable novalidate) STORED BY
ICEBERG STORED AS ORC TBLPROPERTIES ('format-version' = '2')");
- } catch (final SQLException exception) {
- throw new RuntimeException(exception);
- }
}
}
diff --git
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/proxy/databases/MySQLTest.java
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/proxy/databases/MySQLTest.java
index 2c63a21fea5..bcbd4b34cbd 100644
---
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/proxy/databases/MySQLTest.java
+++
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/proxy/databases/MySQLTest.java
@@ -47,7 +47,7 @@ import java.util.Properties;
class MySQLTest {
@Container
- private final GenericContainer<?> mysqlContainer = new
GenericContainer<>("mysql:9.4.0-oraclelinux9")
+ private final GenericContainer<?> mysqlContainer = new
GenericContainer<>("mysql:9.5.0-oraclelinux9")
.withEnv("MYSQL_ROOT_PASSWORD", "yourStrongPassword123!")
.withExposedPorts(3306);
diff --git
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/proxy/databases/PostgresTest.java
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/proxy/databases/PostgresTest.java
index d6a1d6c5603..88b55c452e5 100644
---
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/proxy/databases/PostgresTest.java
+++
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/proxy/databases/PostgresTest.java
@@ -47,7 +47,7 @@ import java.util.Collections;
class PostgresTest {
@Container
- private final PostgreSQLContainer<?> postgresContainer = new
PostgreSQLContainer<>("postgres:17.5-bookworm");
+ private final PostgreSQLContainer<?> postgresContainer = new
PostgreSQLContainer<>("postgres:18.1-trixie");
private ProxyTestingServer proxyTestingServer;
diff --git
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/proxy/transactions/base/SeataTest.java
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/proxy/transactions/base/SeataTest.java
index 9c845f458ac..d81e720f173 100644
---
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/proxy/transactions/base/SeataTest.java
+++
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/proxy/transactions/base/SeataTest.java
@@ -60,7 +60,7 @@ class SeataTest {
.waitingFor(Wait.forHttp("/health").forPort(8091).forStatusCode(HttpStatus.SC_OK).forResponsePredicate("\"ok\""::equals));
@Container
- private final PostgreSQLContainer<?> postgresContainer = new
PostgreSQLContainer<>("postgres:17.5-bookworm")
+ private final PostgreSQLContainer<?> postgresContainer = new
PostgreSQLContainer<>("postgres:18.1-trixie")
.withCopyFileToContainer(
MountableFile.forHostPath(Paths.get("src/test/resources/test-native/sh/postgres.sh").toAbsolutePath()),
"/docker-entrypoint-initdb.d/postgres.sh");
diff --git a/test/native/src/test/resources/container-license-acceptance.txt
b/test/native/src/test/resources/container-license-acceptance.txt
index c0b6b2cc88e..f16eb62e9b1 100644
--- a/test/native/src/test/resources/container-license-acceptance.txt
+++ b/test/native/src/test/resources/container-license-acceptance.txt
@@ -1 +1 @@
-mcr.microsoft.com/mssql/server:2022-CU20-ubuntu-22.04
+mcr.microsoft.com/mssql/server:2025-RTM-ubuntu-22.04
diff --git
a/test/native/src/test/resources/test-native/yaml/jdbc/databases/postgresql.yaml
b/test/native/src/test/resources/test-native/yaml/jdbc/databases/postgresql.yaml
index 3400907e236..9e80d3cb718 100644
---
a/test/native/src/test/resources/test-native/yaml/jdbc/databases/postgresql.yaml
+++
b/test/native/src/test/resources/test-native/yaml/jdbc/databases/postgresql.yaml
@@ -19,15 +19,15 @@ dataSources:
ds_0:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver
- jdbcUrl: jdbc:tc:postgresql:17.5-bookworm:///demo_ds_0
+ jdbcUrl: jdbc:tc:postgresql:18.1-trixie:///demo_ds_0
ds_1:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver
- jdbcUrl: jdbc:tc:postgresql:17.5-bookworm:///demo_ds_1
+ jdbcUrl: jdbc:tc:postgresql:18.1-trixie:///demo_ds_1
ds_2:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver
- jdbcUrl: jdbc:tc:postgresql:17.5-bookworm:///demo_ds_2
+ jdbcUrl: jdbc:tc:postgresql:18.1-trixie:///demo_ds_2
rules:
- !SHARDING
diff --git
a/test/native/src/test/resources/test-native/yaml/jdbc/databases/sqlserver.yaml
b/test/native/src/test/resources/test-native/yaml/jdbc/databases/sqlserver.yaml
index ff16cdfaa9d..e46bd5909a8 100644
---
a/test/native/src/test/resources/test-native/yaml/jdbc/databases/sqlserver.yaml
+++
b/test/native/src/test/resources/test-native/yaml/jdbc/databases/sqlserver.yaml
@@ -19,15 +19,15 @@ dataSources:
ds_0:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver
- jdbcUrl:
jdbc:tc:sqlserver:2022-CU20-ubuntu-22.04://test-native-databases-mssqlserver;databaseName=demo_ds_0
+ jdbcUrl:
jdbc:tc:sqlserver:2025-RTM-ubuntu-22.04://test-native-databases-mssqlserver;databaseName=demo_ds_0
ds_1:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver
- jdbcUrl:
jdbc:tc:sqlserver:2022-CU20-ubuntu-22.04://test-native-databases-mssqlserver;databaseName=demo_ds_1
+ jdbcUrl:
jdbc:tc:sqlserver:2025-RTM-ubuntu-22.04://test-native-databases-mssqlserver;databaseName=demo_ds_1
ds_2:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver
- jdbcUrl:
jdbc:tc:sqlserver:2022-CU20-ubuntu-22.04://test-native-databases-mssqlserver;databaseName=demo_ds_2
+ jdbcUrl:
jdbc:tc:sqlserver:2025-RTM-ubuntu-22.04://test-native-databases-mssqlserver;databaseName=demo_ds_2
rules:
- !SHARDING
diff --git
a/test/native/src/test/resources/test-native/yaml/jdbc/transactions/base/seata.yaml
b/test/native/src/test/resources/test-native/yaml/jdbc/transactions/base/seata.yaml
index bb62b0128c8..315fc8d2e9c 100644
---
a/test/native/src/test/resources/test-native/yaml/jdbc/transactions/base/seata.yaml
+++
b/test/native/src/test/resources/test-native/yaml/jdbc/transactions/base/seata.yaml
@@ -19,15 +19,15 @@ dataSources:
ds_0:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver
- jdbcUrl:
jdbc:tc:postgresql:17.5-bookworm://test-native-transactions-base/demo_ds_0?TC_INITSCRIPT=test-native/sql/seata-script-client-at-postgresql.sql
+ jdbcUrl:
jdbc:tc:postgresql:18.1-trixie:///demo_ds_0?TC_INITSCRIPT=test-native/sql/seata-script-client-at-postgresql.sql
ds_1:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver
- jdbcUrl:
jdbc:tc:postgresql:17.5-bookworm://test-native-transactions-base/demo_ds_1?TC_INITSCRIPT=test-native/sql/seata-script-client-at-postgresql.sql
+ jdbcUrl:
jdbc:tc:postgresql:18.1-trixie:///demo_ds_1?TC_INITSCRIPT=test-native/sql/seata-script-client-at-postgresql.sql
ds_2:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.testcontainers.jdbc.ContainerDatabaseDriver
- jdbcUrl:
jdbc:tc:postgresql:17.5-bookworm://test-native-transactions-base/demo_ds_2?TC_INITSCRIPT=test-native/sql/seata-script-client-at-postgresql.sql
+ jdbcUrl:
jdbc:tc:postgresql:18.1-trixie:///demo_ds_2?TC_INITSCRIPT=test-native/sql/seata-script-client-at-postgresql.sql
rules:
- !SHARDING