Skip to content

Commit

Permalink
Add GraalVM Reachability Metadata and corresponding nativeTest for Pr…
Browse files Browse the repository at this point in the history
…esto
  • Loading branch information
linghengqian committed Jan 22, 2025
1 parent 1a4088f commit 1440b65
Show file tree
Hide file tree
Showing 19 changed files with 636 additions and 36 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
1. SQL Binder: Support select aggregation function sql bind in projection and having - [#34379](https://github.com/apache/shardingsphere/pull/34379)
1. Proxy Native: Add GraalVM Reachability Metadata and corresponding nativeTest for Firebird - [#34307](https://github.com/apache/shardingsphere/pull/34307)
1. Infra: Support for connecting to Presto's Memory Connector in ShardingSphere config - [#34432](https://github.com/apache/shardingsphere/pull/34432)
1. Proxy Native: Add GraalVM Reachability Metadata and corresponding nativeTest for Firebird - [#34429](https://github.com/apache/shardingsphere/pull/34429)

### Bug Fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,6 @@ ShardingSphere 的单元测试仅使用 Maven 模块 `io.github.linghengqian:hiv
9. 由于 https://github.com/apache/doris/issues/9426 的影响,当通过 Shardinghere JDBC 连接至 Apache Doris FE,
用户需自行提供 `apache/doris` 集成模块相关的 GraalVM Reachability Metadata。

10. 由于 https://github.com/prestodb/presto/issues/23226 的影响,当通过 Shardinghere JDBC 连接至 Presto Server,
用户需自行提供 `com.facebook.presto:presto-jdbc` 和 `prestodb/presto` 集成模块相关的 GraalVM Reachability Metadata。

## 贡献 GraalVM Reachability Metadata

ShardingSphere 对在 GraalVM Native Image 下的可用性的验证,是通过 GraalVM Native Build Tools 的 Maven Plugin 子项目来完成的。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,6 @@ the Oracle JDBC Driver corresponding to the `com.oracle.database.jdbc:ojdbc8` Ma
9. Due to https://github.com/apache/doris/issues/9426, when connecting to Apache Doris FE via Shardinghere JDBC,
users need to provide GraalVM Reachability Metadata related to the `apache/doris` integration module.

10. Due to https://github.com/prestodb/presto/issues/23226, when connecting to Presto Server via Shardinghere JDBC,
users need to provide GraalVM Reachability Metadata related to the `com.facebook.presto:presto-jdbc` and `prestodb/presto` integration module.

## Contribute GraalVM Reachability Metadata

The verification of ShardingSphere's availability under GraalVM Native Image is completed through the Maven Plugin subproject
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.guava.reflect.Reflection"},
"interfaces":["java.lang.reflect.TypeVariable"]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
[
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.client.StatementClientV1"},
"name":"com.facebook.presto.jdbc.internal.client.ClientTypeSignature",
"methods":[{"name":"<init>","parameterTypes":["java.lang.String","java.util.List","java.util.List","java.util.List"] }]
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.jackson.databind.ObjectReader"},
"name":"com.facebook.presto.jdbc.internal.client.ClientTypeSignature",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true,
"queryAllDeclaredConstructors":true
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.jackson.databind.deser.DefaultDeserializationContext"},
"name":"com.facebook.presto.jdbc.internal.client.ClientTypeSignatureParameter$ClientTypeSignatureParameterDeserializer",
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.client.StatementClientV1"},
"name":"com.facebook.presto.jdbc.internal.client.Column",
"methods":[{"name":"<init>","parameterTypes":["java.lang.String","java.lang.String","com.facebook.presto.jdbc.internal.client.ClientTypeSignature"] }]
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.jackson.databind.ObjectReader"},
"name":"com.facebook.presto.jdbc.internal.client.Column",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true,
"queryAllDeclaredConstructors":true
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.jackson.databind.ObjectReader"},
"name":"com.facebook.presto.jdbc.internal.client.ErrorLocation",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true,
"queryAllDeclaredConstructors":true
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.jackson.databind.ObjectReader"},
"name":"com.facebook.presto.jdbc.internal.client.FailureInfo",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true,
"queryAllDeclaredConstructors":true,
"allPublicConstructors": true
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.jackson.databind.ObjectReader"},
"name":"com.facebook.presto.jdbc.internal.client.QueryData",
"queryAllDeclaredMethods":true
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.jackson.databind.ObjectReader"},
"name":"com.facebook.presto.jdbc.internal.client.QueryError",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true,
"queryAllDeclaredConstructors":true,
"allPublicConstructors": true
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.jackson.databind.ObjectReader"},
"name":"com.facebook.presto.jdbc.internal.client.QueryResults",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true,
"queryAllDeclaredConstructors":true,
"methods":[{"name":"<init>","parameterTypes":["java.lang.String","java.net.URI","java.net.URI","java.net.URI","java.util.List","java.util.List","java.util.List","com.facebook.presto.jdbc.internal.client.StatementStats","com.facebook.presto.jdbc.internal.client.QueryError","java.util.List","java.lang.String","java.lang.Long"] }]
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.jackson.databind.ObjectReader"},
"name":"com.facebook.presto.jdbc.internal.client.QueryStatusInfo",
"queryAllDeclaredMethods":true
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.PrestoPreparedStatement"},
"name":"com.facebook.presto.jdbc.internal.client.StageStats",
"methods":[{"name":"<init>","parameterTypes":["java.lang.String","java.lang.String","boolean","int","int","int","int","int","long","long","long","long","java.util.List"] }]
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.PrestoResultSet$ResultsPageIterator"},
"name":"com.facebook.presto.jdbc.internal.client.StageStats",
"methods":[{"name":"<init>","parameterTypes":["java.lang.String","java.lang.String","boolean","int","int","int","int","int","long","long","long","long","java.util.List"] }]
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.PrestoStatement"},
"name":"com.facebook.presto.jdbc.internal.client.StageStats",
"methods":[{"name":"<init>","parameterTypes":["java.lang.String","java.lang.String","boolean","int","int","int","int","int","long","long","long","long","java.util.List"] }]
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.jackson.databind.ObjectReader"},
"name":"com.facebook.presto.jdbc.internal.client.StageStats",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true,
"queryAllDeclaredConstructors":true
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.jackson.databind.ObjectReader"},
"name":"com.facebook.presto.jdbc.internal.client.StatementStats",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true,
"queryAllDeclaredConstructors":true,
"methods":[{"name":"<init>","parameterTypes":["java.lang.String","boolean","boolean","boolean","int","int","int","int","int","long","long","long","long","long","long","long","long","long","long","long","com.facebook.presto.jdbc.internal.client.StageStats","com.facebook.presto.jdbc.internal.common.RuntimeStats"] }]
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.jackson.databind.deser.std.MapDeserializer"},
"name":"com.facebook.presto.jdbc.internal.common.RuntimeMetric",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true,
"queryAllDeclaredConstructors":true,
"methods":[{"name":"<init>","parameterTypes":["java.lang.String","com.facebook.presto.jdbc.internal.common.RuntimeUnit","long","long","long","long"] }]
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.jackson.databind.ObjectReader"},
"name":"com.facebook.presto.jdbc.internal.common.RuntimeStats",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true,
"queryAllDeclaredConstructors":true
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.jackson.databind.introspect.AnnotatedConstructor"},
"name":"com.facebook.presto.jdbc.internal.common.RuntimeStats",
"methods":[{"name":"<init>","parameterTypes":["java.util.Map"] }]
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.jackson.databind.deser.std.MapDeserializer"},
"name":"com.facebook.presto.jdbc.internal.common.RuntimeUnit",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.jackson.databind.introspect.JacksonAnnotationIntrospector"},
"name":"com.facebook.presto.jdbc.internal.common.RuntimeUnit",
"allDeclaredFields":true
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.jackson.databind.util.ClassUtil"},
"name":"com.facebook.presto.jdbc.internal.common.RuntimeUnit",
"allDeclaredFields":true
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.jackson.databind.ObjectMapper"},
"name":"com.facebook.presto.jdbc.internal.common.type.ParameterKind",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.jackson.databind.introspect.AnnotatedMethod"},
"name":"com.facebook.presto.jdbc.internal.common.type.ParameterKind",
"methods":[{"name":"fromJsonValue","parameterTypes":["java.lang.String"] }]
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.guava.reflect.Types$TypeVariableInvocationHandler"},
"name":"com.facebook.presto.jdbc.internal.guava.reflect.Types$TypeVariableImpl",
"queryAllPublicMethods":true
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.jackson.databind.ext.Java7Handlers"},
"name":"com.facebook.presto.jdbc.internal.jackson.databind.ext.Java7HandlersImpl",
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.jackson.databind.ext.Java7Support"},
"name":"com.facebook.presto.jdbc.internal.jackson.databind.ext.Java7SupportImpl",
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.com.facebook.airlift.json.ObjectMapperProvider"},
"name":"com.facebook.presto.jdbc.internal.joda.time.DateTime"
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.jackson.databind.ObjectReader"},
"name":"com.facebook.presto.jdbc.internal.spi.PrestoWarning",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true,
"queryAllDeclaredConstructors":true
},
{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.jackson.databind.ObjectReader"},
"name":"com.facebook.presto.jdbc.internal.spi.WarningCode",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true,
"queryAllDeclaredConstructors":true
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"resources":{
"includes":[{
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.common.type.TimeZoneKey"},
"pattern":"\\Qcom/facebook/presto/jdbc/internal/common/type/zone-index.properties\\E"
}, {
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.joda.time.tz.ZoneInfoProvider"},
"pattern":"\\Qcom/facebook/presto/jdbc/internal/joda/time/tz/data/ZoneInfoMap\\E"
}, {
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.joda.time.tz.ZoneInfoProvider"},
"pattern":"\\Qcom/facebook/presto/jdbc/internal/joda/time/tz/data/Asia/Shanghai\\E"
}, {
"condition":{"typeReachable":"com.facebook.presto.jdbc.internal.joda.time.tz.ZoneInfoProvider"},
"pattern":"\\Qcom/facebook/presto/jdbc/internal/joda/time/tz/data/Etc/UTC\\E"
}]},
"bundles":[]
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"name":"[Lcom.github.dockerjava.api.model.VolumesFrom;"
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.connection.DriverDatabaseConnectionManager$$Lambda/0x00007fce2fcdb068"},
"condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.connection.DriverDatabaseConnectionManager$$Lambda/0x00007f1cc7ce3230"},
"name":"[Lcom.zaxxer.hikari.util.ConcurrentBag$IConcurrentBagEntry;"
},
{
Expand Down Expand Up @@ -55,6 +55,10 @@
"condition":{"typeReachable":"org.apache.shardingsphere.infra.database.postgresql.metadata.data.loader.PostgreSQLMetaDataLoader"},
"name":"[Lcom.zaxxer.hikari.util.ConcurrentBag$IConcurrentBagEntry;"
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.infra.database.presto.metadata.data.loader.PrestoMetaDataLoader"},
"name":"[Lcom.zaxxer.hikari.util.ConcurrentBag$IConcurrentBagEntry;"
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.infra.database.sqlserver.metadata.data.loader.SQLServerMetaDataLoader"},
"name":"[Lcom.zaxxer.hikari.util.ConcurrentBag$IConcurrentBagEntry;"
Expand Down Expand Up @@ -382,7 +386,7 @@
"allDeclaredFields":true
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.mode.persist.service.unified.ComputeNodePersistService"},
"condition":{"typeReachable":"org.apache.shardingsphere.mode.state.node.ComputeNodePersistService"},
"name":"java.lang.Object",
"allDeclaredFields":true
},
Expand Down Expand Up @@ -1594,6 +1598,22 @@
"condition":{"typeReachable":"org.apache.shardingsphere.infra.props.TypedPropertyValue"},
"name":"org.apache.shardingsphere.infra.database.postgresql.type.PostgreSQLDatabaseType"
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor"},
"name":"org.apache.shardingsphere.infra.database.presto.connector.PrestoConnectionPropertiesParser"
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.infra.database.core.metadata.data.loader.MetaDataLoader"},
"name":"org.apache.shardingsphere.infra.database.presto.metadata.data.loader.PrestoMetaDataLoader"
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.infra.database.core.type.DatabaseTypeRegistry"},
"name":"org.apache.shardingsphere.infra.database.presto.metadata.database.PrestoDatabaseMetaData"
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.infra.props.TypedPropertyValue"},
"name":"org.apache.shardingsphere.infra.database.presto.type.PrestoDatabaseType"
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor"},
"name":"org.apache.shardingsphere.infra.database.sql92.connector.SQL92ConnectionPropertiesParser"
Expand Down Expand Up @@ -1703,18 +1723,18 @@
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.mode.persist.service.unified.ComputeNodePersistService"},
"condition":{"typeReachable":"org.apache.shardingsphere.mode.state.node.ComputeNodePersistService"},
"name":"org.apache.shardingsphere.infra.instance.yaml.YamlComputeNodeData",
"allDeclaredFields":true,
"queryAllPublicMethods":true,
"methods":[{"name":"<init>","parameterTypes":[] }, {"name":"getAttribute","parameterTypes":[] }, {"name":"getDatabaseName","parameterTypes":[] }, {"name":"getVersion","parameterTypes":[] }, {"name":"setAttribute","parameterTypes":["java.lang.String"] }, {"name":"setDatabaseName","parameterTypes":["java.lang.String"] }, {"name":"setVersion","parameterTypes":["java.lang.String"] }]
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.mode.persist.service.unified.ComputeNodePersistService"},
"condition":{"typeReachable":"org.apache.shardingsphere.mode.state.node.ComputeNodePersistService"},
"name":"org.apache.shardingsphere.infra.instance.yaml.YamlComputeNodeDataBeanInfo"
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.mode.persist.service.unified.ComputeNodePersistService"},
"condition":{"typeReachable":"org.apache.shardingsphere.mode.state.node.ComputeNodePersistService"},
"name":"org.apache.shardingsphere.infra.instance.yaml.YamlComputeNodeDataCustomizer"
},
{
Expand Down Expand Up @@ -1744,7 +1764,7 @@
"queryAllPublicMethods":true
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.mode.persist.service.unified.ComputeNodePersistService"},
"condition":{"typeReachable":"org.apache.shardingsphere.mode.state.node.ComputeNodePersistService"},
"name":"org.apache.shardingsphere.infra.util.yaml.YamlConfiguration",
"queryAllPublicMethods":true
},
Expand Down Expand Up @@ -3386,6 +3406,30 @@
"name":"org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.type.PostgreSQLDMLStatementVisitor",
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement"},
"name":"org.apache.shardingsphere.sql.parser.presto.parser.PrestoLexer",
"methods":[{"name":"<init>","parameterTypes":["org.antlr.v4.runtime.CharStream"] }]
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement"},
"name":"org.apache.shardingsphere.sql.parser.presto.parser.PrestoParser",
"methods":[{"name":"<init>","parameterTypes":["org.antlr.v4.runtime.TokenStream"] }]
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.proxy.backend.handler.ProxySQLComQueryParser"},
"name":"org.apache.shardingsphere.sql.parser.presto.parser.PrestoParserFacade"
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.core.database.visitor.SQLStatementVisitorFactory"},
"name":"org.apache.shardingsphere.sql.parser.presto.visitor.statement.PrestoStatementVisitorFacade",
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement"},
"name":"org.apache.shardingsphere.sql.parser.presto.visitor.statement.type.PrestoDDLStatementVisitor",
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.proxy.backend.handler.ProxySQLComQueryParser"},
"name":"org.apache.shardingsphere.sql.parser.sql92.parser.SQL92ParserFacade"
Expand Down Expand Up @@ -3589,6 +3633,16 @@
"name":"org.apache.shardingsphere.sql.parser.statement.postgresql.dml.PostgreSQLSelectStatement",
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement"},
"name":"org.apache.shardingsphere.sql.parser.statement.presto.dml.PrestoInsertStatement",
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement"},
"name":"org.apache.shardingsphere.sql.parser.statement.presto.dml.PrestoSelectStatement",
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement"},
"name":"org.apache.shardingsphere.sql.parser.statement.sqlserver.ddl.SQLServerCreateTableStatement",
Expand Down
Loading

0 comments on commit 1440b65

Please sign in to comment.