linghengqian opened a new pull request, #31451:
URL: https://github.com/apache/shardingsphere/pull/31451
For #29052.
Changes proposed in this pull request:
- Add GraalVM Reachability Metadata and corresponding nativeTest for
ClickHouse integration over http.
- The SPIs related to ClickHouse are further implemented as follows.
-
`org.apache.shardingsphere.infra.database.core.connector.ConnectionPropertiesParser`
-
`org.apache.shardingsphere.infra.database.core.metadata.database.DialectDatabaseMetaData`
- Completely prevent
`org.apache.shardingsphere.infra.database.clickhouse.type.ClickHouseDatabaseType`
from continuing to use the MySQL dialect.
- To work around the issue of `org.testcontainers:clickhouse` using the
outdated `yandex/clickhouse-server` Docker Image, a temporary class
`org.apache.shardingsphere.test.natived.jdbc.commons.testcontainers.ClickHouseProvider`
is introduced to use String `shardingsphere0clickhouse` as the `databaseType`
of testcontainers-java.
- This PR uses the following SQL that is not supported in Optional module
`org.apache.shardingsphere:shardingsphere-parser-sql-clickhouse`.
```sql
create table IF NOT EXISTS t_order(
order_id Int64 NOT NULL DEFAULT rand(),
order_type Int32,
user_id Int32 NOT NULL,
address_id Int64 NOT NULL,
status String,
) engine = MergeTree
primary key (order_id)
order by(order_id);
```
- This resulted in the following exception.
```shell
java.sql.SQLException: Unknown exception.
More details: You have an error in your SQL syntax: no viable alternative at
input 'create'
at
org.apache.shardingsphere.infra.exception.core.external.sql.ShardingSphereSQLException.toSQLException(ShardingSphereSQLException.java:74)
at
org.apache.shardingsphere.infra.exception.dialect.SQLExceptionTransformEngine.toSQLException(SQLExceptionTransformEngine.java:68)
at
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement.executeUpdate(ShardingSphereStatement.java:181)
at
com.zaxxer.hikari.pool.ProxyStatement.executeUpdate(ProxyStatement.java:119)
at
com.zaxxer.hikari.pool.HikariProxyStatement.executeUpdate(HikariProxyStatement.java)
at
org.apache.shardingsphere.test.natived.jdbc.commons.repository.OrderRepository.createTableInClickHouse(OrderRepository.java:120)
at
org.apache.shardingsphere.test.natived.jdbc.databases.ClickHouseTest.initEnvironment(ClickHouseTest.java:48)
at
org.apache.shardingsphere.test.natived.jdbc.databases.ClickHouseTest.assertShardingInLocalTransactions(ClickHouseTest.java:42)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by:
org.apache.shardingsphere.infra.exception.dialect.exception.syntax.sql.DialectSQLParsingException:
You have an error in your SQL syntax: no viable alternative at input 'create'
at
org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine.parse(ShardingSphereSQLParserEngine.java:60)
at
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement.createQueryContext(ShardingSphereStatement.java:398)
at
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement.executeUpdate0(ShardingSphereStatement.java:243)
at
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement.executeUpdate(ShardingSphereStatement.java:176)
... 8 more
```
- **This PR has not yet generated the relevant GraalVM Reachability
Metadata.**
---
Before committing this PR, I'm sure that I have checked the following
options:
- [x] My code follows the [code of
conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/)
of this project.
- [x] I have self-reviewed the commit code.
- [x] I have (or in comment I request) added corresponding labels for the
pull request.
- [x] I have passed maven check locally : `./mvnw clean install -B -T1C
-Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
- [ ] I have made corresponding changes to the documentation.
- [x] I have added corresponding unit tests for my changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]