This is an automated email from the ASF dual-hosted git repository.
terrymanu 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 22f905802a7 Supports the use of local transactions for Presto in
ShardingSphere JDBC (#38941)
22f905802a7 is described below
commit 22f905802a74573398b57b431bd0b4b261bb1f79
Author: Hengqian Ling <[email protected]>
AuthorDate: Sun Jun 28 15:11:30 2026 +0800
Supports the use of local transactions for Presto in ShardingSphere JDBC
(#38941)
---
RELEASE-NOTES.md | 1 +
.../optional-plugins/presto/_index.cn.md | 7 +++--
.../optional-plugins/presto/_index.en.md | 7 +++--
.../reachability-metadata.json | 30 ++++++++++++----------
.../reachability-metadata.json | 7 -----
.../test/natived/commons/TestShardingService.java | 4 +--
.../test/natived/jdbc/databases/PrestoTest.java | 2 +-
7 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 23d376ea2b4..d9e4224aa3f 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -57,6 +57,7 @@
1. JDBC: Support setMaxRows and getMaxRows method in jdbc when not execute SQL
- [#38337](https://github.com/apache/shardingsphere/pull/38337)
1. JDBC: Support safe close statement manager -
[#38473](https://github.com/apache/shardingsphere/pull/38473)
1. JDBC: Bump the ClickHouse JDBC Driver used by optional modules to version
`0.9.8` - [#38878](https://github.com/apache/shardingsphere/pull/38878)
+1. JDBC: Supports the use of local transactions for Presto in ShardingSphere
JDBC- [#38941](https://github.com/apache/shardingsphere/pull/38941)
1. Proxy: Support non column projection for MySQL prepared statement in Proxy
- [#38507](https://github.com/apache/shardingsphere/pull/38507)
1. Proxy: Support driverClassName config in proxy storage unit to solve mysql
and mariadb jdbc url conflict -
[#38582](https://github.com/apache/shardingsphere/pull/38582)
1. Proxy: Support Firebird prepared statement cache reuse for held connections
- [#38644](https://github.com/apache/shardingsphere/pull/38644)
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 38cde8d1902..07df3b5b402 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
@@ -207,8 +207,11 @@ ShardingSphere JDBC DataSource 尚不支持执行 Presto 的 `create
table` 和
### 事务限制
-Presto 不支持 ShardingSphere 集成级别的本地事务,XA 事务或 Seata 的 AT 模式事务。
-Presto 自身的事务支持存在问题,参考 https://github.com/prestodb/presto/issues/25204 。
+Presto 支持 ShardingSphere 集成级别的本地事务,但不支持 XA 事务或 Seata 的 AT 模式事务。
+
+对 XA 事务的处理,应在 https://github.com/prestodb/presto 提交包含对应实现的 PR。
+
+对 Seata 的 AT 模式事务的处理,则应在 https://github.com/apache/incubator-seata 提交包含对应实现的
PR。
### 连接器限制
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 6209313ab7c..81e44b7fd4c 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
@@ -207,8 +207,11 @@ ShardingSphere JDBC DataSource does not yet support the
execution of Presto's `c
### Transaction Limitations
-Presto does not support local transactions, XA transactions, or Seata's AT
mode transactions at the ShardingSphere integration level.
-There are bugs with Presto's own transaction support, see
https://github.com/prestodb/presto/issues/25204 .
+Presto supports ShardingSphere integration-level local transactions, but not
XA transactions or Seata's AT mode transactions.
+
+For XA transaction, a PR containing the corresponding implementation should be
submitted at https://github.com/prestodb/presto .
+
+For Seata's AT mode transactions, a PR containing the corresponding
implementation should be submitted at https://github.com/apache/incubator-seata
.
### Connector Limitations
diff --git
a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reachability-metadata.json
b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reachability-metadata.json
index 20c916512a5..4b0f04016c9 100644
---
a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reachability-metadata.json
+++
b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reachability-metadata.json
@@ -626,7 +626,7 @@
},
{
"condition": {
- "typeReached":
"org.apache.shardingsphere.infra.database.DatabaseTypeEngine"
+ "typeReached":
"org.apache.shardingsphere.database.connector.mysql.metadata.identifier.MySQLIdentifierCaseRuleProvider"
},
"type": "java.sql.Statement[]"
},
@@ -1460,12 +1460,6 @@
},
"type":
"org.apache.shardingsphere.database.connector.h2.type.H2DatabaseType"
},
- {
- "condition": {
- "typeReached":
"org.apache.shardingsphere.infra.database.DatabaseTypeEngine"
- },
- "type":
"org.apache.shardingsphere.database.connector.hive.jdbcurl.HiveJdbcUrlFetcher"
- },
{
"condition": {
"typeReached":
"org.apache.shardingsphere.database.connector.core.metadata.data.loader.MetaDataLoader"
@@ -1730,7 +1724,7 @@
},
{
"condition": {
- "typeReached":
"org.apache.shardingsphere.infra.database.DatabaseTypeEngine"
+ "typeReached":
"org.apache.shardingsphere.database.connector.mysql.metadata.identifier.MySQLIdentifierCaseRuleProvider"
},
"type": "org.apache.shardingsphere.driver.ShardingSphereDriver"
},
@@ -5515,6 +5509,20 @@
}
]
},
+ {
+ "condition": {
+ "typeReached":
"org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement"
+ },
+ "type":
"org.apache.shardingsphere.sql.parser.engine.presto.visitor.statement.type.PrestoDMLStatementVisitor",
+ "methods": [
+ {
+ "name": "<init>",
+ "parameterTypes": [
+
"org.apache.shardingsphere.database.connector.core.type.DatabaseType"
+ ]
+ }
+ ]
+ },
{
"condition": {
"typeReached":
"org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement"
@@ -6271,12 +6279,6 @@
},
"glob":
"META-INF/services/org.apache.shardingsphere.database.connector.core.checker.DialectDatabasePrivilegeChecker"
},
- {
- "condition": {
- "typeReached":
"org.apache.shardingsphere.infra.database.DatabaseTypeEngine"
- },
- "glob":
"META-INF/services/org.apache.shardingsphere.database.connector.core.jdbcurl.DialectJdbcUrlFetcher"
- },
{
"condition": {
"typeReached":
"org.apache.shardingsphere.database.connector.core.metadata.data.loader.MetaDataLoader"
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 ce916cc4e91..e3aa509a223 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
@@ -682,13 +682,6 @@
"type":
"org.apache.shardingsphere.sql.parser.engine.presto.parser.PrestoParser",
"allPublicConstructors": true
},
- {
- "condition": {
- "typeReached":
"org.apache.shardingsphere.sql.parser.engine.core.database.visitor.SQLStatementVisitorFactory"
- },
- "type":
"org.apache.shardingsphere.sql.parser.engine.presto.visitor.statement.type.PrestoDMLStatementVisitor",
- "allPublicConstructors": true
- },
{
"condition": {
"typeReached":
"org.apache.shardingsphere.sql.parser.engine.core.SQLParserFactory"
diff --git
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/TestShardingService.java
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/TestShardingService.java
index 15790020f8f..27aa2452952 100644
---
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/TestShardingService.java
+++
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/TestShardingService.java
@@ -106,11 +106,9 @@ public final class TestShardingService {
/**
* Process success in Presto Iceberg Connector or Doris FE.
- * There are bugs with Presto's transaction support, see <a
href="https://github.com/prestodb/presto/issues/25204">prestodb/presto#25204</a>
.
- * Can't execute {@code
orderItemRepository.assertRollbackWithTransactions();} here.
* There is a bug with Doris FE's support for transaction rollback.
* Statements that have been successfully executed in a single transaction
unit will not be rolled back.
- * Refer to <a
href="https://doris.apache.org/docs/3.0/data-operate/transaction#failed-statements-within-a-transaction">Failed
Statements Within a Transaction</a> .
+ * Refer to <a
href="https://doris.apache.org/docs/4.x/data-operate/transaction#failed-statements-in-a-transaction">Failed
Statements in a Transaction</a> .
*
* @throws SQLException SQL exception
*/
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 5e79fc16297..67f6d977f8a 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
@@ -86,7 +86,7 @@ class PrestoTest {
baseJdbcUrl = "jdbc:presto://localhost:" +
container.getMappedPort(8080) + "/iceberg";
logicDataSource = createDataSource();
TestShardingService testShardingService = new
TestShardingService(logicDataSource);
- testShardingService.processSuccessWithoutTransactions();
+ testShardingService.processSuccess();
testShardingService.cleanEnvironment();
}