From 138fb68c73619c1b33848ce3745ee28285ef3c9b Mon Sep 17 00:00:00 2001 From: linghengqian Date: Wed, 18 Oct 2023 08:46:23 +0800 Subject: [PATCH 1/3] Provides built-in GraalVM Reachability Metadata for core features of ShardingSphere JDBC and adds nativeTest-related unit test subsets --- .github/workflows/nightly-build.yml | 3 +- .github/workflows/nightly-ci.yml | 28 + distribution/proxy-native/access-filter.json | 17 - .../graalvm-native-image/_index.cn.md | 263 ++++++ .../graalvm-native-image/_index.en.md | 277 ++++++ .../startup/graalvm-native-image.cn.md | 24 +- .../startup/graalvm-native-image.en.md | 26 +- .../native-image-filter/extra-filter.json | 31 + .../native-image-filter/user-code-filter.json | 0 infra/nativetest/pom.xml | 67 ++ .../infra/nativetest/FileTestUtils.java | 65 ++ .../nativetest/jdbc/features/EncryptTest.java | 123 +++ .../nativetest/jdbc/features/MaskTest.java | 123 +++ .../jdbc/features/ReadWriteSplittingTest.java | 121 +++ .../nativetest/jdbc/features/ShadowTest.java | 152 ++++ .../jdbc/features/ShardingTest.java | 138 +++ ...ssBasedInlineShardingAlgorithmFixture.java | 44 + ...QueryAssistedShardingEncryptAlgorithm.java | 46 + .../jdbc/features/entity/Address.java | 36 + .../jdbc/features/entity/Order.java | 42 + .../jdbc/features/entity/OrderItem.java | 42 + .../repository/AddressRepository.java | 133 +++ .../repository/OrderItemRepository.java | 185 ++++ .../features/repository/OrderRepository.java | 221 +++++ .../reflect-config.json | 7 + .../resource-config.json | 21 + ...hardingsphere.encrypt.spi.EncryptAlgorithm | 18 + .../src/test/resources/yaml/encrypt.yaml | 60 ++ .../src/test/resources/yaml/mask.yaml | 47 ++ .../resources/yaml/readwrite-splitting.yaml | 57 ++ .../src/test/resources/yaml/shadow.yaml | 88 ++ .../src/test/resources/yaml/sharding.yaml | 82 ++ infra/pom.xml | 2 + infra/reachability-metadata/pom.xml | 29 + .../caffeine/2.9.3/reflect-config.json | 62 ++ .../HikariCP/4.0.3/reflect-config.json | 20 + .../calcite-core/1.35.0/reflect-config.json | 797 ++++++++++++++++++ .../groovy/4.0.10/reflect-config.json | 250 ++++++ .../3.0.4/reflect-config.json | 80 ++ .../3.0.4/resource-config.json | 29 + .../reflect-config.json | 704 ++++++++++++++++ .../resource-config.json | 107 +++ .../zookeeper/3.9.0/reflect-config.json | 56 ++ .../jaxb-runtime/2.3.1/reflect-config.json | 12 + .../slf4j-api/1.7.36/reflect-config.json | 7 + jdbc/core/pom.xml | 5 + pom.xml | 163 ++-- 47 files changed, 4786 insertions(+), 124 deletions(-) delete mode 100644 distribution/proxy-native/access-filter.json create mode 100644 docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.cn.md create mode 100644 docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.en.md create mode 100644 infra/nativetest/native-image-filter/extra-filter.json rename distribution/proxy-native/caller-filter.json => infra/nativetest/native-image-filter/user-code-filter.json (100%) create mode 100644 infra/nativetest/pom.xml create mode 100644 infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/FileTestUtils.java create mode 100644 infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/EncryptTest.java create mode 100644 infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/MaskTest.java create mode 100644 infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ReadWriteSplittingTest.java create mode 100644 infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShadowTest.java create mode 100644 infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShardingTest.java create mode 100644 infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/algorithm/ClassBasedInlineShardingAlgorithmFixture.java create mode 100644 infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java create mode 100644 infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/entity/Address.java create mode 100644 infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/entity/Order.java create mode 100644 infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/entity/OrderItem.java create mode 100644 infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/repository/AddressRepository.java create mode 100644 infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/repository/OrderItemRepository.java create mode 100644 infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/repository/OrderRepository.java create mode 100644 infra/nativetest/src/test/resources/META-INF/native-image/shardingsphere-infra-nativetest-test-metadata/reflect-config.json create mode 100644 infra/nativetest/src/test/resources/META-INF/native-image/shardingsphere-infra-nativetest-test-metadata/resource-config.json create mode 100644 infra/nativetest/src/test/resources/META-INF/services/org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm create mode 100644 infra/nativetest/src/test/resources/yaml/encrypt.yaml create mode 100644 infra/nativetest/src/test/resources/yaml/mask.yaml create mode 100644 infra/nativetest/src/test/resources/yaml/readwrite-splitting.yaml create mode 100644 infra/nativetest/src/test/resources/yaml/shadow.yaml create mode 100644 infra/nativetest/src/test/resources/yaml/sharding.yaml create mode 100644 infra/reachability-metadata/pom.xml create mode 100644 infra/reachability-metadata/src/main/resources/META-INF/native-image/com.github.ben-manes.caffeine/caffeine/2.9.3/reflect-config.json create mode 100644 infra/reachability-metadata/src/main/resources/META-INF/native-image/com.zaxxer/HikariCP/4.0.3/reflect-config.json create mode 100644 infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.calcite/calcite-core/1.35.0/reflect-config.json create mode 100644 infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.groovy/groovy/4.0.10/reflect-config.json create mode 100644 infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.4/reflect-config.json create mode 100644 infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.4/resource-config.json create mode 100644 infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/reflect-config.json create mode 100644 infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/resource-config.json create mode 100644 infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.zookeeper/zookeeper/3.9.0/reflect-config.json create mode 100644 infra/reachability-metadata/src/main/resources/META-INF/native-image/org.glassfish.jaxb/jaxb-runtime/2.3.1/reflect-config.json create mode 100644 infra/reachability-metadata/src/main/resources/META-INF/native-image/org.slf4j/slf4j-api/1.7.36/reflect-config.json diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 3a414ead7610b..b693625696fff 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -119,7 +119,7 @@ jobs: ref: ${{ inputs.commit-id }} - uses: graalvm/setup-graalvm@v1 with: - java-version: '17.0.8' + java-version: '17.0.9' distribution: 'graalvm-community' github-token: ${{ secrets.GITHUB_TOKEN }} - uses: actions/cache@v3 @@ -136,7 +136,6 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Push Docker Image run: | - ./mvnw -PgenerateStandardMetadata -DskipNativeTests -B -T1C clean test ./mvnw -am -pl distribution/proxy-native -Prelease.native,docker.buildx.push.native -B -T1C -DskipTests -Dproxy.image.repository=${{ env.PROXY_NATIVE }} -Dproxy.image.tag=${{ github.sha }} clean package build-cache: diff --git a/.github/workflows/nightly-ci.yml b/.github/workflows/nightly-ci.yml index 3945b115811ba..726a6448d016e 100644 --- a/.github/workflows/nightly-ci.yml +++ b/.github/workflows/nightly-ci.yml @@ -99,3 +99,31 @@ jobs: java-version: 8 - name: Run Tests with JDK 8 run: ./mvnw test -B -ntp -fae -T1C + + ci-native-test: + if: github.repository == 'apache/shardingsphere' + name: NativeTest CI - GraalVM CE on ${{ matrix.os }} + needs: global-environment + runs-on: ${{ matrix.os }} + timeout-minutes: 90 + strategy: + max-parallel: 20 + fail-fast: false + matrix: + os: [ ubuntu-latest ] + steps: + - uses: actions/checkout@v3 + - uses: graalvm/setup-graalvm@v1 + with: + java-version: '17.0.9' + distribution: 'graalvm-community' + github-token: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-cache-${{ github.sha }} + restore-keys: | + ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party-cache- + ${{ needs.global-environment.outputs.GLOBAL_CACHE_PREFIX }}-maven-third-party- + - name: Run nativeTest with GraalVM CE + run: ./mvnw -PnativeTestInShardingSphere -T1C -e clean test diff --git a/distribution/proxy-native/access-filter.json b/distribution/proxy-native/access-filter.json deleted file mode 100644 index a5c58ae341dcd..0000000000000 --- a/distribution/proxy-native/access-filter.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "rules": [ - {"includeClasses": "**"}, - {"excludeClasses": "com.atomikos.jdbc.**"}, - {"excludeClasses": "com.mchange.v2.c3p0.**"}, - {"excludeClasses": "com.mysql.jdbc.**"}, - {"excludeClasses": "com.zaxxer.hikari.**"}, - {"excludeClasses": "org.apache.commons.dbcp2.**"}, - {"excludeClasses": "org.junit.platform.launcher.**"}, - {"excludeClasses": "org.mariadb.jdbc.**"}, - {"excludeClasses": "org.apache.shardingsphere.sharding.UndefinedClass"} - ], - "regexRules": [ - {"excludeClasses": ".*Fixture*.*"}, - {"excludeClasses": ".*Mocked*.*"} - ] -} 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 new file mode 100644 index 0000000000000..ba6f3a41a2e6f --- /dev/null +++ b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.cn.md @@ -0,0 +1,263 @@ ++++ +title = "GraalVM Native Image" +weight = 8 +chapter = true ++++ + +## 背景信息 + +ShardingSphere JDBC 已在 GraalVM Native Image 下完成可用性验证。 + +构建包含 `org.apache.shardingsphere:shardingsphere-jdbc-core:${shardingsphere.version}` 的 Maven 依赖的 GraalVM Native +Image,你需要借助于 GraalVM Native Build Tools。GraalVM Native Build Tools 提供了 Maven Plugin 和 Gradle Plugin 来简化 GraalVM +CE 的 `native-image` 工具的长篇大论的 shell 命令。 + +ShardingSphere JDBC 要求在如下或更高版本的 `GraalVM CE` 完成构建 GraalVM Native Image。使用者可通过 SDKMAN! 快速切换 JDK。这同理 +适用于 `Oracle GraalVM`, `Liberica Native Image Kit` 和 `Mandrel` 等 `GraalVM CE` 的下游发行版。 + +- GraalVM CE 23.0.2 For JDK 17.0.9,对应于 SDKMAN! 的 `17.0.9-graalce` +- GraalVM CE 23.0.2 For JDK 21.0.1,对应于 SDKMAN! 的 `21.0.1-graalce` + +### Maven 生态 + +使用者需要配置额外的 BuildArgs ,以阻止 GroovyShell 的相关类在构建 GraalVM Native Image 时报错。并主动使用 GraalVM Reachability +Metadata 中央仓库。如下配置可供参考,以配置项目额外的 Maven Profile,以 GraalVM Native Build Tools 的文档为准。 + +```xml + + + + org.apache.shardingsphere + shardingsphere-jdbc-core + ${shardingsphere.version} + + + + + + + org.graalvm.buildtools + native-maven-plugin + 0.9.28 + true + + + --report-unsupported-elements-at-runtime + + + true + + + + + build-native + + compile-no-fork + + package + + + test-native + + test + + test + + + + + + +``` + +### Gradle 生态 + +使用者需要配置额外的 BuildArgs ,以阻止 GroovyShell 的相关类在构建 GraalVM Native Image 时报错。并主动使用 GraalVM Reachability +Metadata 中央仓库。如下配置可供参考,以配置项目额外的 Gradle Task,以 GraalVM Native Build Tools 的文档为准。 + +```groovy +plugins { + id 'org.graalvm.buildtools.native' version '0.9.28' +} + +dependencies { + implementation 'org.apache.shardingsphere:shardingsphere-jdbc-core:${shardingsphere.version}' +} + +graalvmNative { + binaries { + main { + buildArgs.add('--report-unsupported-elements-at-runtime') + } + test { + buildArgs.add('--report-unsupported-elements-at-runtime') + } + } + metadataRepository { + enabled = true + } +} +``` + +### 对于 SBT 等不被 GraalVM Native Build Tools 支持的构建工具 + +此类需求需要在 https://github.com/graalvm/native-build-tools 打开额外的 issue 并提供对应构建工具的 Plugin 实现。 + + +### 使用限制 + +1. 如下的算法类由于涉及到 https://github.com/oracle/graal/issues/5522 , 暂未可在 GraalVM Native Image 下使用。 + - `org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm` + - `org.apache.shardingsphere.sharding.algorithm.sharding.inline.ComplexInlineShardingAlgorithm` + - `org.apache.shardingsphere.sharding.algorithm.sharding.hint.HintInlineShardingAlgorithm` + +对于常规案例,使用者可通过 CLASS_BASE 算法自行模拟 GroovyShell 的行为。例如对于如下配置。 + +```yaml +rules: +- !SHARDING + defaultDatabaseStrategy: + standard: + shardingColumn: user_id + shardingAlgorithmName: inline + shardingAlgorithms: + inline: + type: INLINE + props: + algorithm-expression: ds_${user_id % 2} + allow-range-query-with-inline-sharding: false +``` + +可首先定义 CLASS_BASE 的实现类。 + +```java +package org.example.test; + +import org.apache.shardingsphere.sharding.api.sharding.standard.PreciseShardingValue; +import org.apache.shardingsphere.sharding.api.sharding.standard.RangeShardingValue; +import org.apache.shardingsphere.sharding.api.sharding.standard.StandardShardingAlgorithm; + +import java.util.Collection; + +public final class TestShardingAlgorithmFixture implements StandardShardingAlgorithm { + + @Override + public String doSharding(final Collection availableTargetNames, final PreciseShardingValue shardingValue) { + String resultDatabaseName = "ds_" + shardingValue.getValue() % 2; + for (String each : availableTargetNames) { + if (each.equals(resultDatabaseName)) { + return each; + } + } + return null; + } + + @Override + public Collection doSharding(final Collection availableTargetNames, final RangeShardingValue shardingValue) { + throw new RuntimeException("This algorithm class does not support range queries."); + } +} +``` + +修改相关 YAML 配置如下。 + +```yaml +rules: +- !SHARDING + defaultDatabaseStrategy: + standard: + shardingColumn: user_id + shardingAlgorithmName: inline + shardingAlgorithms: + inline: + type: CLASS_BASED + props: + strategy: STANDARD + algorithmClassName: org.example.test.TestShardingAlgorithmFixture +``` + +在 `src/main/resources/META-INF/native-image/exmaple-test-metadata/reflect-config.json` 加入如下内容即可在正常在 GraalVM Native +Image 下使用。 + +```json +[ +{ + "name":"org.example.test.TestShardingAlgorithmFixture", + "methods":[{"name":"","parameterTypes":[] }] +} +] +``` + +2. 对于 `读写分离` 的功能,你需要使用 `行表达式` SPI 的其他实现,以在配置 `logic database name`,`writeDataSourceName` 和 `readDataSourceNames` +时绕开对 GroovyShell 的调用。一个可能的配置是使用 `LITERAL` 的 `行表达式` SPI 的实现。对于 `数据分片` 的功能的 `actualDataNodes` 同理。 +```yaml +rules: +- !READWRITE_SPLITTING + dataSources: + readwrite_ds: + writeDataSourceName: ds_0 + readDataSourceNames: + - ds_1 + - ds_2 +``` + +3. 使用者依然需要在 `src/main/resources/META-INF/native-image` 文件夹或 `src/test/resources/META-INF/native-image` 文件夹配置独立 +文件的 GraalVM Reachability Metadata。使用者可通过 GraalVM Native Build Tools 的 GraalVM Tracing Agent 来快速采集 GraalVM +Reachability Metadata。 + +4. 尚未验证 DistSQL 的可用性。使用者需自行添加额外的 GraalVM Reachability Metadata。 + +## 贡献 GraalVM Reachability Metadata + +ShardingSphere 对在 GraalVM Native Image 下的可用性的验证,是通过 GraalVM Native Build Tools 的 Maven Plugin 子项目来完成的。 +通过在 JVM 下运行单元测试,为单元测试打上 `junit-platform-unique-ids*` 标签,此后构建为 GraalVM Native Image 进行 nativeTest 来测试 +在 GraalVM Native Image 下的单元测试覆盖率。请贡献者不要使用 `io.kotest:kotest-runner-junit5-jvm:5.5.4` 等在 `test listener` mode 下 +failed to discover tests 的测试库。 + +ShardingSphere 定义了 `shardingsphere-infra-nativetest` 的 Maven Module 用于为 native Test 提供小型的单元测试子集, +此单元测试子集避免了使用 Mockito 等 native Test 下无法使用的第三方库。 + +ShardingSphere 定义了 `nativeTestInShardingSphere` 的 Maven Profile 用于为 `shardingsphere-infra-nativetest` 模块执行 nativeTest 。 + +假设贡献者处于新的 Ubuntu 22.04.3 LTS 实例下,其可通过如下 bash 命令通过 SDKMAN! 管理 JDK 和工具链, +并为 `shardingsphere-infra-nativetest` 子模块执行 nativeTest。 + +```bash +sudo apt install unzip zip curl sed -y +curl -s "https://get.sdkman.io" | bash +source "$HOME/.sdkman/bin/sdkman-init.sh" +sdk install java 17.0.9-graalce +sdk use java 17.0.9-graalce +sudo apt-get install build-essential libz-dev zlib1g-dev -y + +git clone git@github.com:apache/shardingsphere.git +cd ./shardingsphere/ +./mvnw -PnativeTestInShardingSphere -T1C -e clean test +``` + +当贡献者发现缺少与 ShardingSphere 无关的第三方库的 GraalVM Reachability Metadata 时,应当在 +https://github.com/oracle/graalvm-reachability-metadata 打开新的 issue, 并提交包含依赖的第三方库缺失的 GraalVM Reachability +Metadata 的 PR。ShardingSphere 在 `shardingsphere-infra-reachability-metadata` 子模块主动托管了部分第三方库的 GraalVM Reachability Metadata。 + +如果 nativeTest 执行失败, 应为单元测试生成初步的 GraalVM Reachability Metadata,并手动调整以修复 nativeTest。 +如有需要,请使用 `org.junit.jupiter.api.condition.DisabledInNativeImage` 注解或 `org.graalvm.nativeimage.imagecode` 的 +System Property 屏蔽部分单元测试在 GraalVM Native Image 下运行。 + +ShardingSphere 定义了 `generateMetadata` 的 Maven Profile 用于在 GraalVM JIT Compiler 下携带 GraalVM Tracing Agent 执行单元测试,并在特定目录下生成或合并 +已有的 GraalVM Reachability Metadata 文件。可通过如下 bash 命令简单处理此流程。贡献者仍可能需要手动调整具体的 JSON 条目,并在适当的时候 +调整 Maven Profile 和 GraalVM Tracing Agent 的 Filter 链。 + +以下命令仅为 `shardingsphere-infra-nativetest` 生成 Conditional 形态的 GraalVM Reachability Metadata 的一个举例。生成的 GraalVM +Reachability Metadata 位于 `shardingsphere-infra-reachability-metadata` 子模块下。 + +对于测试类和测试文件独立使用的 GraalVM Reachability Metadata,贡献者应该放置到 +`${user.dir}/infra/nativetest/src/test/resources/META-INF/native-image/shardingsphere-infra-nativetest-test-metadata/` +文件夹下。`${}` 内为相关子模块对应的 POM 4.0 的常规系统变量,自行替换。 + +```bash +git clone git@github.com:apache/shardingsphere.git +cd ./shardingsphere/ +./mvnw -PgenerateMetadata -DskipNativeTests -e -T1C clean test native:metadata-copy +``` + +请手动删除无任何具体条目的 JSON 文件。 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 new file mode 100644 index 0000000000000..4037034abe0ae --- /dev/null +++ b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.en.md @@ -0,0 +1,277 @@ ++++ +title = "GraalVM Native Image" +weight = 8 +chapter = true ++++ + +## Background Information + +ShardingSphere JDBC has been validated for availability under GraalVM Native Image. + +Build GraalVM Native containing Maven dependencies of `org.apache.shardingsphere:shardingsphere-jdbc-core:${shardingsphere.version}` +Image, you need to resort to GraalVM Native Build Tools. GraalVM Native Build Tools provides Maven Plugin and Gradle Plugin +to simplify long list of shell commands for GraalVM CE's `native-image` tool. + +ShardingSphere JDBC requires GraalVM Native Image to be built with GraalVM CE as follows or higher. Users can quickly switch +JDK through `SDKMAN!`. Same reason applicable to downstream distributions of `GraalVM CE` such as `Oracle GraalVM`, `Liberica Native Image Kit` +and `Mandrel`. + +- GraalVM CE 23.0.2 For JDK 17.0.9, corresponding to `17.0.9-graalce` of SDKMAN! +- GraalVM CE 23.0.2 For JDK 21.0.1, corresponding to `21.0.1-graalce` of SDKMAN! + +### Maven Ecology + +Users need to configure additional `BuildArgs` to prevent GroovyShell related classes from reporting errors when building +GraalVM Native Image. and proactively use GraalVM Reachability Metadata central repository. The following configuration +is for reference to configure additional Maven Profiles for the project, and the documentation of GraalVM Native Build +Tools shall prevail. + +```xml + + + + org.apache.shardingsphere + shardingsphere-jdbc-core + ${shardingsphere.version} + + + + + + + org.graalvm.buildtools + native-maven-plugin + 0.9.28 + true + + + --report-unsupported-elements-at-runtime + + + true + + + + + build-native + + compile-no-fork + + package + + + test-native + + test + + test + + + + + + +``` + +### Gradle Ecosystem + +Users need to configure additional `BuildArgs` to prevent GroovyShell related classes from reporting errors when building +GraalVM Native Image. and proactively use GraalVM Reachability Metadata central repository. The following configuration +is for reference to configure additional Gradle Task for the project, and the documentation of GraalVM Native Build +Tools shall prevail. + +```groovy +plugins { + id 'org.graalvm.buildtools.native' version '0.9.28' +} + +dependencies { + implementation 'org.apache.shardingsphere:shardingsphere-jdbc-core:${shardingsphere.version}' +} + +graalvmNative { + binaries { + main { + buildArgs.add('--report-unsupported-elements-at-runtime') + } + test { + buildArgs.add('--report-unsupported-elements-at-runtime') + } + } + metadataRepository { + enabled = true + } +} +``` + +### For build tools such as SBT that are not supported by GraalVM Native Build Tools + +Such requirements require opening additional issues at https://github.com/graalvm/native-build-tools and providing the Plugin +implementation of the corresponding build tool. + + +### Usage restrictions + +1. The following algorithm classes are not available under GraalVM Native Image due to the involvement of https://github.com/oracle/graal/issues/5522. + - `org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm` + - `org.apache.shardingsphere.sharding.algorithm.sharding.inline.ComplexInlineShardingAlgorithm` + - `org.apache.shardingsphere.sharding.algorithm.sharding.hint.HintInlineShardingAlgorithm` + +For general cases, users can simulate the behavior of GroovyShell by themselves through the `CLASS_BASE` algorithm. For example, +take the following configuration. + +```yaml +rules: +- !SHARDING + defaultDatabaseStrategy: + standard: + shardingColumn: user_id + shardingAlgorithmName: inline + shardingAlgorithms: + inline: + type: INLINE + props: + algorithm-expression: ds_${user_id % 2} + allow-range-query-with-inline-sharding: false +``` + +You can first define the implementation class of `CLASS_BASE`. + +```java +package org.example.test; + +import org.apache.shardingsphere.sharding.api.sharding.standard.PreciseShardingValue; +import org.apache.shardingsphere.sharding.api.sharding.standard.RangeShardingValue; +import org.apache.shardingsphere.sharding.api.sharding.standard.StandardShardingAlgorithm; + +import java.util.Collection; + +public final class TestShardingAlgorithmFixture implements StandardShardingAlgorithm { + + @Override + public String doSharding(final Collection availableTargetNames, final PreciseShardingValue shardingValue) { + String resultDatabaseName = "ds_" + shardingValue.getValue() % 2; + for (String each : availableTargetNames) { + if (each.equals(resultDatabaseName)) { + return each; + } + } + return null; + } + + @Override + public Collection doSharding(final Collection availableTargetNames, final RangeShardingValue shardingValue) { + throw new RuntimeException("This algorithm class does not support range queries."); + } +} +``` + +Modify the relevant YAML configuration as follows. + +```yaml +rules: +- !SHARDING + defaultDatabaseStrategy: + standard: + shardingColumn: user_id + shardingAlgorithmName: inline + shardingAlgorithms: + inline: + type: CLASS_BASED + props: + strategy: STANDARD + algorithmClassName: org.example.test.TestShardingAlgorithmFixture +``` + +Add the following content to `src/main/resources/META-INF/native-image/exmaple-test-metadata/reflect-config.json` to used +normally under GraalVM Native Image. + +```json +[ +{ + "name":"org.example.test.TestShardingAlgorithmFixture", + "methods":[{"name":"","parameterTypes":[] }] +} +] +``` + +2. For the `ReadWrite Splitting` feature, you need to use other implementations of `Row Value Expressions` SPI to configure +`logic database name`, `writeDataSourceName` and `readDataSourceNames` when bypassing calls to GroovyShell. One possible +configuration is to use the `Row Value Expressions` SPI implementation of `LITERAL`. The same applies to `actualDataNodes` +for the `Sharding` feature. + +```yaml +rules: +- !READWRITE_SPLITTING + dataSources: + readwrite_ds: + writeDataSourceName: ds_0 + readDataSourceNames: + - ds_1 + - ds_2 +``` + +3. Users still need to configure GraalVM Reachability Metadata for independent files in the `src/main/resources/META-INF/native-image` +folder or `src/test/resources/META-INF/native-image` folder. Users can quickly collect GraalVM Reachability Metadata through +the GraalVM Tracing Agent of GraalVM Native Build Tools. + +4. DistSQL availability has not been verified. Users need to add additional GraalVM Reachability Metadata by themselves. + +## Contribute GraalVM Reachability Metadata + +The verification of ShardingSphere's availability under GraalVM Native Image is completed through the Maven Plugin subproject +of GraalVM Native Build Tools. By running the unit test under the JVM, label the unit test with `junit-platform-unique-ids*`, +and then build it as GraalVM Native Image for nativeTest to test Unit Test Coverage under GraalVM Native Image. +Please do not use `io.kotest:kotest-runner-junit5-jvm:5.5.4` and some third-party test libraries, they are in `test listener` +mode failed to discover tests. + +ShardingSphere defines the Maven Module of `shardingsphere-infra-nativetest` to provide a small subset of unit tests for native Test. +This subset of unit tests avoids the use of third-party libraries such as Mockito that are not available under native Test. + +ShardingSphere defines the Maven Profile of `nativeTestInShardingSphere` for executing nativeTest for the `shardingsphere-infra-nativetest` module. + +Assuming that the contributor is under a new Ubuntu 22.04.3 LTS instance, Contributors can manage the JDK and tool chain through +`SDKMAN!` through the following bash command, and execute nativeTest for the `shardingsphere-infra-nativetest` submodule. + +```bash +sudo apt install unzip zip curl sed -y +curl -s "https://get.sdkman.io" | bash +source "$HOME/.sdkman/bin/sdkman-init.sh" +sdk install java 17.0.9-graalce +sdk use java 17.0.9-graalce +sudo apt-get install build-essential libz-dev zlib1g-dev -y + +git clone git@github.com:apache/shardingsphere.git +cd ./shardingsphere/ +./mvnw -PnativeTestInShardingSphere -T1C -e clean test +``` + +When contributors discover that GraalVM Reachability Metadata is missing for a third-party library not related to ShardingSphere, +they should open a new issue and submit PR containing the missing third-party library GraalVM Reachability Metadata that depends +on https://github.com/oracle/graalvm-reachability-metadata . ShardingSphere actively hosts the GraalVM Reachability Metadata of +some third-party libraries in the `shardingsphere-infra-reachability-metadata` submodule. + +If nativeTest execution fails, preliminary GraalVM Reachability Metadata should be generated for unit tests and manually +adjusted to fix nativeTest. If necessary, use the `org.junit.jupiter.api.condition.DisabledInNativeImage` annotation or the +`org.graalvm.nativeimage.imagecode` System Property blocks some unit tests from running under GraalVM Native Image. + +ShardingSphere defines the Maven Profile of `generateMetadata`, which is used to carry GraalVM Reachability Metadata. Bring +GraalVM Tracing Agent under GraalVM JIT Compiler to perform unit testing, and generate or merge existing GraalVM Reachability +Metadata files in a specific directory. +This process can be easily handled with the following bash command. Contributors may still need to manually adjust specific +JSON entries and GraalVM Tracing Agent Filter chain of Maven Profile. + +The following command is only an example of using `shardingsphere-infra-nativetest` to generate GraalVM Reachability Metadata +in Conditional form. Generated GraalVM Reachability Metadata is located under the `shardingsphere-infra-reachability-metadata` submodule. + +For GraalVM Reachability Metadata used independently by test classes and test files, contributors should place +`${user.dir}/infra/nativetest/src/test/resources/META-INF/native-image/shardingsphere-infra-nativetest-test-metadata/` +folder. `${}` contains the regular system variables of POM 4.0 corresponding to the relevant submodules, which can be replaced by yourself. + +```bash +git clone git@github.com:apache/shardingsphere.git +cd ./shardingsphere/ +./mvnw -PgenerateMetadata -DskipNativeTests -e -T1C clean test native:metadata-copy +``` + +Please manually delete JSON files without any specific entries. diff --git a/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.cn.md b/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.cn.md index 4afb9ffa1c376..a8b17547ee45c 100644 --- a/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.cn.md +++ b/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.cn.md @@ -25,18 +25,6 @@ services: - "3307:3307" ``` -- 若你发现构建过程存在缺失的 GraalVM Reachability Metadata, - 应当在 https://github.com/oracle/graalvm-reachability-metadata 打开新的 issue , - 并提交包含 ShardingSphere 自身或依赖的第三方库缺失的 GraalVM Reachability Metadata 的 PR。 - -- ShardingSphere 的 master 分支尚未准备好处理 Native Image 中的单元测试 , 你总是需要在构建 GraalVM Native Image 的过程中, - 加上特定于 `GraalVM Native Build Tools` 的 `-DskipNativeTests` 或 `-DskipTests` 参数跳过 Native Image 中的单元测试。 - -- 如下的算法类由于涉及到 https://github.com/oracle/graal/issues/5522 , 暂未可在 GraalVM Native Image 下使用。 - - `org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm` - - `org.apache.shardingsphere.sharding.algorithm.sharding.inline.ComplexInlineShardingAlgorithm` - - `org.apache.shardingsphere.sharding.algorithm.sharding.hint.HintInlineShardingAlgorithm` - - 当前阶段,GraalVM Native Image 形态的 ShardingSphere Proxy 不支持使用 `InlineExpressionParser` SPI 的默认实现的 `行表达式`, 这首先导致 `数据分片` 功能的`actualDataNodes` 属性只能使用其他 `InlineExpressionParser` SPI 的实现来配置, 例如使用 `InlineExpressionParser` SPI 实现为 `LITERAL` 的 `行表达式`, 即 `ds_0.t_order_0, ds_0.t_order_1` @@ -54,19 +42,13 @@ services: 或 `GraalVM Community Edition` 的下游发行版。若使用 `SDKMAN!`, ```shell -sdk install java 17.0.8-graalce +sdk install java 17.0.9-graalce ``` 2. 根据 https://www.graalvm.org/jdk17/reference-manual/native-image/#prerequisites 的要求安装本地工具链。 3. 如果需要构建 Docker Image, 确保 `docker-ce` 已安装。 -4. 首先需要在项目的根目录下,执行如下命令以为所有子模块采集 Standard 形态的 GraalVM 可达性元数据。 - -```shell -./mvnw -PgenerateStandardMetadata -DskipNativeTests -B -T1C clean test -``` - ## 操作步骤 1. 获取 Apache ShardingSphere Git Source @@ -148,7 +130,7 @@ services: 另请注意,某些第三方依赖将需要在 `Dockerfile` 安装更多系统库,例如 `libdl`。 因此请确保根据你的使用情况调整 `distribution/proxy-native` 下的 `pom.xml` 和 `Dockerfile` 的内容。 -# 可观察性 +## 可观察性 - 针对 GraalVM Native Image 形态的 ShardingSphere Proxy,其提供的可观察性的能力与 https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-proxy/observability/ 并不一致。 @@ -160,7 +142,7 @@ services: https://github.com/oracle/graal/issues/5648 。 - 对于使用 `ShardingSphere Agent` 等 APM Java Agent 的情形, GraalVM 的 `native-image` 组件尚未完全支持在构建 Native - Image 时使用 javaagent,你需要关注尚未关闭的 https://github.com/oracle/graal/issues/1065。 + Image 时使用 javaagent,你需要关注尚未关闭的 https://github.com/oracle/graal/issues/1065 。 - 以下部分采用 `Apache SkyWalking Java Agent` 作为示例,可用于跟踪 GraalVM 社区的对应 issue。 diff --git a/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.en.md b/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.en.md index 638177fff99c9..416af5d97473a 100644 --- a/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.en.md +++ b/docs/document/content/user-manual/shardingsphere-proxy/startup/graalvm-native-image.en.md @@ -27,21 +27,6 @@ services: - "3307:3307" ```` -- If you find that the build process has missing GraalVM Reachability Metadata, a new issue should be opened - at https://github.com/oracle/graalvm-reachability-metadata, and submit a PR containing GraalVM Reachability Metadata - missing from ShardingSphere itself or dependent third-party libraries. - -- The master branch of ShardingSphere is not yet ready to handle unit tests in Native Image, - you always need to build GraalVM Native Image in the process, - Plus `-DskipNativeTests` or `-DskipTests` parameter specific to `GraalVM Native Build Tools` to skip unit tests in - Native Image. - -- The following algorithm classes are not available under GraalVM Native Image due - to https://github.com/oracle/graal/issues/5522 involved. - - `org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm` - - `org.apache.shardingsphere.sharding.algorithm.sharding.inline.ComplexInlineShardingAlgorithm` - - `org.apache.shardingsphere.sharding.algorithm.sharding.hint.HintInlineShardingAlgorithm` - - At this stage, ShardingSphere Proxy in the form of GraalVM Native Image does not support `row expressions` using the default implementation of the `InlineExpressionParser` SPI. This first results in the `actualDataNodes` property of the `data sharding` feature that can only be configured using @@ -62,20 +47,13 @@ services: JDK 17 according to https://www.graalvm.org/downloads/. If `SDKMAN!` is used, ```shell -sdk install java 17.0.8-graalce +sdk install java 17.0.9-graalce ``` 2. Install the local toolchain as required by https://www.graalvm.org/jdk17/reference-manual/native-image/#prerequisites. 3. If you need to build a Docker Image, make sure `docker-ce` is installed. -4. First, you need to execute the following command in the root directory of the project to collect the GraalVM - Reachability Metadata of the Standard form for all submodules. - -```shell -./mvnw -PgenerateStandardMetadata -DskipNativeTests -B -T1C clean test -``` - ## Steps 1. Get Apache ShardingSphere Git Source @@ -163,7 +141,7 @@ services: the `Dockerfile`. So make sure to tune `distribution/proxy-native` according to your usage `pom.xml` and `Dockerfile` below. -# Observability +## Observability - ShardingSphere for GraalVM Native Image form Proxy, which provides observability capabilities with https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-proxy/observability/ diff --git a/infra/nativetest/native-image-filter/extra-filter.json b/infra/nativetest/native-image-filter/extra-filter.json new file mode 100644 index 0000000000000..0781beee69031 --- /dev/null +++ b/infra/nativetest/native-image-filter/extra-filter.json @@ -0,0 +1,31 @@ +{ + "rules": [ + {"includeClasses": "**"}, + + {"excludeClasses": "com.sun.crypto.provider.**"}, + {"excludeClasses": "com.sun.org.apache.xerces.internal.jaxp.**"}, + {"excludeClasses": "java.**"}, + {"includeClasses": "java.lang.Boolean"}, + {"includeClasses": "java.lang.Thread"}, + {"includeClasses": "java.util.Properties"}, + {"excludeClasses": "javax.security.auth.x500.**"}, + {"excludeClasses": "sun.misc.**"}, + {"excludeClasses": "sun.security.**"}, + + {"excludeClasses": "com.github.benmanes.caffeine.cache.**"}, + {"excludeClasses": "com.google.common.util.concurrent.**"}, + {"excludeClasses": "com.sun.xml.bind.v2.**"}, + {"excludeClasses": "com.zaxxer.hikari.**"}, + {"excludeClasses": "javax.xml.bind.annotation.**"}, + {"excludeClasses": "groovy.**"}, + {"excludeClasses": "org.apache.calcite.**"}, + {"excludeClasses": "org.codehaus.groovy.**"}, + {"excludeClasses": "org.h2.**"}, + {"excludeClasses": "org.locationtech.jts.geom.**"}, + {"excludeClasses": "org.slf4j.event.**"}, + + {"excludeClasses": "org.apache.shardingsphere.infra.nativetest.**"} + ], + "regexRules": [ + ] +} diff --git a/distribution/proxy-native/caller-filter.json b/infra/nativetest/native-image-filter/user-code-filter.json similarity index 100% rename from distribution/proxy-native/caller-filter.json rename to infra/nativetest/native-image-filter/user-code-filter.json diff --git a/infra/nativetest/pom.xml b/infra/nativetest/pom.xml new file mode 100644 index 0000000000000..5fb8d91c8be18 --- /dev/null +++ b/infra/nativetest/pom.xml @@ -0,0 +1,67 @@ + + + + + 4.0.0 + + org.apache.shardingsphere + shardingsphere-infra + 5.4.2-SNAPSHOT + + shardingsphere-infra-nativetest + ${project.artifactId} + + + true + + + + + org.apache.shardingsphere + shardingsphere-jdbc-core + ${project.version} + test + + + + org.hamcrest + hamcrest + test + + + com.zaxxer + HikariCP + test + + + com.h2database + h2 + test + + + + + + + org.graalvm.buildtools + native-maven-plugin + ${native-maven-plugin.version} + + + + diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/FileTestUtils.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/FileTestUtils.java new file mode 100644 index 0000000000000..30768fb598a65 --- /dev/null +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/FileTestUtils.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.infra.nativetest; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * The background for this class comes from oracle/graal#7682 + * and Accessing Resources in Native Image. + * GraalVM Native Image has special features in its handling of file systems. + * This means we are better off reading the file via `java.io.InputStream` instead of `java.net.URL` to avoid extra code + * processing. + * + * @see java.net.URL + * @see InputStream + */ +public class FileTestUtils { + + /** + * read file From file URL string. + * @param fileUrl fileUrl + * @return byte array + */ + public static byte[] readFromFileURLString(final String fileUrl) { + return readInputStream(ClassLoader.getSystemResourceAsStream(fileUrl)).getBytes(StandardCharsets.UTF_8); + } + + private static String readInputStream(final InputStream is) { + StringBuilder out = new StringBuilder(); + try ( + InputStreamReader streamReader = new InputStreamReader(is, StandardCharsets.UTF_8); + BufferedReader reader = new BufferedReader(streamReader)) { + String line; + while ((line = reader.readLine()) != null) { + out.append(line); + // ShardingSphere does not actively handle line separators when parsing YAML and needs to be actively added. + out.append(System.lineSeparator()); + } + } catch (IOException e) { + Logger.getLogger(FileTestUtils.class.getName()).log(Level.SEVERE, null, e); + } + return out.toString(); + } +} diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/EncryptTest.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/EncryptTest.java new file mode 100644 index 0000000000000..4fd0146d78245 --- /dev/null +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/EncryptTest.java @@ -0,0 +1,123 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.infra.nativetest.jdbc.features; + +import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory; +import org.apache.shardingsphere.infra.nativetest.FileTestUtils; + +import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Address; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Order; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.OrderItem; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.AddressRepository; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.OrderItemRepository; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.OrderRepository; +import org.junit.jupiter.api.Test; + +import javax.sql.DataSource; +import java.io.IOException; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.LongStream; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.MatcherAssert.assertThat; + +public final class EncryptTest { + + private OrderRepository orderRepository; + + private OrderItemRepository orderItemRepository; + + private AddressRepository addressRepository; + + @Test + void testEncryptInLocalTransactions() throws SQLException, IOException { + DataSource dataSource = YamlShardingSphereDataSourceFactory.createDataSource(FileTestUtils.readFromFileURLString("yaml/encrypt.yaml")); + orderRepository = new OrderRepository(dataSource); + orderItemRepository = new OrderItemRepository(dataSource); + addressRepository = new AddressRepository(dataSource); + this.initEnvironment(); + this.processSuccess(); + this.cleanEnvironment(); + } + + private void initEnvironment() throws SQLException { + orderRepository.createTableIfNotExists(); + orderItemRepository.createTableIfNotExists(); + addressRepository.createTableIfNotExists(); + orderRepository.truncateTable(); + orderItemRepository.truncateTable(); + addressRepository.truncateTable(); + } + + private void processSuccess() throws SQLException { + final List orderIds = insertData(); + assertThat(orderRepository.selectAll(), + equalTo(IntStream.range(1, 11).mapToObj(i -> new Order(i, i % 2, i, i, "INSERT_TEST")).collect(Collectors.toList()))); + assertThat(orderItemRepository.selectAll(), + equalTo(IntStream.range(1, 11).mapToObj(i -> new OrderItem(i, i, i, "13800000001", "INSERT_TEST")).collect(Collectors.toList()))); + assertThat(addressRepository.selectAll(), + equalTo(LongStream.range(1, 11).mapToObj(i -> new Address(i, "address_test_" + i)).collect(Collectors.toList()))); + deleteData(orderIds); + assertThat(orderRepository.selectAll(), equalTo(new ArrayList<>())); + assertThat(orderItemRepository.selectAll(), equalTo(new ArrayList<>())); + assertThat(addressRepository.selectAll(), equalTo(new ArrayList<>())); + } + + private List insertData() throws SQLException { + List result = new ArrayList<>(10); + for (int i = 1; i <= 10; i++) { + Order order = new Order(); + order.setUserId(i); + order.setOrderType(i % 2); + order.setAddressId(i); + order.setStatus("INSERT_TEST"); + orderRepository.insert(order); + + OrderItem orderItem = new OrderItem(); + orderItem.setOrderId(order.getOrderId()); + orderItem.setUserId(i); + orderItem.setPhone("13800000001"); + orderItem.setStatus("INSERT_TEST"); + orderItemRepository.insert(orderItem); + + Address address = new Address((long) i, "address_test_" + i); + addressRepository.insert(address); + result.add(order.getOrderId()); + } + return result; + } + + private void deleteData(final List orderIds) throws SQLException { + long count = 1; + for (Long each : orderIds) { + orderRepository.delete(each); + orderItemRepository.delete(each); + addressRepository.delete(count++); + } + } + + private void cleanEnvironment() throws SQLException { + orderRepository.dropTable(); + orderItemRepository.dropTable(); + addressRepository.dropTable(); + } +} diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/MaskTest.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/MaskTest.java new file mode 100644 index 0000000000000..18b11bf6af87d --- /dev/null +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/MaskTest.java @@ -0,0 +1,123 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.infra.nativetest.jdbc.features; + +import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory; +import org.apache.shardingsphere.infra.nativetest.FileTestUtils; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Address; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Order; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.OrderItem; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.AddressRepository; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.OrderItemRepository; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.OrderRepository; +import org.junit.jupiter.api.Test; + +import javax.sql.DataSource; +import java.io.IOException; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.LongStream; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.MatcherAssert.assertThat; + +public final class MaskTest { + + private OrderRepository orderRepository; + + private OrderItemRepository orderItemRepository; + + private AddressRepository addressRepository; + + @Test + void testMaskInLocalTransactions() throws SQLException, IOException { + DataSource dataSource = YamlShardingSphereDataSourceFactory.createDataSource(FileTestUtils.readFromFileURLString("yaml/mask.yaml")); + orderRepository = new OrderRepository(dataSource); + orderItemRepository = new OrderItemRepository(dataSource); + addressRepository = new AddressRepository(dataSource); + this.initEnvironment(); + this.processSuccess(); + this.cleanEnvironment(); + } + + private void initEnvironment() throws SQLException { + orderRepository.createTableIfNotExists(); + orderItemRepository.createTableIfNotExists(); + addressRepository.createTableIfNotExists(); + orderRepository.truncateTable(); + orderItemRepository.truncateTable(); + addressRepository.truncateTable(); + } + + private void processSuccess() throws SQLException { + final List orderIds = insertData(); + assertThat(orderRepository.selectAll(), + equalTo(IntStream.range(1, 11).mapToObj(i -> new Order(i, i % 2, i, i, "INSERT_TEST")).collect(Collectors.toList()))); + assertThat(orderItemRepository.selectAll(), + equalTo(IntStream.range(1, 11).mapToObj(i -> new OrderItem(i, i, i, "138****0001", "INSERT_TEST")).collect(Collectors.toList()))); + assertThat(addressRepository.selectAll(), + equalTo(LongStream.range(1, 11).mapToObj(i -> new Address(i, "address_test_" + i)).collect(Collectors.toList()))); + deleteData(orderIds); + assertThat(orderRepository.selectAll(), equalTo(new ArrayList<>())); + assertThat(orderItemRepository.selectAll(), equalTo(new ArrayList<>())); + assertThat(addressRepository.selectAll(), equalTo(new ArrayList<>())); + } + + private List insertData() throws SQLException { + List result = new ArrayList<>(10); + for (int i = 1; i <= 10; i++) { + Order order = new Order(); + order.setUserId(i); + order.setOrderType(i % 2); + order.setAddressId(i); + order.setStatus("INSERT_TEST"); + orderRepository.insert(order); + + OrderItem orderItem = new OrderItem(); + orderItem.setOrderId(order.getOrderId()); + orderItem.setUserId(i); + orderItem.setPhone("13800000001"); + orderItem.setStatus("INSERT_TEST"); + orderItemRepository.insert(orderItem); + + Address address = new Address((long) i, "address_test_" + i); + addressRepository.insert(address); + + result.add(order.getOrderId()); + } + return result; + } + + private void deleteData(final List orderIds) throws SQLException { + long count = 1; + for (Long each : orderIds) { + orderRepository.delete(each); + orderItemRepository.delete(each); + addressRepository.delete(count++); + } + } + + private void cleanEnvironment() throws SQLException { + orderRepository.dropTable(); + orderItemRepository.dropTable(); + addressRepository.dropTable(); + } +} diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ReadWriteSplittingTest.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ReadWriteSplittingTest.java new file mode 100644 index 0000000000000..9d6e1311e4fe3 --- /dev/null +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ReadWriteSplittingTest.java @@ -0,0 +1,121 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.infra.nativetest.jdbc.features; + +import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory; +import org.apache.shardingsphere.infra.nativetest.FileTestUtils; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Address; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Order; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.OrderItem; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.AddressRepository; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.OrderItemRepository; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.OrderRepository; +import org.h2.jdbc.JdbcSQLSyntaxErrorException; +import org.junit.jupiter.api.Test; + +import javax.sql.DataSource; +import java.io.IOException; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertThrows; + +public final class ReadWriteSplittingTest { + + private OrderRepository orderRepository; + + private OrderItemRepository orderItemRepository; + + private AddressRepository addressRepository; + + @Test + void testReadWriteSplittingInLocalTransactions() throws SQLException, IOException { + DataSource dataSource = YamlShardingSphereDataSourceFactory.createDataSource(FileTestUtils.readFromFileURLString("yaml/readwrite-splitting.yaml")); + orderRepository = new OrderRepository(dataSource); + orderItemRepository = new OrderItemRepository(dataSource); + addressRepository = new AddressRepository(dataSource); + this.initEnvironment(); + this.processSuccess(); + this.cleanEnvironment(); + } + + private void initEnvironment() throws SQLException { + orderRepository.createTableIfNotExists(); + orderItemRepository.createTableIfNotExists(); + addressRepository.createTableIfNotExists(); + orderRepository.truncateTable(); + orderItemRepository.truncateTable(); + addressRepository.truncateTable(); + } + + private void processSuccess() throws SQLException { + List orderIds = insertData(); + // This is intentional because the read operation is in the slave database and the corresponding table does not exist. + assertThrows(JdbcSQLSyntaxErrorException.class, this::printData); + deleteData(orderIds); + // This is intentional because the read operation is in the slave database and the corresponding table does not exist. + assertThrows(JdbcSQLSyntaxErrorException.class, this::printData); + } + + private List insertData() throws SQLException { + List result = new ArrayList<>(10); + for (int i = 1; i <= 10; i++) { + Order order = new Order(); + order.setUserId(i); + order.setOrderType(i % 2); + order.setAddressId(i); + order.setStatus("INSERT_TEST"); + orderRepository.insert(order); + + OrderItem orderItem = new OrderItem(); + orderItem.setOrderId(order.getOrderId()); + orderItem.setUserId(i); + orderItem.setPhone("13800000001"); + orderItem.setStatus("INSERT_TEST"); + orderItemRepository.insert(orderItem); + + Address address = new Address((long) i, "address_test_" + i); + addressRepository.insert(address); + + result.add(order.getOrderId()); + } + return result; + } + + private void deleteData(final List orderIds) throws SQLException { + long count = 1; + for (Long each : orderIds) { + orderRepository.delete(each); + orderItemRepository.delete(each); + addressRepository.delete(count++); + } + } + + private void printData() throws SQLException { + orderRepository.selectAll(); + orderItemRepository.selectAll(); + addressRepository.selectAll(); + } + + private void cleanEnvironment() throws SQLException { + orderRepository.dropTable(); + orderItemRepository.dropTable(); + addressRepository.dropTable(); + } +} diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShadowTest.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShadowTest.java new file mode 100644 index 0000000000000..34eef534fee1d --- /dev/null +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShadowTest.java @@ -0,0 +1,152 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.infra.nativetest.jdbc.features; + +import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory; +import org.apache.shardingsphere.infra.nativetest.FileTestUtils; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Address; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Order; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.OrderItem; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.AddressRepository; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.OrderItemRepository; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.OrderRepository; +import org.junit.jupiter.api.Test; + +import javax.sql.DataSource; +import java.io.IOException; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.LongStream; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.MatcherAssert.assertThat; + +public final class ShadowTest { + + private OrderRepository orderRepository; + + private OrderItemRepository orderItemRepository; + + private AddressRepository addressRepository; + + @Test + void testShadowInLocalTransactions() throws SQLException, IOException { + DataSource dataSource = YamlShardingSphereDataSourceFactory.createDataSource(FileTestUtils.readFromFileURLString("yaml/shadow.yaml")); + orderRepository = new OrderRepository(dataSource); + orderItemRepository = new OrderItemRepository(dataSource); + addressRepository = new AddressRepository(dataSource); + this.initEnvironment(); + this.processSuccess(); + this.cleanEnvironment(); + } + + private void initEnvironment() throws SQLException { + orderRepository.createTableIfNotExists(); + orderItemRepository.createTableIfNotExists(); + addressRepository.createTableIfNotExists(); + orderRepository.truncateTable(); + orderItemRepository.truncateTable(); + addressRepository.truncateTable(); + orderRepository.createTableIfNotExistsShadow(); + orderRepository.truncateTableShadow(); + } + + private void processSuccess() throws SQLException { + final List orderIds = insertData(); + assertThat(this.selectAll(), equalTo(Arrays.asList( + new Order(1, 0, 2, 2, "INSERT_TEST"), + new Order(2, 0, 4, 4, "INSERT_TEST"), + new Order(3, 0, 6, 6, "INSERT_TEST"), + new Order(4, 0, 8, 8, "INSERT_TEST"), + new Order(5, 0, 10, 10, "INSERT_TEST"), + new Order(1, 1, 1, 1, "INSERT_TEST"), + new Order(2, 1, 3, 3, "INSERT_TEST"), + new Order(3, 1, 5, 5, "INSERT_TEST"), + new Order(4, 1, 7, 7, "INSERT_TEST"), + new Order(5, 1, 9, 9, "INSERT_TEST")))); + assertThat(orderItemRepository.selectAll(), equalTo(Arrays.asList( + new OrderItem(1, 1, 1, "13800000001", "INSERT_TEST"), + new OrderItem(2, 1, 2, "13800000001", "INSERT_TEST"), + new OrderItem(3, 2, 3, "13800000001", "INSERT_TEST"), + new OrderItem(4, 2, 4, "13800000001", "INSERT_TEST"), + new OrderItem(5, 3, 5, "13800000001", "INSERT_TEST"), + new OrderItem(6, 3, 6, "13800000001", "INSERT_TEST"), + new OrderItem(7, 4, 7, "13800000001", "INSERT_TEST"), + new OrderItem(8, 4, 8, "13800000001", "INSERT_TEST"), + new OrderItem(9, 5, 9, "13800000001", "INSERT_TEST"), + new OrderItem(10, 5, 10, "13800000001", "INSERT_TEST")))); + assertThat(addressRepository.selectAll(), + equalTo(LongStream.range(1, 11).mapToObj(i -> new Address(i, "address_test_" + i)).collect(Collectors.toList()))); + deleteData(orderIds); + assertThat(this.selectAll(), equalTo(Collections.singletonList(new Order(1, 0, 2, 2, "INSERT_TEST")))); + assertThat(orderItemRepository.selectAll(), equalTo(new ArrayList<>())); + assertThat(addressRepository.selectAll(), equalTo(new ArrayList<>())); + } + + private List insertData() throws SQLException { + List result = new ArrayList<>(10); + for (int i = 1; i <= 10; i++) { + Order order = new Order(); + order.setUserId(i); + order.setOrderType(i % 2); + order.setAddressId(i); + order.setStatus("INSERT_TEST"); + orderRepository.insert(order); + + OrderItem orderItem = new OrderItem(); + orderItem.setOrderId(order.getOrderId()); + orderItem.setUserId(i); + orderItem.setPhone("13800000001"); + orderItem.setStatus("INSERT_TEST"); + orderItemRepository.insert(orderItem); + + Address address = new Address((long) i, "address_test_" + i); + addressRepository.insert(address); + + result.add(order.getOrderId()); + } + return result; + } + + private void deleteData(final List orderIds) throws SQLException { + long count = 1; + for (Long each : orderIds) { + orderRepository.deleteShadow(each); + orderRepository.delete(each); + orderItemRepository.delete(each); + addressRepository.delete(count++); + } + } + + private List selectAll() throws SQLException { + List result = orderRepository.selectAll(); + result.addAll(orderRepository.selectShadowOrder()); + return result; + } + + private void cleanEnvironment() throws SQLException { + orderRepository.dropTableShadow(); + orderRepository.dropTable(); + orderItemRepository.dropTable(); + addressRepository.dropTable(); + } +} diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShardingTest.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShardingTest.java new file mode 100644 index 0000000000000..9a7e96ff6cab5 --- /dev/null +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShardingTest.java @@ -0,0 +1,138 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.infra.nativetest.jdbc.features; + +import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory; +import org.apache.shardingsphere.infra.nativetest.FileTestUtils; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Address; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Order; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.OrderItem; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.AddressRepository; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.OrderItemRepository; +import org.apache.shardingsphere.infra.nativetest.jdbc.features.repository.OrderRepository; +import org.junit.jupiter.api.Test; + +import javax.sql.DataSource; +import java.io.IOException; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.LongStream; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.MatcherAssert.assertThat; + +public final class ShardingTest { + + private OrderRepository orderRepository; + + private OrderItemRepository orderItemRepository; + + private AddressRepository addressRepository; + + @Test + void testShardingInLocalTransactions() throws SQLException, IOException { + DataSource dataSource = YamlShardingSphereDataSourceFactory.createDataSource(FileTestUtils.readFromFileURLString("yaml/sharding.yaml")); + orderRepository = new OrderRepository(dataSource); + orderItemRepository = new OrderItemRepository(dataSource); + addressRepository = new AddressRepository(dataSource); + this.initEnvironment(); + this.processSuccess(); + } + + private void initEnvironment() throws SQLException { + orderRepository.createTableIfNotExists(); + orderItemRepository.createTableIfNotExists(); + addressRepository.createTableIfNotExists(); + orderRepository.truncateTable(); + orderItemRepository.truncateTable(); + addressRepository.truncateTable(); + } + + private void processSuccess() throws SQLException { + final List orderIds = insertData(); + + List orders = orderRepository.selectAll(); + assertThat(orders.stream().map(Order::getOrderType).collect(Collectors.toList()), + equalTo(Arrays.asList(1, 1, 1, 1, 1, 0, 0, 0, 0, 0))); + assertThat(orders.stream().map(Order::getUserId).collect(Collectors.toList()), + equalTo(new ArrayList<>(Arrays.asList(1, 3, 5, 7, 9, 2, 4, 6, 8, 10)))); + assertThat(orders.stream().map(Order::getAddressId).collect(Collectors.toList()), + equalTo(new ArrayList<>(Arrays.asList(1L, 3L, 5L, 7L, 9L, 2L, 4L, 6L, 8L, 10L)))); + assertThat(orders.stream().map(Order::getStatus).collect(Collectors.toList()), + equalTo(IntStream.range(1, 11).mapToObj(i -> "INSERT_TEST").collect(Collectors.toList()))); + + List orderItems = orderItemRepository.selectAll(); + assertThat(orderItems.stream().map(OrderItem::getUserId).collect(Collectors.toList()), + equalTo(new ArrayList<>(Arrays.asList(1, 3, 5, 7, 9, 2, 4, 6, 8, 10)))); + assertThat(orderItems.stream().map(OrderItem::getPhone).collect(Collectors.toList()), + equalTo(IntStream.range(1, 11).mapToObj(i -> "13800000001").collect(Collectors.toList()))); + assertThat(orderItems.stream().map(OrderItem::getStatus).collect(Collectors.toList()), + equalTo(IntStream.range(1, 11).mapToObj(i -> "INSERT_TEST").collect(Collectors.toList()))); + + assertThat(addressRepository.selectAll(), + equalTo(LongStream.range(1, 11).mapToObj(i -> new Address(i, "address_test_" + i)).collect(Collectors.toList()))); + deleteData(orderIds); + assertThat(orderRepository.selectAll(), equalTo(new ArrayList<>())); + assertThat(orderItemRepository.selectAll(), equalTo(new ArrayList<>())); + assertThat(addressRepository.selectAll(), equalTo(new ArrayList<>())); + } + + private List insertData() throws SQLException { + List result = new ArrayList<>(10); + for (int i = 1; i <= 10; i++) { + Order order = new Order(); + order.setUserId(i); + order.setOrderType(i % 2); + order.setAddressId(i); + order.setStatus("INSERT_TEST"); + orderRepository.insert(order); + + OrderItem orderItem = new OrderItem(); + orderItem.setOrderId(order.getOrderId()); + orderItem.setUserId(i); + orderItem.setPhone("13800000001"); + orderItem.setStatus("INSERT_TEST"); + orderItemRepository.insert(orderItem); + + Address address = new Address((long) i, "address_test_" + i); + addressRepository.insert(address); + + result.add(order.getOrderId()); + } + return result; + } + + private void deleteData(final List orderIds) throws SQLException { + long count = 1; + for (Long each : orderIds) { + orderRepository.delete(each); + orderItemRepository.delete(each); + addressRepository.delete(count++); + } + } + + private void cleanEnvironment() throws SQLException { + orderRepository.dropTable(); + orderItemRepository.dropTable(); + addressRepository.dropTable(); + } +} diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/algorithm/ClassBasedInlineShardingAlgorithmFixture.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/algorithm/ClassBasedInlineShardingAlgorithmFixture.java new file mode 100644 index 0000000000000..55652a13e6d49 --- /dev/null +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/algorithm/ClassBasedInlineShardingAlgorithmFixture.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.infra.nativetest.jdbc.features.algorithm; + +import org.apache.shardingsphere.sharding.api.sharding.standard.PreciseShardingValue; +import org.apache.shardingsphere.sharding.api.sharding.standard.RangeShardingValue; +import org.apache.shardingsphere.sharding.api.sharding.standard.StandardShardingAlgorithm; + +import java.util.Collection; + +@SuppressWarnings("unused") +public final class ClassBasedInlineShardingAlgorithmFixture implements StandardShardingAlgorithm { + + @Override + public String doSharding(final Collection availableTargetNames, final PreciseShardingValue shardingValue) { + String resultDatabaseName = "ds_" + shardingValue.getValue() % 2; + for (String each : availableTargetNames) { + if (each.equals(resultDatabaseName)) { + return each; + } + } + return null; + } + + @Override + public Collection doSharding(final Collection availableTargetNames, final RangeShardingValue shardingValue) { + throw new RuntimeException("This algorithm class does not support range queries."); + } +} diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java new file mode 100644 index 0000000000000..d47fb24bf567a --- /dev/null +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.infra.nativetest.jdbc.features.algorithm; + +import lombok.Getter; +import org.apache.shardingsphere.encrypt.api.context.EncryptContext; +import org.apache.shardingsphere.encrypt.api.encrypt.assisted.AssistedEncryptAlgorithm; + +import java.util.Properties; + +@SuppressWarnings("LombokGetterMayBeUsed") +public final class TestQueryAssistedShardingEncryptAlgorithm implements AssistedEncryptAlgorithm { + + @Getter + private Properties props; + + @Override + public String encrypt(final Object plainValue, final EncryptContext encryptContext) { + return "assistedEncryptValue"; + } + + @Override + public String getType() { + return "assistedTest"; + } + + @Override + public void init(final Properties props) { + this.props = props; + } +} diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/entity/Address.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/entity/Address.java new file mode 100644 index 0000000000000..530e1eb6d86c6 --- /dev/null +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/entity/Address.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.infra.nativetest.jdbc.features.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Address implements Serializable { + + private static final long serialVersionUID = 4743102234543827855L; + + private Long addressId; + + private String addressName; +} diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/entity/Order.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/entity/Order.java new file mode 100644 index 0000000000000..751889802f8bc --- /dev/null +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/entity/Order.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.infra.nativetest.jdbc.features.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Order implements Serializable { + + private static final long serialVersionUID = 8306802022239174861L; + + private long orderId; + + private int orderType; + + private int userId; + + private long addressId; + + private String status; +} diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/entity/OrderItem.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/entity/OrderItem.java new file mode 100644 index 0000000000000..3c4a00c691f46 --- /dev/null +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/entity/OrderItem.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.infra.nativetest.jdbc.features.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class OrderItem implements Serializable { + + private static final long serialVersionUID = 1332162822494069342L; + + private long orderItemId; + + private long orderId; + + private int userId; + + private String phone; + + private String status; +} diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/repository/AddressRepository.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/repository/AddressRepository.java new file mode 100644 index 0000000000000..65806f92e12cf --- /dev/null +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/repository/AddressRepository.java @@ -0,0 +1,133 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.infra.nativetest.jdbc.features.repository; + +import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Address; + +import javax.sql.DataSource; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.LinkedList; +import java.util.List; + +@SuppressWarnings({"SqlDialectInspection", "SqlNoDataSourceInspection"}) +public final class AddressRepository { + + private final DataSource dataSource; + + public AddressRepository(final DataSource dataSource) { + this.dataSource = dataSource; + } + + /** + * create table t_address if not exists. + * @throws SQLException SQL exception + */ + public void createTableIfNotExists() throws SQLException { + String sql = "CREATE TABLE IF NOT EXISTS t_address (address_id BIGINT NOT NULL, address_name VARCHAR(100) NOT NULL, PRIMARY KEY (address_id))"; + try ( + Connection connection = dataSource.getConnection(); + Statement statement = connection.createStatement()) { + statement.executeUpdate(sql); + } + } + + /** + * drop table t_address. + * @throws SQLException SQL exception + */ + public void dropTable() throws SQLException { + String sql = "DROP TABLE IF EXISTS t_address"; + try ( + Connection connection = dataSource.getConnection(); + Statement statement = connection.createStatement()) { + statement.executeUpdate(sql); + } + } + + /** + * truncate table t_address. + * @throws SQLException SQL exception + */ + public void truncateTable() throws SQLException { + String sql = "TRUNCATE TABLE t_address"; + try ( + Connection connection = dataSource.getConnection(); + Statement statement = connection.createStatement()) { + statement.executeUpdate(sql); + } + } + + /** + * insert something to table t_address. + * @param address address + * @return addressId of the insert statement + * @throws SQLException SQL exception + */ + public Long insert(final Address address) throws SQLException { + String sql = "INSERT INTO t_address (address_id, address_name) VALUES (?, ?)"; + try ( + Connection connection = dataSource.getConnection(); + PreparedStatement preparedStatement = connection.prepareStatement(sql)) { + preparedStatement.setLong(1, address.getAddressId()); + preparedStatement.setString(2, address.getAddressName()); + preparedStatement.executeUpdate(); + } + return address.getAddressId(); + } + + /** + * delete by id. + * @param id id + * @throws SQLException SQL exception + */ + public void delete(final Long id) throws SQLException { + String sql = "DELETE FROM t_address WHERE address_id=?"; + try ( + Connection connection = dataSource.getConnection(); + PreparedStatement preparedStatement = connection.prepareStatement(sql)) { + preparedStatement.setLong(1, id); + preparedStatement.executeUpdate(); + } + } + + /** + * select all. + * @return list of address + * @throws SQLException SQL exception + */ + public List
selectAll() throws SQLException { + String sql = "SELECT * FROM t_address"; + List
result = new LinkedList<>(); + try ( + Connection connection = dataSource.getConnection(); + PreparedStatement preparedStatement = connection.prepareStatement(sql); + ResultSet resultSet = preparedStatement.executeQuery()) { + while (resultSet.next()) { + Address address = new Address(); + address.setAddressId(resultSet.getLong(1)); + address.setAddressName(resultSet.getString(2)); + result.add(address); + } + } + return result; + } +} diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/repository/OrderItemRepository.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/repository/OrderItemRepository.java new file mode 100644 index 0000000000000..320a0786935df --- /dev/null +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/repository/OrderItemRepository.java @@ -0,0 +1,185 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.infra.nativetest.jdbc.features.repository; + +import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.OrderItem; + +import javax.sql.DataSource; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.LinkedList; +import java.util.List; + +@SuppressWarnings({"SqlDialectInspection", "SqlNoDataSourceInspection"}) +public final class OrderItemRepository { + + private final DataSource dataSource; + + public OrderItemRepository(final DataSource dataSource) { + this.dataSource = dataSource; + } + + /** + * create table if not exists. + * @throws SQLException SQL exception + */ + public void createTableIfNotExists() throws SQLException { + String sql = "CREATE TABLE IF NOT EXISTS t_order_item " + + "(order_item_id BIGINT NOT NULL AUTO_INCREMENT, order_id BIGINT NOT NULL, user_id INT NOT NULL, phone VARCHAR(50), status VARCHAR(50), PRIMARY KEY (order_item_id))"; + try ( + Connection connection = dataSource.getConnection(); + Statement statement = connection.createStatement()) { + statement.executeUpdate(sql); + } + } + + /** + * drop table. + * @throws SQLException SQL exception + */ + public void dropTable() throws SQLException { + String sql = "DROP TABLE IF EXISTS t_order_item"; + try ( + Connection connection = dataSource.getConnection(); + Statement statement = connection.createStatement()) { + statement.executeUpdate(sql); + } + } + + /** + * truncate table. + * @throws SQLException SQL exception + */ + public void truncateTable() throws SQLException { + String sql = "TRUNCATE TABLE t_order_item"; + try ( + Connection connection = dataSource.getConnection(); + Statement statement = connection.createStatement()) { + statement.executeUpdate(sql); + } + } + + /** + * create shadow table if not exists. + * @throws SQLException SQL exception + */ + public void createTableIfNotExistsShadow() throws SQLException { + String sql = "CREATE TABLE IF NOT EXISTS t_order_item " + + "(order_item_id BIGINT NOT NULL AUTO_INCREMENT, order_id BIGINT NOT NULL, user_id INT NOT NULL, phone " + + "VARCHAR(50), status VARCHAR(50), PRIMARY KEY (order_item_id)) /* SHARDINGSPHERE_HINT:shadow=true,foo=bar*/"; + try ( + Connection connection = dataSource.getConnection(); + Statement statement = connection.createStatement()) { + statement.executeUpdate(sql); + } + } + + /** + * drop shadow table. + * @throws SQLException SQL exception + */ + public void dropTableShadow() throws SQLException { + String sql = "DROP TABLE t_order_item /* SHARDINGSPHERE_HINT:shadow=true,foo=bar*/"; + try ( + Connection connection = dataSource.getConnection(); + Statement statement = connection.createStatement()) { + statement.executeUpdate(sql); + } + } + + /** + * truncate shadow table. + * @throws SQLException SQL exception + */ + public void truncateTableShadow() throws SQLException { + String sql = "TRUNCATE TABLE t_order_item /* SHARDINGSPHERE_HINT:shadow=true,foo=bar*/"; + try ( + Connection connection = dataSource.getConnection(); + Statement statement = connection.createStatement()) { + statement.executeUpdate(sql); + } + } + + /** + * insert something to table. + * @param orderItem orderItem + * @return orderItemId of the insert statement + * @throws SQLException SQL exception + */ + public Long insert(final OrderItem orderItem) throws SQLException { + String sql = "INSERT INTO t_order_item (order_id, user_id, phone, status) VALUES (?, ?, ?, ?)"; + try ( + Connection connection = dataSource.getConnection(); + PreparedStatement preparedStatement = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) { + preparedStatement.setLong(1, orderItem.getOrderId()); + preparedStatement.setInt(2, orderItem.getUserId()); + preparedStatement.setString(3, orderItem.getPhone()); + preparedStatement.setString(4, orderItem.getStatus()); + preparedStatement.executeUpdate(); + try (ResultSet resultSet = preparedStatement.getGeneratedKeys()) { + if (resultSet.next()) { + orderItem.setOrderItemId(resultSet.getLong(1)); + } + } + } + return orderItem.getOrderItemId(); + } + + /** + * delete by orderItemId. + * @param orderItemId orderItemId + * @throws SQLException SQL exception + */ + public void delete(final Long orderItemId) throws SQLException { + String sql = "DELETE FROM t_order_item WHERE order_id=?"; + try ( + Connection connection = dataSource.getConnection(); + PreparedStatement preparedStatement = connection.prepareStatement(sql)) { + preparedStatement.setLong(1, orderItemId); + preparedStatement.executeUpdate(); + } + } + + /** + * select all. + * @return list of OrderItem + * @throws SQLException SQL exception + */ + public List selectAll() throws SQLException { + String sql = "SELECT i.* FROM t_order o, t_order_item i WHERE o.order_id = i.order_id"; + List result = new LinkedList<>(); + try ( + Connection connection = dataSource.getConnection(); + PreparedStatement preparedStatement = connection.prepareStatement(sql); + ResultSet resultSet = preparedStatement.executeQuery()) { + while (resultSet.next()) { + OrderItem orderItem = new OrderItem(); + orderItem.setOrderItemId(resultSet.getLong(1)); + orderItem.setOrderId(resultSet.getLong(2)); + orderItem.setUserId(resultSet.getInt(3)); + orderItem.setPhone(resultSet.getString(4)); + orderItem.setStatus(resultSet.getString(5)); + result.add(orderItem); + } + } + return result; + } +} diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/repository/OrderRepository.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/repository/OrderRepository.java new file mode 100644 index 0000000000000..fb5aad9c1bdf2 --- /dev/null +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/repository/OrderRepository.java @@ -0,0 +1,221 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.infra.nativetest.jdbc.features.repository; + +import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Order; + +import javax.sql.DataSource; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.LinkedList; +import java.util.List; + +@SuppressWarnings({"SqlDialectInspection", "SqlNoDataSourceInspection"}) +public final class OrderRepository { + + private final DataSource dataSource; + + public OrderRepository(final DataSource dataSource) { + this.dataSource = dataSource; + } + + /** + * create table if not exists. + * @throws SQLException SQL exception + */ + public void createTableIfNotExists() throws SQLException { + String sql = "CREATE TABLE IF NOT EXISTS t_order " + + "(order_id BIGINT NOT NULL AUTO_INCREMENT, order_type INT(11), user_id INT NOT NULL, address_id BIGINT NOT NULL, status VARCHAR(50), PRIMARY KEY (order_id))"; + try ( + Connection connection = dataSource.getConnection(); + Statement statement = connection.createStatement()) { + statement.executeUpdate(sql); + } + } + + /** + * drop table. + * TODO There is a bug in this function in shadow's unit test and requires additional fixes. + * @throws SQLException SQL exception + */ + public void dropTable() throws SQLException { + String sql = "DROP TABLE IF EXISTS t_order"; + try ( + Connection connection = dataSource.getConnection(); + Statement statement = connection.createStatement()) { + statement.executeUpdate(sql); + } + } + + /** + * truncate table. + * @throws SQLException SQL exception + */ + public void truncateTable() throws SQLException { + String sql = "TRUNCATE TABLE t_order"; + try ( + Connection connection = dataSource.getConnection(); + Statement statement = connection.createStatement()) { + statement.executeUpdate(sql); + } + } + + /** + * create shadow table if not exists. + * @throws SQLException SQL exception + */ + public void createTableIfNotExistsShadow() throws SQLException { + String sql = + "CREATE TABLE IF NOT EXISTS t_order (order_id BIGINT NOT NULL AUTO_INCREMENT, order_type INT(11), " + + "user_id INT NOT NULL, address_id BIGINT NOT NULL, status VARCHAR(50), PRIMARY KEY (order_id)) " + + "/* SHARDINGSPHERE_HINT:shadow=true,foo=bar*/"; + try ( + Connection connection = dataSource.getConnection(); + Statement statement = connection.createStatement()) { + statement.executeUpdate(sql); + } + } + + /** + * drop shadow table. + * @throws SQLException SQL exception + */ + public void dropTableShadow() throws SQLException { + String sql = "DROP TABLE IF EXISTS t_order /* SHARDINGSPHERE_HINT:shadow=true,foo=bar*/"; + try ( + Connection connection = dataSource.getConnection(); + Statement statement = connection.createStatement()) { + statement.executeUpdate(sql); + } + } + + /** + * truncate shadow table. + * @throws SQLException SQL exception + */ + public void truncateTableShadow() throws SQLException { + String sql = "TRUNCATE TABLE t_order /* SHARDINGSPHERE_HINT:shadow=true,foo=bar*/"; + try ( + Connection connection = dataSource.getConnection(); + Statement statement = connection.createStatement()) { + statement.executeUpdate(sql); + } + } + + /** + * select Order from shadow table. + * @return list of Order + * @throws SQLException SQL exception + */ + public List selectShadowOrder() throws SQLException { + String sql = "SELECT * FROM t_order WHERE order_type=1"; + return getOrders(sql); + } + + /** + * delete Order from shadow table. + * @param orderId orderId + * @throws SQLException SQL Exception + */ + public void deleteShadow(final Long orderId) throws SQLException { + String sql = "DELETE FROM t_order WHERE order_id=? AND order_type=1"; + try ( + Connection connection = dataSource.getConnection(); + PreparedStatement preparedStatement = connection.prepareStatement(sql)) { + preparedStatement.setLong(1, orderId); + preparedStatement.executeUpdate(); + } + } + + /** + * insert Order to table. + * @param order order + * @return orderId of the insert statement + * @throws SQLException SQL Exception + */ + public Long insert(final Order order) throws SQLException { + String sql = "INSERT INTO t_order (user_id, order_type, address_id, status) VALUES (?, ?, ?, ?)"; + try ( + Connection connection = dataSource.getConnection(); + PreparedStatement preparedStatement = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) { + preparedStatement.setInt(1, order.getUserId()); + preparedStatement.setInt(2, order.getOrderType()); + preparedStatement.setLong(3, order.getAddressId()); + preparedStatement.setString(4, order.getStatus()); + preparedStatement.executeUpdate(); + try (ResultSet resultSet = preparedStatement.getGeneratedKeys()) { + if (resultSet.next()) { + order.setOrderId(resultSet.getLong(1)); + } + } + } + return order.getOrderId(); + } + + /** + * delete by orderId. + * @param orderId orderId + * @throws SQLException SQL exception + */ + public void delete(final Long orderId) throws SQLException { + String sql = "DELETE FROM t_order WHERE order_id=?"; + try ( + Connection connection = dataSource.getConnection(); + PreparedStatement preparedStatement = connection.prepareStatement(sql)) { + preparedStatement.setLong(1, orderId); + preparedStatement.executeUpdate(); + } + } + + /** + * select all. + * @return list of Order + * @throws SQLException SQL exception + */ + public List selectAll() throws SQLException { + return getOrders("SELECT * FROM t_order"); + } + + /** + * get Orders by SQL. + * @param sql SQL + * @return list of Order + * @throws SQLException SQL exception + */ + private List getOrders(final String sql) throws SQLException { + List result = new LinkedList<>(); + try ( + Connection connection = dataSource.getConnection(); + PreparedStatement preparedStatement = connection.prepareStatement(sql); + ResultSet resultSet = preparedStatement.executeQuery()) { + while (resultSet.next()) { + Order order = new Order(); + order.setOrderId(resultSet.getLong(1)); + order.setOrderType(resultSet.getInt(2)); + order.setUserId(resultSet.getInt(3)); + order.setAddressId(resultSet.getLong(4)); + order.setStatus(resultSet.getString(5)); + result.add(order); + } + } + return result; + } +} diff --git a/infra/nativetest/src/test/resources/META-INF/native-image/shardingsphere-infra-nativetest-test-metadata/reflect-config.json b/infra/nativetest/src/test/resources/META-INF/native-image/shardingsphere-infra-nativetest-test-metadata/reflect-config.json new file mode 100644 index 0000000000000..4aed2e014fdd9 --- /dev/null +++ b/infra/nativetest/src/test/resources/META-INF/native-image/shardingsphere-infra-nativetest-test-metadata/reflect-config.json @@ -0,0 +1,7 @@ +[ +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.algorithm.sharding.classbased.ClassBasedShardingAlgorithmFactory"}, + "name":"org.apache.shardingsphere.infra.nativetest.jdbc.features.algorithm.ClassBasedInlineShardingAlgorithmFixture", + "methods":[{"name":"","parameterTypes":[] }] +} +] diff --git a/infra/nativetest/src/test/resources/META-INF/native-image/shardingsphere-infra-nativetest-test-metadata/resource-config.json b/infra/nativetest/src/test/resources/META-INF/native-image/shardingsphere-infra-nativetest-test-metadata/resource-config.json new file mode 100644 index 0000000000000..2773c5f2fde1b --- /dev/null +++ b/infra/nativetest/src/test/resources/META-INF/native-image/shardingsphere-infra-nativetest-test-metadata/resource-config.json @@ -0,0 +1,21 @@ +{ + "resources":{ + "includes":[{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.nativetest.jdbc.features.EncryptTest"}, + "pattern":"\\Qyaml/encrypt.yaml\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.nativetest.jdbc.features.MaskTest"}, + "pattern":"\\Qyaml/mask.yaml\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.nativetest.jdbc.features.ReadWriteSplittingTest"}, + "pattern":"\\Qyaml/readwrite-splitting.yaml\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.nativetest.jdbc.features.ShadowTest"}, + "pattern":"\\Qyaml/shadow.yaml\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.nativetest.jdbc.features.ShardingTest"}, + "pattern":"\\Qyaml/sharding.yaml\\E" + } + ]}, + "bundles":[] +} diff --git a/infra/nativetest/src/test/resources/META-INF/services/org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm b/infra/nativetest/src/test/resources/META-INF/services/org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm new file mode 100644 index 0000000000000..be8532cc700cb --- /dev/null +++ b/infra/nativetest/src/test/resources/META-INF/services/org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm @@ -0,0 +1,18 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +org.apache.shardingsphere.infra.nativetest.jdbc.features.algorithm.TestQueryAssistedShardingEncryptAlgorithm diff --git a/infra/nativetest/src/test/resources/yaml/encrypt.yaml b/infra/nativetest/src/test/resources/yaml/encrypt.yaml new file mode 100644 index 0000000000000..dfe52b7f68536 --- /dev/null +++ b/infra/nativetest/src/test/resources/yaml/encrypt.yaml @@ -0,0 +1,60 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +mode: + type: Standalone + repository: + type: JDBC + +dataSources: + ds_0: + dataSourceClassName: com.zaxxer.hikari.HikariDataSource + driverClassName: org.h2.Driver + jdbcUrl: jdbc:h2:mem:local_encrypt_ds_0;MODE=MYSQL;IGNORECASE=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE + username: root + password: 123456 + +rules: +- !ENCRYPT + tables: + t_order: + columns: + status: + cipher: + name: status + encryptorName: standard_encryptor + assistedQuery: + name: status_assisted + encryptorName: assisted_encryptor + t_order_item: + columns: + phone: + cipher: + name: phone + encryptorName: standard_encryptor + encryptors: + standard_encryptor: + type: AES + props: + aes-key-value: 123456 + assisted_encryptor: + type: assistedTest + props: + aes-key-value: 123456 + +props: + sql-show: false diff --git a/infra/nativetest/src/test/resources/yaml/mask.yaml b/infra/nativetest/src/test/resources/yaml/mask.yaml new file mode 100644 index 0000000000000..2457dc6ad16e1 --- /dev/null +++ b/infra/nativetest/src/test/resources/yaml/mask.yaml @@ -0,0 +1,47 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +mode: + type: Standalone + repository: + type: JDBC + +dataSources: + ds_0: + dataSourceClassName: com.zaxxer.hikari.HikariDataSource + driverClassName: org.h2.Driver + jdbcUrl: jdbc:h2:mem:local_mask_ds_0;MODE=MYSQL;IGNORECASE=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE + username: root + password: 123456 + +rules: +- !MASK + tables: + t_order_item: + columns: + phone: + maskAlgorithm: keep_first_n_last_m_mask + maskAlgorithms: + keep_first_n_last_m_mask: + type: KEEP_FIRST_N_LAST_M + props: + first-n: 3 + last-m: 4 + replace-char: '*' + +props: + sql-show: false \ No newline at end of file diff --git a/infra/nativetest/src/test/resources/yaml/readwrite-splitting.yaml b/infra/nativetest/src/test/resources/yaml/readwrite-splitting.yaml new file mode 100644 index 0000000000000..2b22ac2f64e17 --- /dev/null +++ b/infra/nativetest/src/test/resources/yaml/readwrite-splitting.yaml @@ -0,0 +1,57 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +mode: + type: Standalone + repository: + type: JDBC + +dataSources: + ds_0: + dataSourceClassName: com.zaxxer.hikari.HikariDataSource + driverClassName: org.h2.Driver + jdbcUrl: jdbc:h2:mem:local_readwrite_splitting_ds_0;MODE=MYSQL;IGNORECASE=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE + username: root + password: 123456 + ds_1: + dataSourceClassName: com.zaxxer.hikari.HikariDataSource + driverClassName: org.h2.Driver + jdbcUrl: jdbc:h2:mem:local_readwrite_splitting_ds_1;MODE=MYSQL;IGNORECASE=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE + username: root + password: 123456 + ds_2: + dataSourceClassName: com.zaxxer.hikari.HikariDataSource + driverClassName: org.h2.Driver + jdbcUrl: jdbc:h2:mem:local_readwrite_splitting_ds_2;MODE=MYSQL;IGNORECASE=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE + username: root + password: 123456 + +rules: +- !READWRITE_SPLITTING + # We need to prevent the logical database name, writeDataSourceName and readDataSourceNames from being parsed by + # GroovyShell under Native Image for the read-write separation function. + # That is, switch to another Row Value Expression SPI implementation. + dataSources: + readwrite_ds: + writeDataSourceName: ds_0 + readDataSourceNames: + - ds_1 + - ds_2 + +props: + sql-show: false + diff --git a/infra/nativetest/src/test/resources/yaml/shadow.yaml b/infra/nativetest/src/test/resources/yaml/shadow.yaml new file mode 100644 index 0000000000000..9787e1da06424 --- /dev/null +++ b/infra/nativetest/src/test/resources/yaml/shadow.yaml @@ -0,0 +1,88 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +mode: + type: Standalone + repository: + type: JDBC + +dataSources: + ds_0: + dataSourceClassName: com.zaxxer.hikari.HikariDataSource + driverClassName: org.h2.Driver + jdbcUrl: jdbc:h2:mem:local_shadow_ds_0;MODE=MYSQL;IGNORECASE=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE + username: root + password: 123456 + ds_1: + dataSourceClassName: com.zaxxer.hikari.HikariDataSource + driverClassName: org.h2.Driver + jdbcUrl: jdbc:h2:mem:local_shadow_ds_1;MODE=MYSQL;IGNORECASE=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE + username: root + password: 123456 + +rules: +- !SHADOW + dataSources: + shadow-data-source: + productionDataSourceName: ds_0 + shadowDataSourceName: ds_1 + tables: + t_order: + dataSourceNames: + - shadow-data-source + shadowAlgorithmNames: + - order-type-insert-match-algorithm + - order-type-delete-match-algorithm + - order-type-select-match-algorithm + - sql-hint-algorithm + shadowAlgorithms: + order-type-insert-match-algorithm: + type: VALUE_MATCH + props: + operation: insert + column: order_type + value: "1" + order-type-delete-match-algorithm: + type: VALUE_MATCH + props: + operation: delete + column: order_type + value: "1" + order-type-select-match-algorithm: + type: VALUE_MATCH + props: + operation: select + column: order_type + value: "1" + sql-hint-algorithm: + type: SQL_HINT + props: + shadow: true + foo: bar + defaultShadowAlgorithmName: sql-hint-algorithm + +sqlParser: + sqlCommentParseEnabled: true + sqlStatementCache: + initialCapacity: 128 + maximumSize: 1024 + parseTreeCache: + initialCapacity: 2000 + maximumSize: 65535 + +props: + sql-show: false diff --git a/infra/nativetest/src/test/resources/yaml/sharding.yaml b/infra/nativetest/src/test/resources/yaml/sharding.yaml new file mode 100644 index 0000000000000..37d2cf51f2174 --- /dev/null +++ b/infra/nativetest/src/test/resources/yaml/sharding.yaml @@ -0,0 +1,82 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +mode: + type: Standalone + repository: + type: JDBC + +dataSources: + ds_0: + dataSourceClassName: com.zaxxer.hikari.HikariDataSource + driverClassName: org.h2.Driver + jdbcUrl: jdbc:h2:mem:local_sharding_ds_0;MODE=MYSQL;IGNORECASE=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE + username: root + password: 123456 + ds_1: + dataSourceClassName: com.zaxxer.hikari.HikariDataSource + driverClassName: org.h2.Driver + jdbcUrl: jdbc:h2:mem:local_sharding_ds_1;MODE=MYSQL;IGNORECASE=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE + username: root + password: 123456 + ds_2: + dataSourceClassName: com.zaxxer.hikari.HikariDataSource + driverClassName: org.h2.Driver + jdbcUrl: jdbc:h2:mem:local_sharding_ds_2;MODE=MYSQL;IGNORECASE=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE + username: root + password: 123456 + +rules: +- !SHARDING + tables: + t_order: + actualDataNodes: + keyGenerateStrategy: + column: order_id + keyGeneratorName: snowflake + t_order_item: + actualDataNodes: + keyGenerateStrategy: + column: order_item_id + keyGeneratorName: snowflake + defaultDatabaseStrategy: + standard: + shardingColumn: user_id + shardingAlgorithmName: inline + shardingAlgorithms: + # GroovyShell related classes are not available on GraalVM CE 23.0.2 For JDK 17.0.9, + # This CLASS_BASE algorithm class is designed to emulate INLINE's `ds_${user_id % 2}`. + # See https://github.com/oracle/graal/issues/5522 . + inline: + type: CLASS_BASED + props: + strategy: STANDARD + algorithmClassName: org.apache.shardingsphere.infra.nativetest.jdbc.features.algorithm.ClassBasedInlineShardingAlgorithmFixture + keyGenerators: + snowflake: + type: SNOWFLAKE + auditors: + sharding_key_required_auditor: + type: DML_SHARDING_CONDITIONS + +- !BROADCAST + tables: + - t_address + +props: + sql-show: false + diff --git a/infra/pom.xml b/infra/pom.xml index e5b2c38cc7987..61cf88285b360 100644 --- a/infra/pom.xml +++ b/infra/pom.xml @@ -44,5 +44,7 @@ session expr util + reachability-metadata + nativetest diff --git a/infra/reachability-metadata/pom.xml b/infra/reachability-metadata/pom.xml new file mode 100644 index 0000000000000..1d578449de5c1 --- /dev/null +++ b/infra/reachability-metadata/pom.xml @@ -0,0 +1,29 @@ + + + + + 4.0.0 + + org.apache.shardingsphere + shardingsphere-infra + 5.4.2-SNAPSHOT + + shardingsphere-infra-reachability-metadata + ${project.artifactId} + + diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.github.ben-manes.caffeine/caffeine/2.9.3/reflect-config.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.github.ben-manes.caffeine/caffeine/2.9.3/reflect-config.json new file mode 100644 index 0000000000000..995222a3c6b51 --- /dev/null +++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.github.ben-manes.caffeine/caffeine/2.9.3/reflect-config.json @@ -0,0 +1,62 @@ +[ +{ + "condition":{"typeReachable":"com.github.benmanes.caffeine.cache.BBHeader$ReadAndWriteCounterRef"}, + "name":"com.github.benmanes.caffeine.cache.BBHeader$ReadAndWriteCounterRef", + "fields":[{"name":"writeCounter"}] +}, +{ + "condition":{"typeReachable":"com.github.benmanes.caffeine.cache.BBHeader$ReadCounterRef"}, + "name":"com.github.benmanes.caffeine.cache.BBHeader$ReadCounterRef", + "fields":[{"name":"readCounter"}] +}, +{ + "condition":{"typeReachable":"com.github.benmanes.caffeine.cache.BLCHeader$DrainStatusRef"}, + "name":"com.github.benmanes.caffeine.cache.BLCHeader$DrainStatusRef", + "fields":[{"name":"drainStatus"}] +}, +{ + "condition":{"typeReachable":"com.github.benmanes.caffeine.cache.BaseMpscLinkedArrayQueue"}, + "name":"com.github.benmanes.caffeine.cache.BaseMpscLinkedArrayQueueColdProducerFields", + "fields":[{"name":"producerLimit"}] +}, +{ + "condition":{"typeReachable":"com.github.benmanes.caffeine.cache.BaseMpscLinkedArrayQueue"}, + "name":"com.github.benmanes.caffeine.cache.BaseMpscLinkedArrayQueueConsumerFields", + "fields":[{"name":"consumerIndex"}] +}, +{ + "condition":{"typeReachable":"com.github.benmanes.caffeine.cache.BaseMpscLinkedArrayQueue"}, + "name":"com.github.benmanes.caffeine.cache.BaseMpscLinkedArrayQueueProducerFields", + "fields":[{"name":"producerIndex"}] +}, +{ + "condition":{"typeReachable":"com.github.benmanes.caffeine.cache.LocalLoadingCache"}, + "name":"com.github.benmanes.caffeine.cache.CacheLoader", + "methods":[{"name":"loadAll","parameterTypes":["java.lang.Iterable"] }] +}, +{ + "condition":{"typeReachable":"com.github.benmanes.caffeine.cache.PD"}, + "name":"com.github.benmanes.caffeine.cache.PD", + "fields":[{"name":"value"}] +}, +{ + "condition":{"typeReachable":"com.github.benmanes.caffeine.cache.NodeFactory"}, + "name":"com.github.benmanes.caffeine.cache.PDMS", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"com.github.benmanes.caffeine.cache.LocalCacheFactory"}, + "name":"com.github.benmanes.caffeine.cache.SIMS", + "methods":[{"name":"","parameterTypes":["com.github.benmanes.caffeine.cache.Caffeine","com.github.benmanes.caffeine.cache.CacheLoader","boolean"] }] +}, +{ + "condition":{"typeReachable":"com.github.benmanes.caffeine.cache.StripedBuffer"}, + "name":"com.github.benmanes.caffeine.cache.StripedBuffer", + "fields":[{"name":"tableBusy"}] +}, +{ + "condition":{"typeReachable":"com.github.benmanes.caffeine.cache.StripedBuffer"}, + "name":"java.lang.Thread", + "fields":[{"name":"threadLocalRandomProbe"}] +} +] diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.zaxxer/HikariCP/4.0.3/reflect-config.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.zaxxer/HikariCP/4.0.3/reflect-config.json new file mode 100644 index 0000000000000..9022218575148 --- /dev/null +++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/com.zaxxer/HikariCP/4.0.3/reflect-config.json @@ -0,0 +1,20 @@ +[ +{ + "condition":{"typeReachable":"com.zaxxer.hikari.HikariConfig"}, + "name":"com.zaxxer.hikari.HikariConfig", + "queryAllPublicMethods":true, + "fields":[{"name":"dataSourceProperties"}, {"name":"jdbcUrl"}], + "methods":[{"name":"getCatalog","parameterTypes":[] }, {"name":"getConnectionInitSql","parameterTypes":[] }, {"name":"getConnectionTestQuery","parameterTypes":[] }, {"name":"getConnectionTimeout","parameterTypes":[] }, {"name":"getDataSource","parameterTypes":[] }, {"name":"getDataSourceClassName","parameterTypes":[] }, {"name":"getDataSourceJNDI","parameterTypes":[] }, {"name":"getDataSourceProperties","parameterTypes":[] }, {"name":"getDriverClassName","parameterTypes":[] }, {"name":"getExceptionOverrideClassName","parameterTypes":[] }, {"name":"getHealthCheckProperties","parameterTypes":[] }, {"name":"getHealthCheckRegistry","parameterTypes":[] }, {"name":"getIdleTimeout","parameterTypes":[] }, {"name":"getInitializationFailTimeout","parameterTypes":[] }, {"name":"getJdbcUrl","parameterTypes":[] }, {"name":"getKeepaliveTime","parameterTypes":[] }, {"name":"getLeakDetectionThreshold","parameterTypes":[] }, {"name":"getMaxLifetime","parameterTypes":[] }, {"name":"getMaximumPoolSize","parameterTypes":[] }, {"name":"getMetricRegistry","parameterTypes":[] }, {"name":"getMetricsTrackerFactory","parameterTypes":[] }, {"name":"getMinimumIdle","parameterTypes":[] }, {"name":"getPassword","parameterTypes":[] }, {"name":"getPoolName","parameterTypes":[] }, {"name":"getScheduledExecutor","parameterTypes":[] }, {"name":"getSchema","parameterTypes":[] }, {"name":"getThreadFactory","parameterTypes":[] }, {"name":"getTransactionIsolation","parameterTypes":[] }, {"name":"getUsername","parameterTypes":[] }, {"name":"getValidationTimeout","parameterTypes":[] }, {"name":"isAllowPoolSuspension","parameterTypes":[] }, {"name":"isAutoCommit","parameterTypes":[] }, {"name":"isIsolateInternalQueries","parameterTypes":[] }, {"name":"isReadOnly","parameterTypes":[] }, {"name":"isRegisterMbeans","parameterTypes":[] }, {"name":"setAllowPoolSuspension","parameterTypes":["boolean"] }, {"name":"setAutoCommit","parameterTypes":["boolean"] }, {"name":"setCatalog","parameterTypes":["java.lang.String"] }, {"name":"setClass","parameterTypes":["java.lang.Class"] }, {"name":"setConnectionInitSql","parameterTypes":["java.lang.String"] }, {"name":"setConnectionTestQuery","parameterTypes":["java.lang.String"] }, {"name":"setConnectionTimeout","parameterTypes":["long"] }, {"name":"setDataSource","parameterTypes":["javax.sql.DataSource"] }, {"name":"setDataSourceClassName","parameterTypes":["java.lang.String"] }, {"name":"setDataSourceJNDI","parameterTypes":["java.lang.String"] }, {"name":"setDataSourceProperties","parameterTypes":["java.util.Properties"] }, {"name":"setDriverClassName","parameterTypes":["java.lang.String"] }, {"name":"setExceptionOverrideClassName","parameterTypes":["java.lang.String"] }, {"name":"setHealthCheckProperties","parameterTypes":["java.util.Properties"] }, {"name":"setHealthCheckRegistry","parameterTypes":["java.lang.Object"] }, {"name":"setIdleTimeout","parameterTypes":["long"] }, {"name":"setInitializationFailTimeout","parameterTypes":["long"] }, {"name":"setIsolateInternalQueries","parameterTypes":["boolean"] }, {"name":"setJdbcUrl","parameterTypes":["java.lang.String"] }, {"name":"setKeepaliveTime","parameterTypes":["long"] }, {"name":"setLeakDetectionThreshold","parameterTypes":["long"] }, {"name":"setMaxLifetime","parameterTypes":["long"] }, {"name":"setMaximumPoolSize","parameterTypes":["int"] }, {"name":"setMetricRegistry","parameterTypes":["java.lang.Object"] }, {"name":"setMetricsTrackerFactory","parameterTypes":["com.zaxxer.hikari.metrics.MetricsTrackerFactory"] }, {"name":"setMinimumIdle","parameterTypes":["int"] }, {"name":"setPassword","parameterTypes":["java.lang.String"] }, {"name":"setPoolName","parameterTypes":["java.lang.String"] }, {"name":"setReadOnly","parameterTypes":["boolean"] }, {"name":"setRegisterMbeans","parameterTypes":["boolean"] }, {"name":"setScheduledExecutor","parameterTypes":["java.util.concurrent.ScheduledExecutorService"] }, {"name":"setSchema","parameterTypes":["java.lang.String"] }, {"name":"setThreadFactory","parameterTypes":["java.util.concurrent.ThreadFactory"] }, {"name":"setTransactionIsolation","parameterTypes":["java.lang.String"] }, {"name":"setUsername","parameterTypes":["java.lang.String"] }, {"name":"setValidationTimeout","parameterTypes":["long"] }] +}, +{ + "condition":{"typeReachable":"com.zaxxer.hikari.HikariDataSource"}, + "name":"com.zaxxer.hikari.HikariDataSource", + "fields":[{"name":"dataSourceProperties"}, {"name":"jdbcUrl"}], + "methods":[{"name":"","parameterTypes":[] }, {"name":"getAllowPoolSuspension","parameterTypes":[] }, {"name":"getAutoCommit","parameterTypes":[] }, {"name":"getIsolateInternalQueries","parameterTypes":[] }, {"name":"getReadOnly","parameterTypes":[] }, {"name":"getRegisterMbeans","parameterTypes":[] }, {"name":"isClosed","parameterTypes":[] }, {"name":"isRunning","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"com.zaxxer.hikari.util.PropertyElf"}, + "name":"com.zaxxer.hikari.HikariDataSource", + "methods":[{"name":"getAllowPoolSuspension","parameterTypes":[] }, {"name":"getAutoCommit","parameterTypes":[] }, {"name":"getIsolateInternalQueries","parameterTypes":[] }, {"name":"getReadOnly","parameterTypes":[] }, {"name":"getRegisterMbeans","parameterTypes":[] }] +} +] diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.calcite/calcite-core/1.35.0/reflect-config.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.calcite/calcite-core/1.35.0/reflect-config.json new file mode 100644 index 0000000000000..5563fa603270a --- /dev/null +++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.calcite/calcite-core/1.35.0/reflect-config.json @@ -0,0 +1,797 @@ +[ +{ + "condition":{"typeReachable":"org.apache.calcite.plan.RelOptCluster"}, + "name":"[B" +}, +{ + "condition":{"typeReachable":"org.apache.calcite.plan.RelOptCluster"}, + "name":"[Ljava.lang.String;" +}, +{ + "condition":{"typeReachable":"org.apache.calcite.plan.RelOptCluster"}, + "name":"[Lsun.security.pkcs.SignerInfo;" +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"java.lang.Boolean", + "fields":[{"name":"FALSE"}, {"name":"TRUE"}] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.DataContext", + "methods":[{"name":"get","parameterTypes":["java.lang.String"] }, {"name":"getQueryProvider","parameterTypes":[] }, {"name":"getRootSchema","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.adapter.enumerable.AggregateLambdaFactory", + "methods":[{"name":"accumulatorAdder","parameterTypes":[] }, {"name":"accumulatorInitializer","parameterTypes":[] }, {"name":"resultSelector","parameterTypes":["org.apache.calcite.linq4j.function.Function2"] }, {"name":"singleGroupResultSelector","parameterTypes":["org.apache.calcite.linq4j.function.Function1"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.adapter.enumerable.BasicAggregateLambdaFactory", + "queryAllDeclaredConstructors":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.adapter.enumerable.BasicLazyAccumulator", + "queryAllDeclaredConstructors":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.adapter.enumerable.EnumUtils", + "methods":[{"name":"hopping","parameterTypes":["org.apache.calcite.linq4j.Enumerator","int","long","long","long"] }, {"name":"sessionize","parameterTypes":["org.apache.calcite.linq4j.Enumerator","int","int","long"] }, {"name":"tumbling","parameterTypes":["org.apache.calcite.linq4j.Enumerable","org.apache.calcite.linq4j.function.Function1"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.adapter.enumerable.LazyAggregateLambdaFactory", + "queryAllDeclaredConstructors":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.adapter.enumerable.MatchUtils", + "methods":[{"name":"lastWithSymbol","parameterTypes":["java.lang.String","java.util.List","java.util.List","int"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.adapter.enumerable.RexImpTable$Builder"}, + "name":"org.apache.calcite.adapter.enumerable.RexImpTable$ArgMinMaxImplementor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.adapter.enumerable.RexImpTable$Builder"}, + "name":"org.apache.calcite.adapter.enumerable.RexImpTable$BitOpImplementor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.adapter.enumerable.RexImpTable$Builder"}, + "name":"org.apache.calcite.adapter.enumerable.RexImpTable$CollectImplementor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.adapter.enumerable.RexImpTable$Builder"}, + "name":"org.apache.calcite.adapter.enumerable.RexImpTable$CountImplementor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.adapter.enumerable.RexImpTable$Builder"}, + "name":"org.apache.calcite.adapter.enumerable.RexImpTable$CountWinImplementor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.adapter.enumerable.RexImpTable$Builder"}, + "name":"org.apache.calcite.adapter.enumerable.RexImpTable$DenseRankImplementor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.adapter.enumerable.RexImpTable$Builder"}, + "name":"org.apache.calcite.adapter.enumerable.RexImpTable$FirstValueImplementor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.adapter.enumerable.RexImpTable$Builder"}, + "name":"org.apache.calcite.adapter.enumerable.RexImpTable$FusionImplementor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.adapter.enumerable.RexImpTable$Builder"}, + "name":"org.apache.calcite.adapter.enumerable.RexImpTable$GroupingImplementor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.adapter.enumerable.RexImpTable$Builder"}, + "name":"org.apache.calcite.adapter.enumerable.RexImpTable$IntersectionImplementor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.adapter.enumerable.RexImpTable$Builder"}, + "name":"org.apache.calcite.adapter.enumerable.RexImpTable$LagImplementor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.adapter.enumerable.RexImpTable$Builder"}, + "name":"org.apache.calcite.adapter.enumerable.RexImpTable$LastValueImplementor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.adapter.enumerable.RexImpTable$Builder"}, + "name":"org.apache.calcite.adapter.enumerable.RexImpTable$LeadImplementor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.adapter.enumerable.RexImpTable$Builder"}, + "name":"org.apache.calcite.adapter.enumerable.RexImpTable$ListaggImplementor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.adapter.enumerable.RexImpTable$Builder"}, + "name":"org.apache.calcite.adapter.enumerable.RexImpTable$LiteralAggImplementor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.adapter.enumerable.RexImpTable$Builder"}, + "name":"org.apache.calcite.adapter.enumerable.RexImpTable$MinMaxImplementor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.adapter.enumerable.RexImpTable$Builder"}, + "name":"org.apache.calcite.adapter.enumerable.RexImpTable$ModeImplementor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.adapter.enumerable.RexImpTable$Builder"}, + "name":"org.apache.calcite.adapter.enumerable.RexImpTable$NthValueImplementor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.adapter.enumerable.RexImpTable$Builder"}, + "name":"org.apache.calcite.adapter.enumerable.RexImpTable$NtileImplementor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.adapter.enumerable.RexImpTable$Builder"}, + "name":"org.apache.calcite.adapter.enumerable.RexImpTable$RankImplementor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.adapter.enumerable.RexImpTable$Builder"}, + "name":"org.apache.calcite.adapter.enumerable.RexImpTable$RowNumberImplementor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.adapter.enumerable.RexImpTable$Builder"}, + "name":"org.apache.calcite.adapter.enumerable.RexImpTable$SingleValueImplementor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.adapter.enumerable.RexImpTable$Builder"}, + "name":"org.apache.calcite.adapter.enumerable.RexImpTable$SumImplementor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.adapter.enumerable.SourceSorter", + "queryAllDeclaredConstructors":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.adapter.java.ReflectiveSchema", + "methods":[{"name":"getTarget","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.adapter.jdbc.JdbcSchema", + "methods":[{"name":"getDataSource","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.avatica.remote.Driver"}, + "name":"org.apache.calcite.avatica.AvaticaJdbc41Factory", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.avatica.util.DateTimeUtils", + "queryAllPublicMethods":true, + "methods":[{"name":"addMonths","parameterTypes":["int","int"] }, {"name":"addMonths","parameterTypes":["long","int"] }, {"name":"dateStringToUnixDate","parameterTypes":["java.lang.String"] }, {"name":"intervalDayTimeToString","parameterTypes":["long","org.apache.calcite.avatica.util.TimeUnitRange","int"] }, {"name":"intervalYearMonthToString","parameterTypes":["int","org.apache.calcite.avatica.util.TimeUnitRange"] }, {"name":"lastDay","parameterTypes":["int"] }, {"name":"subtractMonths","parameterTypes":["long","long"] }, {"name":"timeStringToUnixDate","parameterTypes":["java.lang.String"] }, {"name":"timestampStringToUnixDate","parameterTypes":["java.lang.String"] }, {"name":"unixDateCeil","parameterTypes":["org.apache.calcite.avatica.util.TimeUnitRange","int"] }, {"name":"unixDateExtract","parameterTypes":["org.apache.calcite.avatica.util.TimeUnitRange","long"] }, {"name":"unixDateFloor","parameterTypes":["org.apache.calcite.avatica.util.TimeUnitRange","int"] }, {"name":"unixDateToString","parameterTypes":["int"] }, {"name":"unixTimeToString","parameterTypes":["int"] }, {"name":"unixTimestampCeil","parameterTypes":["org.apache.calcite.avatica.util.TimeUnitRange","long"] }, {"name":"unixTimestampFloor","parameterTypes":["org.apache.calcite.avatica.util.TimeUnitRange","long"] }, {"name":"unixTimestampToString","parameterTypes":["long"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.interpreter.Context", + "fields":[{"name":"root"}, {"name":"values"}] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.interpreter.Row", + "methods":[{"name":"asCopy","parameterTypes":["java.lang.Object[]"] }, {"name":"getObject","parameterTypes":["int"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.interpreter.Scalar", + "methods":[{"name":"execute","parameterTypes":["org.apache.calcite.interpreter.Context"] }, {"name":"execute","parameterTypes":["org.apache.calcite.interpreter.Context","java.lang.Object[]"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.jdbc.Driver"}, + "name":"org.apache.calcite.jdbc.CalciteJdbc41Factory", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.linq4j.AbstractEnumerable", + "queryAllDeclaredConstructors":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.linq4j.Enumerable", + "methods":[{"name":"asQueryable","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.linq4j.EnumerableDefaults", + "methods":[{"name":"antiJoin","parameterTypes":["org.apache.calcite.linq4j.Enumerable","org.apache.calcite.linq4j.Enumerable","org.apache.calcite.linq4j.function.Function1","org.apache.calcite.linq4j.function.Function1","org.apache.calcite.linq4j.function.EqualityComparer","org.apache.calcite.linq4j.function.Predicate2"] }, {"name":"correlateBatchJoin","parameterTypes":["org.apache.calcite.linq4j.JoinType","org.apache.calcite.linq4j.Enumerable","org.apache.calcite.linq4j.function.Function1","org.apache.calcite.linq4j.function.Function2","org.apache.calcite.linq4j.function.Predicate2","int"] }, {"name":"groupByMultiple","parameterTypes":["org.apache.calcite.linq4j.Enumerable","java.util.List","org.apache.calcite.linq4j.function.Function0","org.apache.calcite.linq4j.function.Function2","org.apache.calcite.linq4j.function.Function2"] }, {"name":"lazyCollectionSpool","parameterTypes":["java.util.Collection","org.apache.calcite.linq4j.Enumerable"] }, {"name":"mergeJoin","parameterTypes":["org.apache.calcite.linq4j.Enumerable","org.apache.calcite.linq4j.Enumerable","org.apache.calcite.linq4j.function.Function1","org.apache.calcite.linq4j.function.Function1","org.apache.calcite.linq4j.function.Predicate2","org.apache.calcite.linq4j.function.Function2","org.apache.calcite.linq4j.JoinType","java.util.Comparator"] }, {"name":"mergeUnion","parameterTypes":["java.util.List","org.apache.calcite.linq4j.function.Function1","java.util.Comparator","boolean","org.apache.calcite.linq4j.function.EqualityComparer"] }, {"name":"nestedLoopJoin","parameterTypes":["org.apache.calcite.linq4j.Enumerable","org.apache.calcite.linq4j.Enumerable","org.apache.calcite.linq4j.function.Predicate2","org.apache.calcite.linq4j.function.Function2","org.apache.calcite.linq4j.JoinType"] }, {"name":"orderBy","parameterTypes":["org.apache.calcite.linq4j.Enumerable","org.apache.calcite.linq4j.function.Function1","java.util.Comparator","int","int"] }, {"name":"repeatUnion","parameterTypes":["org.apache.calcite.linq4j.Enumerable","org.apache.calcite.linq4j.Enumerable","int","boolean","org.apache.calcite.linq4j.function.EqualityComparer","org.apache.calcite.linq4j.function.Function0"] }, {"name":"semiJoin","parameterTypes":["org.apache.calcite.linq4j.Enumerable","org.apache.calcite.linq4j.Enumerable","org.apache.calcite.linq4j.function.Function1","org.apache.calcite.linq4j.function.Function1","org.apache.calcite.linq4j.function.EqualityComparer","org.apache.calcite.linq4j.function.Predicate2"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.linq4j.Enumerator", + "methods":[{"name":"close","parameterTypes":[] }, {"name":"current","parameterTypes":[] }, {"name":"moveNext","parameterTypes":[] }, {"name":"reset","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.linq4j.ExtendedEnumerable", + "methods":[{"name":"aggregate","parameterTypes":["java.lang.Object","org.apache.calcite.linq4j.function.Function2","org.apache.calcite.linq4j.function.Function1"] }, {"name":"asEnumerable","parameterTypes":[] }, {"name":"concat","parameterTypes":["org.apache.calcite.linq4j.Enumerable"] }, {"name":"correlateJoin","parameterTypes":["org.apache.calcite.linq4j.JoinType","org.apache.calcite.linq4j.function.Function1","org.apache.calcite.linq4j.function.Function2"] }, {"name":"distinct","parameterTypes":[] }, {"name":"distinct","parameterTypes":["org.apache.calcite.linq4j.function.EqualityComparer"] }, {"name":"except","parameterTypes":["org.apache.calcite.linq4j.Enumerable","boolean"] }, {"name":"foreach","parameterTypes":["org.apache.calcite.linq4j.function.Function1"] }, {"name":"groupBy","parameterTypes":["org.apache.calcite.linq4j.function.Function1"] }, {"name":"groupBy","parameterTypes":["org.apache.calcite.linq4j.function.Function1","org.apache.calcite.linq4j.function.Function0","org.apache.calcite.linq4j.function.Function2","org.apache.calcite.linq4j.function.Function2"] }, {"name":"hashJoin","parameterTypes":["org.apache.calcite.linq4j.Enumerable","org.apache.calcite.linq4j.function.Function1","org.apache.calcite.linq4j.function.Function1","org.apache.calcite.linq4j.function.Function2","org.apache.calcite.linq4j.function.EqualityComparer","boolean","boolean","org.apache.calcite.linq4j.function.Predicate2"] }, {"name":"intersect","parameterTypes":["org.apache.calcite.linq4j.Enumerable","boolean"] }, {"name":"into","parameterTypes":["java.util.Collection"] }, {"name":"orderBy","parameterTypes":["org.apache.calcite.linq4j.function.Function1","java.util.Comparator"] }, {"name":"removeAll","parameterTypes":["java.util.Collection"] }, {"name":"select","parameterTypes":["org.apache.calcite.linq4j.function.Function1"] }, {"name":"select","parameterTypes":["org.apache.calcite.linq4j.function.Function2"] }, {"name":"selectMany","parameterTypes":["org.apache.calcite.linq4j.function.Function1"] }, {"name":"skip","parameterTypes":["int"] }, {"name":"sortedGroupBy","parameterTypes":["org.apache.calcite.linq4j.function.Function1","org.apache.calcite.linq4j.function.Function0","org.apache.calcite.linq4j.function.Function2","org.apache.calcite.linq4j.function.Function2","java.util.Comparator"] }, {"name":"take","parameterTypes":["int"] }, {"name":"toList","parameterTypes":[] }, {"name":"union","parameterTypes":["org.apache.calcite.linq4j.Enumerable"] }, {"name":"where","parameterTypes":["org.apache.calcite.linq4j.function.Predicate1"] }, {"name":"where","parameterTypes":["org.apache.calcite.linq4j.function.Predicate2"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.linq4j.ExtendedQueryable", + "methods":[{"name":"select","parameterTypes":["org.apache.calcite.linq4j.tree.FunctionExpression"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.linq4j.Linq4j", + "methods":[{"name":"asEnumerable","parameterTypes":["java.lang.Iterable"] }, {"name":"asEnumerable","parameterTypes":["java.lang.Object[]"] }, {"name":"emptyEnumerable","parameterTypes":[] }, {"name":"singletonEnumerable","parameterTypes":["java.lang.Object"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.linq4j.MemoryFactory$Memory", + "methods":[{"name":"get","parameterTypes":[] }, {"name":"get","parameterTypes":["int"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.linq4j.Queryable" +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.linq4j.RawEnumerable", + "methods":[{"name":"enumerator","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.linq4j.function.Function0", + "methods":[{"name":"apply","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.linq4j.function.Function1", + "methods":[{"name":"apply","parameterTypes":["java.lang.Object"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.linq4j.function.Functions", + "methods":[{"name":"all","parameterTypes":["java.util.List","org.apache.calcite.linq4j.function.Predicate1"] }, {"name":"arrayComparer","parameterTypes":[] }, {"name":"exists","parameterTypes":["java.util.List","org.apache.calcite.linq4j.function.Predicate1"] }, {"name":"identityComparer","parameterTypes":[] }, {"name":"identitySelector","parameterTypes":[] }, {"name":"nullsComparator","parameterTypes":["boolean","boolean"] }, {"name":"nullsComparator","parameterTypes":["boolean","boolean","java.util.Comparator"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.linq4j.tree.Primitive", + "methods":[{"name":"asList","parameterTypes":["java.lang.Object"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$AllPredicates", + "methods":[{"name":"getAllPredicates","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$AllPredicates"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$AllPredicates$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$Collation", + "methods":[{"name":"collations","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$Collation"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$Collation$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$ColumnOrigin", + "methods":[{"name":"getColumnOrigins","parameterTypes":["int"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$ColumnOrigin"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$ColumnOrigin$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$ColumnUniqueness", + "methods":[{"name":"areColumnsUnique","parameterTypes":["org.apache.calcite.util.ImmutableBitSet","boolean"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$ColumnUniqueness"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$ColumnUniqueness$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$CumulativeCost", + "methods":[{"name":"getCumulativeCost","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$CumulativeCost"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$CumulativeCost$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$DistinctRowCount", + "methods":[{"name":"getDistinctRowCount","parameterTypes":["org.apache.calcite.util.ImmutableBitSet","org.apache.calcite.rex.RexNode"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$DistinctRowCount"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$DistinctRowCount$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$Distribution", + "methods":[{"name":"distribution","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$Distribution"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$Distribution$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$ExplainVisibility", + "methods":[{"name":"isVisibleInExplain","parameterTypes":["org.apache.calcite.sql.SqlExplainLevel"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$ExplainVisibility"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$ExplainVisibility$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$ExpressionLineage", + "methods":[{"name":"getExpressionLineage","parameterTypes":["org.apache.calcite.rex.RexNode"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$ExpressionLineage"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$ExpressionLineage$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$LowerBoundCost", + "methods":[{"name":"getLowerBoundCost","parameterTypes":["org.apache.calcite.plan.volcano.VolcanoPlanner"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$LowerBoundCost"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$LowerBoundCost$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$MaxRowCount", + "methods":[{"name":"getMaxRowCount","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$MaxRowCount"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$MaxRowCount$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$Memory", + "methods":[{"name":"cumulativeMemoryWithinPhase","parameterTypes":[] }, {"name":"cumulativeMemoryWithinPhaseSplit","parameterTypes":[] }, {"name":"memory","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$Memory"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$Memory$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$MinRowCount", + "methods":[{"name":"getMinRowCount","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$MinRowCount"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$MinRowCount$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$NodeTypes", + "methods":[{"name":"getNodeTypes","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$NodeTypes"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$NodeTypes$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$NonCumulativeCost", + "methods":[{"name":"getNonCumulativeCost","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$NonCumulativeCost"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$NonCumulativeCost$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$Parallelism", + "methods":[{"name":"isPhaseTransition","parameterTypes":[] }, {"name":"splitCount","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$Parallelism"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$Parallelism$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$PercentageOriginalRows", + "methods":[{"name":"getPercentageOriginalRows","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$PercentageOriginalRows"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$PercentageOriginalRows$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$PopulationSize", + "methods":[{"name":"getPopulationSize","parameterTypes":["org.apache.calcite.util.ImmutableBitSet"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$PopulationSize"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$PopulationSize$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$Predicates", + "methods":[{"name":"getPredicates","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$Predicates"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$Predicates$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$RowCount", + "methods":[{"name":"getRowCount","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$RowCount"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$RowCount$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$Selectivity", + "methods":[{"name":"getSelectivity","parameterTypes":["org.apache.calcite.rex.RexNode"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$Selectivity"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$Selectivity$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$Size", + "methods":[{"name":"averageColumnSizes","parameterTypes":[] }, {"name":"averageRowSize","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$Size"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$Size$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$TableReferences", + "methods":[{"name":"getTableReferences","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$TableReferences"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$TableReferences$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$UniqueKeys", + "methods":[{"name":"getUniqueKeys","parameterTypes":["boolean"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.BuiltInMetadata$UniqueKeys"}, + "name":"org.apache.calcite.rel.metadata.BuiltInMetadata$UniqueKeys$Handler", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.rel.metadata.Metadata", + "methods":[{"name":"rel","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdAllPredicates"}, + "name":"org.apache.calcite.rel.metadata.RelMdAllPredicates", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdCollation"}, + "name":"org.apache.calcite.rel.metadata.RelMdCollation", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdColumnOrigins"}, + "name":"org.apache.calcite.rel.metadata.RelMdColumnOrigins", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdColumnUniqueness"}, + "name":"org.apache.calcite.rel.metadata.RelMdColumnUniqueness", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdDistinctRowCount"}, + "name":"org.apache.calcite.rel.metadata.RelMdDistinctRowCount", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdDistribution"}, + "name":"org.apache.calcite.rel.metadata.RelMdDistribution", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdExplainVisibility"}, + "name":"org.apache.calcite.rel.metadata.RelMdExplainVisibility", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdExpressionLineage"}, + "name":"org.apache.calcite.rel.metadata.RelMdExpressionLineage", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdLowerBoundCost"}, + "name":"org.apache.calcite.rel.metadata.RelMdLowerBoundCost", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdMaxRowCount"}, + "name":"org.apache.calcite.rel.metadata.RelMdMaxRowCount", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdMemory"}, + "name":"org.apache.calcite.rel.metadata.RelMdMemory", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdMinRowCount"}, + "name":"org.apache.calcite.rel.metadata.RelMdMinRowCount", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdNodeTypes"}, + "name":"org.apache.calcite.rel.metadata.RelMdNodeTypes", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdParallelism"}, + "name":"org.apache.calcite.rel.metadata.RelMdParallelism", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdPercentageOriginalRows"}, + "name":"org.apache.calcite.rel.metadata.RelMdPercentageOriginalRows$RelMdCumulativeCost", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdPercentageOriginalRows"}, + "name":"org.apache.calcite.rel.metadata.RelMdPercentageOriginalRows$RelMdNonCumulativeCost", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdPercentageOriginalRows"}, + "name":"org.apache.calcite.rel.metadata.RelMdPercentageOriginalRows$RelMdPercentageOriginalRowsHandler", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdPopulationSize"}, + "name":"org.apache.calcite.rel.metadata.RelMdPopulationSize", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdPredicates"}, + "name":"org.apache.calcite.rel.metadata.RelMdPredicates", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdRowCount"}, + "name":"org.apache.calcite.rel.metadata.RelMdRowCount", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdSelectivity"}, + "name":"org.apache.calcite.rel.metadata.RelMdSelectivity", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdSize"}, + "name":"org.apache.calcite.rel.metadata.RelMdSize", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdTableReferences"}, + "name":"org.apache.calcite.rel.metadata.RelMdTableReferences", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.rel.metadata.RelMdUniqueKeys"}, + "name":"org.apache.calcite.rel.metadata.RelMdUniqueKeys", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.runtime.ArrayBindable", + "methods":[{"name":"getElementType","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.runtime.BinarySearch", + "methods":[{"name":"lowerBound","parameterTypes":["java.lang.Object[]","java.lang.Object","int","int","java.util.Comparator"] }, {"name":"lowerBound","parameterTypes":["java.lang.Object[]","java.lang.Object","int","int","org.apache.calcite.linq4j.function.Function1","java.util.Comparator"] }, {"name":"upperBound","parameterTypes":["java.lang.Object[]","java.lang.Object","int","int","java.util.Comparator"] }, {"name":"upperBound","parameterTypes":["java.lang.Object[]","java.lang.Object","int","int","org.apache.calcite.linq4j.function.Function1","java.util.Comparator"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.runtime.Bindable", + "methods":[{"name":"bind","parameterTypes":["org.apache.calcite.DataContext"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.runtime.CompressionFunctions", + "methods":[{"name":"compress","parameterTypes":["java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.runtime.Enumerables", + "methods":[{"name":"match","parameterTypes":["org.apache.calcite.linq4j.Enumerable","org.apache.calcite.linq4j.function.Function1","org.apache.calcite.runtime.Matcher","org.apache.calcite.runtime.Enumerables$Emitter","int","int"] }, {"name":"slice0","parameterTypes":["org.apache.calcite.linq4j.Enumerable"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.runtime.Enumerables$Emitter", + "methods":[{"name":"emit","parameterTypes":["java.util.List","java.util.List","java.util.List","int","java.util.function.Consumer"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.runtime.FlatLists", + "fields":[{"name":"COMPARABLE_EMPTY_LIST"}], + "methods":[{"name":"copyOf","parameterTypes":["java.lang.Comparable[]"] }, {"name":"of","parameterTypes":["java.lang.Object","java.lang.Object"] }, {"name":"of","parameterTypes":["java.lang.Object","java.lang.Object","java.lang.Object"] }, {"name":"of","parameterTypes":["java.lang.Object","java.lang.Object","java.lang.Object","java.lang.Object"] }, {"name":"of","parameterTypes":["java.lang.Object","java.lang.Object","java.lang.Object","java.lang.Object","java.lang.Object"] }, {"name":"of","parameterTypes":["java.lang.Object","java.lang.Object","java.lang.Object","java.lang.Object","java.lang.Object","java.lang.Object"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.runtime.FunctionContexts", + "methods":[{"name":"of","parameterTypes":["org.apache.calcite.DataContext","java.lang.Object[]"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.runtime.JsonFunctions", + "queryAllPublicMethods":true, + "methods":[{"name":"dejsonize","parameterTypes":["java.lang.String"] }, {"name":"isJsonArray","parameterTypes":["java.lang.String"] }, {"name":"isJsonObject","parameterTypes":["java.lang.String"] }, {"name":"isJsonScalar","parameterTypes":["java.lang.String"] }, {"name":"isJsonValue","parameterTypes":["java.lang.String"] }, {"name":"jsonApiCommonSyntax","parameterTypes":["java.lang.String","java.lang.String"] }, {"name":"jsonArray","parameterTypes":["org.apache.calcite.sql.SqlJsonConstructorNullClause"] }, {"name":"jsonArrayAggAdd","parameterTypes":["java.util.List","java.lang.Object","org.apache.calcite.sql.SqlJsonConstructorNullClause"] }, {"name":"jsonDepth","parameterTypes":["java.lang.String"] }, {"name":"jsonExists","parameterTypes":["java.lang.String","java.lang.String"] }, {"name":"jsonInsert","parameterTypes":["java.lang.String","java.lang.Object"] }, {"name":"jsonKeys","parameterTypes":["java.lang.String"] }, {"name":"jsonLength","parameterTypes":["java.lang.String"] }, {"name":"jsonObject","parameterTypes":["org.apache.calcite.sql.SqlJsonConstructorNullClause"] }, {"name":"jsonObjectAggAdd","parameterTypes":["java.util.Map","java.lang.String","java.lang.Object","org.apache.calcite.sql.SqlJsonConstructorNullClause"] }, {"name":"jsonPretty","parameterTypes":["java.lang.String"] }, {"name":"jsonQuery","parameterTypes":["java.lang.String","java.lang.String","org.apache.calcite.sql.SqlJsonQueryWrapperBehavior","org.apache.calcite.sql.SqlJsonQueryEmptyOrErrorBehavior","org.apache.calcite.sql.SqlJsonQueryEmptyOrErrorBehavior"] }, {"name":"jsonRemove","parameterTypes":["java.lang.String"] }, {"name":"jsonReplace","parameterTypes":["java.lang.String","java.lang.Object"] }, {"name":"jsonSet","parameterTypes":["java.lang.String","java.lang.Object"] }, {"name":"jsonStorageSize","parameterTypes":["java.lang.String"] }, {"name":"jsonType","parameterTypes":["java.lang.String"] }, {"name":"jsonValue","parameterTypes":["java.lang.String","java.lang.String","org.apache.calcite.sql.SqlJsonValueEmptyOrErrorBehavior","java.lang.Object","org.apache.calcite.sql.SqlJsonValueEmptyOrErrorBehavior","java.lang.Object"] }, {"name":"jsonValueExpression","parameterTypes":["java.lang.String"] }, {"name":"jsonize","parameterTypes":["java.lang.Object"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.runtime.Matcher", + "methods":[{"name":"builder","parameterTypes":["org.apache.calcite.runtime.Automaton"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.runtime.Matcher$Builder", + "methods":[{"name":"add","parameterTypes":["java.lang.String","java.util.function.Predicate"] }, {"name":"build","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.runtime.PairList", + "methods":[{"name":"copyOf","parameterTypes":["java.lang.Object","java.lang.Object","java.lang.Object[]"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.runtime.Pattern$PatternBuilder", + "methods":[{"name":"automaton","parameterTypes":[] }, {"name":"build","parameterTypes":[] }, {"name":"seq","parameterTypes":[] }, {"name":"symbol","parameterTypes":["java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.runtime.RandomFunction", + "methods":[{"name":"rand","parameterTypes":[] }, {"name":"randInteger","parameterTypes":["int"] }, {"name":"randIntegerSeed","parameterTypes":["int","int"] }, {"name":"randSeed","parameterTypes":["int"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.runtime.ResultSetEnumerable", + "methods":[{"name":"createEnricher","parameterTypes":["java.lang.Integer[]","org.apache.calcite.DataContext"] }, {"name":"of","parameterTypes":["javax.sql.DataSource","java.lang.String","org.apache.calcite.linq4j.function.Function1"] }, {"name":"of","parameterTypes":["javax.sql.DataSource","java.lang.String","org.apache.calcite.linq4j.function.Function1","org.apache.calcite.runtime.ResultSetEnumerable$PreparedStatementEnricher"] }, {"name":"setTimeout","parameterTypes":["org.apache.calcite.DataContext"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.runtime.SortedMultiMap", + "methods":[{"name":"arrays","parameterTypes":["java.util.Comparator"] }, {"name":"putMulti","parameterTypes":["java.lang.Object","java.lang.Object"] }, {"name":"singletonArrayIterator","parameterTypes":["java.util.Comparator","java.util.List"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.runtime.SpatialTypeFunctions", + "methods":[{"name":"ST_GeomFromEWKT","parameterTypes":["java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.runtime.SqlFunctions", + "queryAllPublicMethods":true, + "methods":[{"name":"array","parameterTypes":["java.lang.Object[]"] }, {"name":"arrayAppend","parameterTypes":["java.util.List","java.lang.Object"] }, {"name":"arrayExcept","parameterTypes":["java.util.List","java.util.List"] }, {"name":"arrayIntersect","parameterTypes":["java.util.List","java.util.List"] }, {"name":"arrayItemOptional","parameterTypes":["java.util.List","int","int","boolean"] }, {"name":"arrayMax","parameterTypes":["java.util.List"] }, {"name":"arrayMin","parameterTypes":["java.util.List"] }, {"name":"arrayPosition","parameterTypes":["java.util.List","java.lang.Object"] }, {"name":"arrayPrepend","parameterTypes":["java.util.List","java.lang.Object"] }, {"name":"arrayRemove","parameterTypes":["java.util.List","java.lang.Object"] }, {"name":"arrayToList","parameterTypes":["java.sql.Array"] }, {"name":"arrayUnion","parameterTypes":["java.util.List","java.util.List"] }, {"name":"arraysOverlap","parameterTypes":["java.util.List","java.util.List"] }, {"name":"arraysZip","parameterTypes":["java.util.List","java.util.List"] }, {"name":"ascii","parameterTypes":["java.lang.String"] }, {"name":"bitAnd","parameterTypes":["long","long"] }, {"name":"bitLength","parameterTypes":["java.lang.String"] }, {"name":"bitOr","parameterTypes":["long","long"] }, {"name":"bitXor","parameterTypes":["long","long"] }, {"name":"ceil","parameterTypes":["int","int"] }, {"name":"charFromAscii","parameterTypes":["int"] }, {"name":"charFromUtf8","parameterTypes":["int"] }, {"name":"charLength","parameterTypes":["java.lang.String"] }, {"name":"compact","parameterTypes":["java.util.List"] }, {"name":"concat","parameterTypes":["java.lang.String","java.lang.String"] }, {"name":"concatMulti","parameterTypes":["java.lang.String[]"] }, {"name":"concatMultiWithNull","parameterTypes":["java.lang.String[]"] }, {"name":"concatMultiWithSeparator","parameterTypes":["java.lang.String[]"] }, {"name":"concatWithNull","parameterTypes":["java.lang.String","java.lang.String"] }, {"name":"convertWithCharset","parameterTypes":["java.lang.String","java.lang.String","java.lang.String"] }, {"name":"cosh","parameterTypes":["long"] }, {"name":"currentDate","parameterTypes":["org.apache.calcite.DataContext"] }, {"name":"currentTime","parameterTypes":["org.apache.calcite.DataContext"] }, {"name":"currentTimestamp","parameterTypes":["org.apache.calcite.DataContext"] }, {"name":"customDateAdd","parameterTypes":["org.apache.calcite.DataContext","java.lang.String","int","int"] }, {"name":"customDateCeil","parameterTypes":["org.apache.calcite.DataContext","java.lang.String","int"] }, {"name":"customDateDiff","parameterTypes":["org.apache.calcite.DataContext","java.lang.String","int","int"] }, {"name":"customDateFloor","parameterTypes":["org.apache.calcite.DataContext","java.lang.String","int"] }, {"name":"customTimestampAdd","parameterTypes":["org.apache.calcite.DataContext","java.lang.String","long","long"] }, {"name":"customTimestampCeil","parameterTypes":["org.apache.calcite.DataContext","java.lang.String","long"] }, {"name":"customTimestampDiff","parameterTypes":["org.apache.calcite.DataContext","java.lang.String","long","long"] }, {"name":"customTimestampFloor","parameterTypes":["org.apache.calcite.DataContext","java.lang.String","long"] }, {"name":"dayNameWithDate","parameterTypes":["int","java.util.Locale"] }, {"name":"dayNameWithTimestamp","parameterTypes":["long","java.util.Locale"] }, {"name":"difference","parameterTypes":["java.lang.String","java.lang.String"] }, {"name":"distinct","parameterTypes":["java.util.List"] }, {"name":"element","parameterTypes":["java.util.List"] }, {"name":"endsWith","parameterTypes":["java.lang.String","java.lang.String"] }, {"name":"flatList","parameterTypes":[] }, {"name":"flatProduct","parameterTypes":["int[]","boolean","org.apache.calcite.runtime.SqlFunctions$FlatProductInputType[]"] }, {"name":"floor","parameterTypes":["int","int"] }, {"name":"formatDate","parameterTypes":["org.apache.calcite.DataContext","java.lang.String","int"] }, {"name":"formatTime","parameterTypes":["org.apache.calcite.DataContext","java.lang.String","int"] }, {"name":"formatTimestamp","parameterTypes":["org.apache.calcite.DataContext","java.lang.String","long"] }, {"name":"fromBase32","parameterTypes":["java.lang.String"] }, {"name":"fromBase64","parameterTypes":["java.lang.String"] }, {"name":"fromHex","parameterTypes":["java.lang.String"] }, {"name":"greater","parameterTypes":["java.lang.Comparable","java.lang.Comparable"] }, {"name":"gt","parameterTypes":["boolean","boolean"] }, {"name":"gtNullable","parameterTypes":["java.lang.Comparable","java.lang.Comparable"] }, {"name":"ilike","parameterTypes":["java.lang.String","java.lang.String"] }, {"name":"initcap","parameterTypes":["java.lang.String"] }, {"name":"internalToDate","parameterTypes":["int"] }, {"name":"internalToTime","parameterTypes":["int"] }, {"name":"internalToTimestamp","parameterTypes":["long"] }, {"name":"isASet","parameterTypes":["java.util.Collection"] }, {"name":"isNotFalse","parameterTypes":["java.lang.Boolean"] }, {"name":"isTrue","parameterTypes":["java.lang.Boolean"] }, {"name":"itemOptional","parameterTypes":["java.lang.Object","java.lang.Object"] }, {"name":"left","parameterTypes":["java.lang.String","int"] }, {"name":"lesser","parameterTypes":["java.lang.Comparable","java.lang.Comparable"] }, {"name":"like","parameterTypes":["java.lang.String","java.lang.String"] }, {"name":"localTime","parameterTypes":["org.apache.calcite.DataContext"] }, {"name":"localTimestamp","parameterTypes":["org.apache.calcite.DataContext"] }, {"name":"locale","parameterTypes":["org.apache.calcite.DataContext"] }, {"name":"log","parameterTypes":["long","long"] }, {"name":"lower","parameterTypes":["java.lang.String"] }, {"name":"lpad","parameterTypes":["java.lang.String","int","java.lang.String"] }, {"name":"lt","parameterTypes":["boolean","boolean"] }, {"name":"ltNullable","parameterTypes":["java.lang.Comparable","java.lang.Comparable"] }, {"name":"ltrim","parameterTypes":["java.lang.String"] }, {"name":"mapConcat","parameterTypes":["java.util.Map[]"] }, {"name":"mapEntries","parameterTypes":["java.util.Map"] }, {"name":"mapFromArrays","parameterTypes":["java.util.List","java.util.List"] }, {"name":"mapFromEntries","parameterTypes":["java.util.List"] }, {"name":"mapItemOptional","parameterTypes":["java.util.Map","java.lang.Object"] }, {"name":"mapKeys","parameterTypes":["java.util.Map"] }, {"name":"mapValues","parameterTypes":["java.util.Map"] }, {"name":"md5","parameterTypes":["java.lang.String"] }, {"name":"memberOf","parameterTypes":["java.lang.Object","java.util.Collection"] }, {"name":"monthNameWithDate","parameterTypes":["int","java.util.Locale"] }, {"name":"monthNameWithTimestamp","parameterTypes":["long","java.util.Locale"] }, {"name":"multisetExceptAll","parameterTypes":["java.util.Collection","java.util.Collection"] }, {"name":"multisetExceptDistinct","parameterTypes":["java.util.Collection","java.util.Collection"] }, {"name":"multisetIntersectAll","parameterTypes":["java.util.Collection","java.util.Collection"] }, {"name":"multisetIntersectDistinct","parameterTypes":["java.util.Collection","java.util.Collection"] }, {"name":"multisetUnionAll","parameterTypes":["java.util.Collection","java.util.Collection"] }, {"name":"multisetUnionDistinct","parameterTypes":["java.util.Collection","java.util.Collection"] }, {"name":"not","parameterTypes":["java.lang.Boolean"] }, {"name":"nullableAll","parameterTypes":["java.util.List","org.apache.calcite.linq4j.function.Function1"] }, {"name":"nullableExists","parameterTypes":["java.util.List","org.apache.calcite.linq4j.function.Function1"] }, {"name":"octetLength","parameterTypes":["org.apache.calcite.avatica.util.ByteString"] }, {"name":"overlay","parameterTypes":["java.lang.String","java.lang.String","int"] }, {"name":"overlay","parameterTypes":["java.lang.String","java.lang.String","int","int"] }, {"name":"position","parameterTypes":["java.lang.String","java.lang.String"] }, {"name":"posixRegex","parameterTypes":["java.lang.String","java.lang.String","boolean"] }, {"name":"regexpReplace","parameterTypes":["java.lang.String","java.lang.String","java.lang.String"] }, {"name":"regexpReplace","parameterTypes":["java.lang.String","java.lang.String","java.lang.String","int"] }, {"name":"regexpReplace","parameterTypes":["java.lang.String","java.lang.String","java.lang.String","int","int"] }, {"name":"regexpReplace","parameterTypes":["java.lang.String","java.lang.String","java.lang.String","int","int","java.lang.String"] }, {"name":"repeat","parameterTypes":["java.lang.Object","java.lang.Integer"] }, {"name":"repeat","parameterTypes":["java.lang.String","int"] }, {"name":"replace","parameterTypes":["java.lang.String","java.lang.String","java.lang.String"] }, {"name":"reverse","parameterTypes":["java.lang.String"] }, {"name":"reverse","parameterTypes":["java.util.List"] }, {"name":"right","parameterTypes":["java.lang.String","int"] }, {"name":"rlike","parameterTypes":["java.lang.String","java.lang.String"] }, {"name":"round","parameterTypes":["int","int"] }, {"name":"round","parameterTypes":["long","long"] }, {"name":"rpad","parameterTypes":["java.lang.String","int","java.lang.String"] }, {"name":"rtrim","parameterTypes":["java.lang.String"] }, {"name":"sequenceCurrentValue","parameterTypes":["java.lang.String"] }, {"name":"sequenceNextValue","parameterTypes":["java.lang.String"] }, {"name":"sha1","parameterTypes":["java.lang.String"] }, {"name":"sha256","parameterTypes":["java.lang.String"] }, {"name":"sha512","parameterTypes":["java.lang.String"] }, {"name":"similar","parameterTypes":["java.lang.String","java.lang.String"] }, {"name":"sinh","parameterTypes":["long"] }, {"name":"slice","parameterTypes":["java.util.List"] }, {"name":"sortArray","parameterTypes":["java.util.List","boolean"] }, {"name":"soundex","parameterTypes":["java.lang.String"] }, {"name":"space","parameterTypes":["int"] }, {"name":"startsWith","parameterTypes":["java.lang.String","java.lang.String"] }, {"name":"strToMap","parameterTypes":["java.lang.String","java.lang.String","java.lang.String"] }, {"name":"strcmp","parameterTypes":["java.lang.String","java.lang.String"] }, {"name":"structAccess","parameterTypes":["java.lang.Object","int","java.lang.String"] }, {"name":"submultisetOf","parameterTypes":["java.util.Collection","java.util.Collection"] }, {"name":"substring","parameterTypes":["java.lang.String","int","int"] }, {"name":"systemUser","parameterTypes":["org.apache.calcite.DataContext"] }, {"name":"tanh","parameterTypes":["long"] }, {"name":"throwUnless","parameterTypes":["boolean","java.lang.String"] }, {"name":"timeWithLocalTimeZoneToString","parameterTypes":["int","java.util.TimeZone"] }, {"name":"timeWithLocalTimeZoneToTime","parameterTypes":["int","java.util.TimeZone"] }, {"name":"timeWithLocalTimeZoneToTimestamp","parameterTypes":["java.lang.String","int","java.util.TimeZone"] }, {"name":"timeWithLocalTimeZoneToTimestampWithLocalTimeZone","parameterTypes":["java.lang.String","int"] }, {"name":"timeZone","parameterTypes":["org.apache.calcite.DataContext"] }, {"name":"timestampToDate","parameterTypes":["long"] }, {"name":"timestampWithLocalTimeZoneToDate","parameterTypes":["long","java.util.TimeZone"] }, {"name":"timestampWithLocalTimeZoneToString","parameterTypes":["long","java.util.TimeZone"] }, {"name":"timestampWithLocalTimeZoneToTime","parameterTypes":["long","java.util.TimeZone"] }, {"name":"timestampWithLocalTimeZoneToTimeWithLocalTimeZone","parameterTypes":["long"] }, {"name":"timestampWithLocalTimeZoneToTimestamp","parameterTypes":["long","java.util.TimeZone"] }, {"name":"toBase32","parameterTypes":["java.lang.String"] }, {"name":"toBase64","parameterTypes":["java.lang.String"] }, {"name":"toBoolean","parameterTypes":["java.lang.String"] }, {"name":"toChar","parameterTypes":["long","java.lang.String"] }, {"name":"toHex","parameterTypes":["org.apache.calcite.avatica.util.ByteString"] }, {"name":"toInt","parameterTypes":["java.sql.Date"] }, {"name":"toInt","parameterTypes":["java.sql.Date","java.util.TimeZone"] }, {"name":"toInt","parameterTypes":["java.sql.Time"] }, {"name":"toIntOptional","parameterTypes":["java.sql.Date"] }, {"name":"toIntOptional","parameterTypes":["java.sql.Date","java.util.TimeZone"] }, {"name":"toIntOptional","parameterTypes":["java.sql.Time"] }, {"name":"toLong","parameterTypes":["java.sql.Timestamp"] }, {"name":"toLong","parameterTypes":["java.sql.Timestamp","java.util.TimeZone"] }, {"name":"toLongOptional","parameterTypes":["java.sql.Timestamp"] }, {"name":"toLongOptional","parameterTypes":["java.sql.Timestamp","java.util.TimeZone"] }, {"name":"toString","parameterTypes":["boolean"] }, {"name":"toTimeWithLocalTimeZone","parameterTypes":["java.lang.String"] }, {"name":"toTimeWithLocalTimeZone","parameterTypes":["java.lang.String","java.util.TimeZone"] }, {"name":"toTimestampWithLocalTimeZone","parameterTypes":["java.lang.String"] }, {"name":"toTimestampWithLocalTimeZone","parameterTypes":["java.lang.String","java.util.TimeZone"] }, {"name":"translate3","parameterTypes":["java.lang.String","java.lang.String","java.lang.String"] }, {"name":"translateWithCharset","parameterTypes":["java.lang.String","java.lang.String"] }, {"name":"trim","parameterTypes":["boolean","boolean","java.lang.String","java.lang.String","boolean"] }, {"name":"truncate","parameterTypes":["java.lang.String","int"] }, {"name":"truncateOrPad","parameterTypes":["java.lang.String","int"] }, {"name":"upper","parameterTypes":["java.lang.String"] }, {"name":"user","parameterTypes":["org.apache.calcite.DataContext"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.runtime.Utilities", + "methods":[{"name":"compare","parameterTypes":["java.lang.Comparable","java.lang.Comparable"] }, {"name":"compare","parameterTypes":["java.lang.Comparable","java.lang.Comparable","java.util.Comparator"] }, {"name":"compareNullsFirst","parameterTypes":["java.lang.Comparable","java.lang.Comparable"] }, {"name":"compareNullsFirst","parameterTypes":["java.lang.Comparable","java.lang.Comparable","java.util.Comparator"] }, {"name":"compareNullsLast","parameterTypes":["java.lang.Comparable","java.lang.Comparable"] }, {"name":"compareNullsLast","parameterTypes":["java.lang.Comparable","java.lang.Comparable","java.util.Comparator"] }, {"name":"hash","parameterTypes":["int","java.lang.Object"] }, {"name":"patternBuilder","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.runtime.XmlFunctions", + "methods":[{"name":"existsNode","parameterTypes":["java.lang.String","java.lang.String","java.lang.String"] }, {"name":"extractValue","parameterTypes":["java.lang.String","java.lang.String"] }, {"name":"extractXml","parameterTypes":["java.lang.String","java.lang.String","java.lang.String"] }, {"name":"xmlTransform","parameterTypes":["java.lang.String","java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.schema.ModifiableTable", + "methods":[{"name":"getModifiableCollection","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.schema.QueryableTable", + "methods":[{"name":"asQueryable","parameterTypes":["org.apache.calcite.linq4j.QueryProvider","org.apache.calcite.schema.SchemaPlus","java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.schema.ScannableTable", + "methods":[{"name":"scan","parameterTypes":["org.apache.calcite.DataContext"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.schema.Schema", + "methods":[{"name":"getSubSchema","parameterTypes":["java.lang.String"] }, {"name":"getTable","parameterTypes":["java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.schema.SchemaPlus", + "methods":[{"name":"add","parameterTypes":["java.lang.String","org.apache.calcite.schema.Table"] }, {"name":"removeTable","parameterTypes":["java.lang.String"] }, {"name":"unwrap","parameterTypes":["java.lang.Class"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.linq4j.tree.Types"}, + "name":"org.apache.calcite.schema.Schemas", + "methods":[{"name":"enumerable","parameterTypes":["org.apache.calcite.schema.FilterableTable","org.apache.calcite.DataContext"] }, {"name":"enumerable","parameterTypes":["org.apache.calcite.schema.ProjectableFilterableTable","org.apache.calcite.DataContext"] }, {"name":"enumerable","parameterTypes":["org.apache.calcite.schema.ScannableTable","org.apache.calcite.DataContext"] }, {"name":"queryable","parameterTypes":["org.apache.calcite.DataContext","org.apache.calcite.schema.SchemaPlus","java.lang.Class","java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"org.apache.calcite.sql.fun.SqlLibraryOperatorTableFactory"}, + "name":"org.apache.calcite.sql.fun.SqlLibraryOperators", + "allPublicFields":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.sql.util.ReflectiveSqlOperatorTable"}, + "name":"org.apache.calcite.sql.fun.SqlStdOperatorTable", + "allPublicFields":true +}, +{ + "condition":{"typeReachable":"org.apache.calcite.sql2rel.ReflectiveConvertletTable"}, + "name":"org.apache.calcite.sql2rel.StandardConvertletTable", + "queryAllPublicMethods":true +} +] diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.groovy/groovy/4.0.10/reflect-config.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.groovy/groovy/4.0.10/reflect-config.json new file mode 100644 index 0000000000000..5449d84e76d29 --- /dev/null +++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.groovy/groovy/4.0.10/reflect-config.json @@ -0,0 +1,250 @@ +[ +{ + "condition":{"typeReachable":"org.codehaus.groovy.reflection.GeneratedMetaMethod$DgmMethodRecord"}, + "name":"groovy.io.FileType" +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"groovy.lang.Buildable", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.reflection.GeneratedMetaMethod$DgmMethodRecord"}, + "name":"groovy.lang.Closure" +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.reflection.GeneratedMetaMethod$DgmMethodRecord"}, + "name":"groovy.lang.EmptyRange" +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"groovy.lang.ExpandoMetaClass", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.reflection.GeneratedMetaMethod$DgmMethodRecord"}, + "name":"groovy.lang.GString" +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.reflection.stdclasses.CachedClosureClass"}, + "name":"groovy.lang.GroovyCallable", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.reflection.GeneratedMetaMethod$DgmMethodRecord"}, + "name":"groovy.lang.GroovyObject" +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.reflection.stdclasses.CachedClosureClass"}, + "name":"groovy.lang.GroovyObject", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.reflection.GeneratedMetaMethod$DgmMethodRecord"}, + "name":"groovy.lang.IntRange" +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.reflection.GeneratedMetaMethod$DgmMethodRecord"}, + "name":"groovy.lang.ListWithDefault" +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.reflection.GeneratedMetaMethod$DgmMethodRecord"}, + "name":"groovy.lang.MetaClass" +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"groovy.lang.MetaClass", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"groovy.lang.MetaObjectProtocol", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.reflection.GeneratedMetaMethod$DgmMethodRecord"}, + "name":"groovy.lang.MetaProperty" +}, +{ + "condition":{"typeReachable":"groovy.lang.MetaClassImpl"}, + "name":"groovy.lang.MutableMetaClass", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.reflection.GeneratedMetaMethod$DgmMethodRecord"}, + "name":"groovy.lang.ObjectRange" +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.reflection.GeneratedMetaMethod$DgmMethodRecord"}, + "name":"groovy.lang.Range" +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.reflection.GeneratedMetaMethod$DgmMethodRecord"}, + "name":"groovy.lang.SpreadMap" +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.reflection.GeneratedMetaMethod$DgmMethodRecord"}, + "name":"groovy.lang.Writable" +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"groovy.lang.Writable", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.reflection.GeneratedMetaMethod$DgmMethodRecord"}, + "name":"groovy.lang.groovydoc.Groovydoc" +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"groovy.runtime.metaclass.CustomMetaClassCreationHandle" +}, +{ + "condition":{"typeReachable":"groovy.lang.Binding"}, + "name":"groovy.runtime.metaclass.groovy.lang.BindingMetaClass" +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"groovy.runtime.metaclass.groovy.lang.ExpandoMetaClassMetaClass" +}, +{ + "condition":{"typeReachable":"groovy.lang.GroovyShell"}, + "name":"groovy.runtime.metaclass.groovy.lang.GroovyShellMetaClass" +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.reflection.GeneratedMetaMethod$DgmMethodRecord"}, + "name":"groovy.util.BufferedIterator" +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.reflection.GeneratedMetaMethod$DgmMethodRecord"}, + "name":"java.lang.Thread" +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.reflection.GeneratedMetaMethod$DgmMethodRecord"}, + "name":"org.codehaus.groovy.runtime.GStringImpl" +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.reflection.GeneratedMetaMethod$DgmMethodRecord"}, + "name":"org.codehaus.groovy.runtime.NullObject" +}, +{ + "condition":{"typeReachable":"groovy.lang.MetaClassImpl"}, + "name":"org.codehaus.groovy.runtime.callsite.CallSite", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"org.codehaus.groovy.runtime.dgmimpl.NumberNumberDiv", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"org.codehaus.groovy.runtime.dgmimpl.NumberNumberMinus", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"org.codehaus.groovy.runtime.dgmimpl.NumberNumberMultiply", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"org.codehaus.groovy.runtime.dgmimpl.NumberNumberPlus", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"org.codehaus.groovy.runtime.dgmimpl.arrays.BooleanArrayGetAtMetaMethod", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"org.codehaus.groovy.runtime.dgmimpl.arrays.BooleanArrayPutAtMetaMethod", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"org.codehaus.groovy.runtime.dgmimpl.arrays.ByteArrayGetAtMetaMethod", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"org.codehaus.groovy.runtime.dgmimpl.arrays.ByteArrayPutAtMetaMethod", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"org.codehaus.groovy.runtime.dgmimpl.arrays.CharacterArrayGetAtMetaMethod", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"org.codehaus.groovy.runtime.dgmimpl.arrays.CharacterArrayPutAtMetaMethod", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"org.codehaus.groovy.runtime.dgmimpl.arrays.DoubleArrayGetAtMetaMethod", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"org.codehaus.groovy.runtime.dgmimpl.arrays.DoubleArrayPutAtMetaMethod", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"org.codehaus.groovy.runtime.dgmimpl.arrays.FloatArrayGetAtMetaMethod", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"org.codehaus.groovy.runtime.dgmimpl.arrays.FloatArrayPutAtMetaMethod", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"org.codehaus.groovy.runtime.dgmimpl.arrays.IntegerArrayGetAtMetaMethod", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"org.codehaus.groovy.runtime.dgmimpl.arrays.IntegerArrayPutAtMetaMethod", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"org.codehaus.groovy.runtime.dgmimpl.arrays.LongArrayGetAtMetaMethod", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"org.codehaus.groovy.runtime.dgmimpl.arrays.LongArrayPutAtMetaMethod", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"org.codehaus.groovy.runtime.dgmimpl.arrays.ObjectArrayGetAtMetaMethod", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"org.codehaus.groovy.runtime.dgmimpl.arrays.ObjectArrayPutAtMetaMethod", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"org.codehaus.groovy.runtime.dgmimpl.arrays.ShortArrayGetAtMetaMethod", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl"}, + "name":"org.codehaus.groovy.runtime.dgmimpl.arrays.ShortArrayPutAtMetaMethod", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.codehaus.groovy.vmplugin.VMPluginFactory"}, + "name":"org.codehaus.groovy.vmplugin.v16.Java16", + "methods":[{"name":"","parameterTypes":[] }] +} +] diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.4/reflect-config.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.4/reflect-config.json new file mode 100644 index 0000000000000..0f72d7a24a107 --- /dev/null +++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.4/reflect-config.json @@ -0,0 +1,80 @@ +[ +{ + "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor"}, + "name":"java.util.Properties", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.lite.internal.failover.FailoverListenerManager"}, + "name":"java.util.Properties", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.lite.internal.reconcile.ReconcileService"}, + "name":"java.util.Properties", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.lite.internal.sharding.ShardingListenerManager$ListenServersChangedJobListener"}, + "name":"java.util.Properties", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.lite.internal.sharding.ShardingListenerManager$ShardingTotalCountChangedJobListener"}, + "name":"java.util.Properties", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.lite.internal.instance.InstanceNode"}, + "name":"org.apache.shardingsphere.elasticjob.infra.handler.sharding.JobInstance", + "allDeclaredFields":true, + "methods":[{"name":"getJobInstanceId","parameterTypes":[] }, {"name":"getLabels","parameterTypes":[] }, {"name":"getServerIp","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor"}, + "name":"org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "methods":[{"name":"setCron","parameterTypes":["java.lang.String"] }, {"name":"setProps","parameterTypes":["java.util.Properties"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.infra.yaml.YamlEngine"}, + "name":"org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "allDeclaredFields":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"setDescription","parameterTypes":["java.lang.String"] }, {"name":"setDisabled","parameterTypes":["boolean"] }, {"name":"setFailover","parameterTypes":["boolean"] }, {"name":"setJobName","parameterTypes":["java.lang.String"] }, {"name":"setJobParameter","parameterTypes":["java.lang.String"] }, {"name":"setMaxTimeDiffSeconds","parameterTypes":["int"] }, {"name":"setMisfire","parameterTypes":["boolean"] }, {"name":"setMonitorExecution","parameterTypes":["boolean"] }, {"name":"setOverwrite","parameterTypes":["boolean"] }, {"name":"setReconcileIntervalMinutes","parameterTypes":["int"] }, {"name":"setShardingItemParameters","parameterTypes":["java.lang.String"] }, {"name":"setShardingTotalCount","parameterTypes":["int"] }, {"name":"setStaticSharding","parameterTypes":["boolean"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.ScheduleJobBootstrap"}, + "name":"org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "methods":[{"name":"setCron","parameterTypes":["java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.lite.internal.config.ConfigurationService"}, + "name":"org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "allDeclaredFields":true, + "methods":[{"name":"getCron","parameterTypes":[] }, {"name":"getDescription","parameterTypes":[] }, {"name":"getJobErrorHandlerType","parameterTypes":[] }, {"name":"getJobExecutorServiceHandlerType","parameterTypes":[] }, {"name":"getJobExtraConfigurations","parameterTypes":[] }, {"name":"getJobListenerTypes","parameterTypes":[] }, {"name":"getJobName","parameterTypes":[] }, {"name":"getJobParameter","parameterTypes":[] }, {"name":"getJobShardingStrategyType","parameterTypes":[] }, {"name":"getLabel","parameterTypes":[] }, {"name":"getMaxTimeDiffSeconds","parameterTypes":[] }, {"name":"getProps","parameterTypes":[] }, {"name":"getReconcileIntervalMinutes","parameterTypes":[] }, {"name":"getShardingItemParameters","parameterTypes":[] }, {"name":"getShardingTotalCount","parameterTypes":[] }, {"name":"getTimeZone","parameterTypes":[] }, {"name":"isDisabled","parameterTypes":[] }, {"name":"isFailover","parameterTypes":[] }, {"name":"isMisfire","parameterTypes":[] }, {"name":"isMonitorExecution","parameterTypes":[] }, {"name":"isOverwrite","parameterTypes":[] }, {"name":"isStaticSharding","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.lite.internal.failover.FailoverListenerManager"}, + "name":"org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "methods":[{"name":"setCron","parameterTypes":["java.lang.String"] }, {"name":"setProps","parameterTypes":["java.util.Properties"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.lite.internal.reconcile.ReconcileService"}, + "name":"org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "methods":[{"name":"setCron","parameterTypes":["java.lang.String"] }, {"name":"setProps","parameterTypes":["java.util.Properties"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.lite.internal.sharding.ShardingListenerManager$ListenServersChangedJobListener"}, + "name":"org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "methods":[{"name":"setCron","parameterTypes":["java.lang.String"] }, {"name":"setProps","parameterTypes":["java.util.Properties"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.lite.internal.sharding.ShardingListenerManager$ShardingTotalCountChangedJobListener"}, + "name":"org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "methods":[{"name":"setCron","parameterTypes":["java.lang.String"] }, {"name":"setProps","parameterTypes":["java.util.Properties"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduler"}, + "name":"org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobShutdownHookPlugin", + "methods":[{"name":"","parameterTypes":[] }, {"name":"setCleanShutdown","parameterTypes":["boolean"] }] +} +] diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.4/resource-config.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.4/resource-config.json new file mode 100644 index 0000000000000..cba6a606abc03 --- /dev/null +++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.4/resource-config.json @@ -0,0 +1,29 @@ +{ + "resources":{ + "includes":[{ + "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduler"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandlerPropertiesValidator\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandlerFactory"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandler\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.executor.item.JobItemExecutorFactory"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.elasticjob.executor.item.impl.ClassedJobItemExecutor\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.executor.item.JobItemExecutorFactory"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.elasticjob.executor.item.impl.TypedJobItemExecutor\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.executor.context.ExecutorContext"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.elasticjob.infra.context.Reloadable\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.infra.handler.threadpool.JobExecutorServiceHandlerFactory"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.elasticjob.infra.handler.threadpool.JobExecutorServiceHandler\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.lite.internal.setup.JobClassNameProviderFactory"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.elasticjob.lite.internal.setup.JobClassNameProvider\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.elasticjob.reg.exception.RegExceptionHandler"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.elasticjob.reg.exception.IgnoredExceptionProvider\\E" + }]}, + "bundles":[] +} diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/reflect-config.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/reflect-config.json new file mode 100644 index 0000000000000..be0b4bf5e354e --- /dev/null +++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/reflect-config.json @@ -0,0 +1,704 @@ +[ +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationPlannerUtils"}, + "name":"[B" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.datasource.pool.CatalogSwitchableDataSource"}, + "name":"[Lcom.zaxxer.hikari.util.ConcurrentBag$IConcurrentBagEntry;" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mode.repository.standalone.jdbc.JDBCRepository"}, + "name":"[Lcom.zaxxer.hikari.util.ConcurrentBag$IConcurrentBagEntry;" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationPlannerUtils"}, + "name":"[Ljava.lang.String;" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.database.DatabaseTypeEngine"}, + "name":"[Ljava.sql.Statement;" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.state.datasource.DataSourceStateManager"}, + "name":"[Ljava.sql.Statement;" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mode.repository.standalone.jdbc.JDBCRepository"}, + "name":"[Ljava.sql.Statement;" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationPlannerUtils"}, + "name":"[Lsun.security.pkcs.SignerInfo;" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.expr.groovy.GroovyInlineExpressionParser"}, + "name":"java.lang.Boolean" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.expr.groovy.GroovyInlineExpressionParser"}, + "name":"java.lang.Thread" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.parser.sql.SQLStatementParserEngineFactory"}, + "name":"java.lang.Thread", + "fields":[{"name":"threadLocalRandomProbe"}] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.yaml.YamlEngine"}, + "name":"java.util.Properties", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.authority.rule.AuthorityRule"}, + "name":"org.apache.shardingsphere.authority.provider.database.DatabasePermittedAuthorityRegistryProvider", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.authority.rule.AuthorityRule"}, + "name":"org.apache.shardingsphere.authority.provider.simple.AllPermittedAuthorityRegistryProvider", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, + "name":"org.apache.shardingsphere.authority.yaml.config.YamlAuthorityRuleConfiguration" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.broadcast.yaml.config.YamlBroadcastRuleConfiguration"}, + "name":"org.apache.shardingsphere.broadcast.yaml.config.YamlBroadcastRuleConfiguration", + "allDeclaredFields":true, + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"setTables","parameterTypes":["java.util.Collection"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.broadcast.yaml.swapper.NewYamlBroadcastRuleConfigurationSwapper"}, + "name":"org.apache.shardingsphere.broadcast.yaml.config.YamlBroadcastRuleConfiguration", + "allDeclaredFields":true, + "methods":[{"name":"getTables","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, + "name":"org.apache.shardingsphere.broadcast.yaml.config.YamlBroadcastRuleConfiguration" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mode.repository.standalone.jdbc.JDBCRepository"}, + "name":"org.apache.shardingsphere.driver.ShardingSphereDriver" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.driver.api.yaml.YamlJDBCConfiguration"}, + "name":"org.apache.shardingsphere.driver.api.yaml.YamlJDBCConfiguration", + "methods":[{"name":"setSqlParser","parameterTypes":["org.apache.shardingsphere.parser.yaml.config.YamlSQLParserRuleConfiguration"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.yaml.YamlEngine"}, + "name":"org.apache.shardingsphere.driver.api.yaml.YamlJDBCConfiguration", + "allDeclaredFields":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"setDataSources","parameterTypes":["java.util.Map"] }, {"name":"setMode","parameterTypes":["org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlModeConfiguration"] }, {"name":"setProps","parameterTypes":["java.util.Properties"] }, {"name":"setRules","parameterTypes":["java.util.Collection"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.rule.EncryptRule"}, + "name":"org.apache.shardingsphere.encrypt.algorithm.assisted.MD5AssistedEncryptAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.rule.EncryptRule"}, + "name":"org.apache.shardingsphere.encrypt.algorithm.standard.AESEncryptAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, + "name":"org.apache.shardingsphere.encrypt.yaml.config.YamlCompatibleEncryptRuleConfiguration" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfiguration"}, + "name":"org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfiguration", + "allDeclaredFields":true, + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"setEncryptors","parameterTypes":["java.util.Map"] }, {"name":"setTables","parameterTypes":["java.util.Map"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, + "name":"org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfiguration" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptColumnItemRuleConfiguration"}, + "name":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptColumnItemRuleConfiguration", + "allDeclaredFields":true, + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"getEncryptorName","parameterTypes":[] }, {"name":"getName","parameterTypes":[] }, {"name":"setEncryptorName","parameterTypes":["java.lang.String"] }, {"name":"setName","parameterTypes":["java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptColumnRuleConfiguration"}, + "name":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptColumnRuleConfiguration", + "allDeclaredFields":true, + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"getAssistedQuery","parameterTypes":[] }, {"name":"getCipher","parameterTypes":[] }, {"name":"getLikeQuery","parameterTypes":[] }, {"name":"getName","parameterTypes":[] }, {"name":"setAssistedQuery","parameterTypes":["org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptColumnItemRuleConfiguration"] }, {"name":"setCipher","parameterTypes":["org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptColumnItemRuleConfiguration"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptTableRuleConfiguration"}, + "name":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptTableRuleConfiguration", + "allDeclaredFields":true, + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"setColumns","parameterTypes":["java.util.Map"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.yaml.swapper.NewYamlEncryptRuleConfigurationSwapper"}, + "name":"org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptTableRuleConfiguration", + "allDeclaredFields":true, + "methods":[{"name":"getColumns","parameterTypes":[] }, {"name":"getName","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, + "name":"org.apache.shardingsphere.globalclock.core.yaml.config.YamlGlobalClockRuleConfiguration" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.parser.cache.SQLStatementCacheBuilder"}, + "name":"org.apache.shardingsphere.infra.parser.cache.SQLStatementCacheLoader" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.encrypt.yaml.swapper.NewYamlEncryptRuleConfigurationSwapper"}, + "name":"org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmConfiguration", + "allDeclaredFields":true, + "methods":[{"name":"getProps","parameterTypes":[] }, {"name":"getType","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmConfiguration"}, + "name":"org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmConfiguration", + "allDeclaredFields":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"setProps","parameterTypes":["java.util.Properties"] }, {"name":"setType","parameterTypes":["java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mask.yaml.swapper.NewYamlMaskRuleConfigurationSwapper"}, + "name":"org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmConfiguration", + "allDeclaredFields":true, + "methods":[{"name":"getProps","parameterTypes":[] }, {"name":"getType","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.shadow.yaml.swapper.NewYamlShadowRuleConfigurationSwapper"}, + "name":"org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmConfiguration", + "allDeclaredFields":true, + "methods":[{"name":"getProps","parameterTypes":[] }, {"name":"getType","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.swapper.NewYamlShardingRuleConfigurationSwapper"}, + "name":"org.apache.shardingsphere.infra.yaml.config.pojo.algorithm.YamlAlgorithmConfiguration", + "allDeclaredFields":true, + "methods":[{"name":"getProps","parameterTypes":[] }, {"name":"getType","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.yaml.YamlEngine"}, + "name":"org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlModeConfiguration", + "allDeclaredFields":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"setRepository","parameterTypes":["org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlPersistRepositoryConfiguration"] }, {"name":"setType","parameterTypes":["java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.yaml.YamlEngine"}, + "name":"org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlPersistRepositoryConfiguration", + "allDeclaredFields":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"setType","parameterTypes":["java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.yaml.constructor.ShardingSphereYamlConstructor"}, + "name":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.yaml.representer.ShardingSphereYamlRepresenter"}, + "name":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.metadata.persist.service.schema.NewTableMetaDataPersistService"}, + "name":"org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereTable", + "allDeclaredFields":true, + "methods":[{"name":"getColumns","parameterTypes":[] }, {"name":"getConstraints","parameterTypes":[] }, {"name":"getIndexes","parameterTypes":[] }, {"name":"getName","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, + "name":"org.apache.shardingsphere.logging.yaml.config.YamlLoggingRuleConfiguration" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mask.rule.MaskRule"}, + "name":"org.apache.shardingsphere.mask.algorithm.cover.KeepFirstNLastMMaskAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mask.rule.MaskRule"}, + "name":"org.apache.shardingsphere.mask.algorithm.cover.KeepFromXToYMaskAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mask.rule.MaskRule"}, + "name":"org.apache.shardingsphere.mask.algorithm.cover.MaskAfterSpecialCharsAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mask.rule.MaskRule"}, + "name":"org.apache.shardingsphere.mask.algorithm.cover.MaskBeforeSpecialCharsAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mask.rule.MaskRule"}, + "name":"org.apache.shardingsphere.mask.algorithm.cover.MaskFirstNLastMMaskAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mask.rule.MaskRule"}, + "name":"org.apache.shardingsphere.mask.algorithm.cover.MaskFromXToYMaskAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mask.rule.MaskRule"}, + "name":"org.apache.shardingsphere.mask.algorithm.hash.MD5MaskAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mask.rule.MaskRule"}, + "name":"org.apache.shardingsphere.mask.algorithm.replace.GenericTableRandomReplaceAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, + "name":"org.apache.shardingsphere.mask.yaml.config.YamlMaskRuleConfiguration" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mask.yaml.config.YamlMaskRuleConfiguration"}, + "name":"org.apache.shardingsphere.mask.yaml.config.YamlMaskRuleConfiguration", + "allDeclaredFields":true, + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"setMaskAlgorithms","parameterTypes":["java.util.Map"] }, {"name":"setTables","parameterTypes":["java.util.Map"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskColumnRuleConfiguration"}, + "name":"org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskColumnRuleConfiguration", + "allDeclaredFields":true, + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"getLogicColumn","parameterTypes":[] }, {"name":"getMaskAlgorithm","parameterTypes":[] }, {"name":"setMaskAlgorithm","parameterTypes":["java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskTableRuleConfiguration"}, + "name":"org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskTableRuleConfiguration", + "allDeclaredFields":true, + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"setColumns","parameterTypes":["java.util.Map"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mask.yaml.swapper.NewYamlMaskRuleConfigurationSwapper"}, + "name":"org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskTableRuleConfiguration", + "allDeclaredFields":true, + "methods":[{"name":"getColumns","parameterTypes":[] }, {"name":"getName","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.eventbus.EventBusContext"}, + "name":"org.apache.shardingsphere.mode.manager.standalone.subscriber.StandaloneProcessSubscriber", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.util.eventbus.EventBusContext"}, + "name":"org.apache.shardingsphere.mode.process.ProcessSubscriber", + "queryAllDeclaredMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.standalone.NewStandaloneContextManagerBuilder"}, + "name":"org.apache.shardingsphere.mode.repository.standalone.jdbc.JDBCRepository", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mode.repository.standalone.jdbc.sql.JDBCRepositorySQLLoader$2"}, + "name":"org.apache.shardingsphere.mode.repository.standalone.jdbc.sql.JDBCRepositorySQL", + "allDeclaredFields":true, + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.parser.yaml.config.YamlSQLParserCacheOptionRuleConfiguration"}, + "name":"org.apache.shardingsphere.parser.yaml.config.YamlSQLParserCacheOptionRuleConfiguration", + "allDeclaredFields":true, + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"getInitialCapacity","parameterTypes":[] }, {"name":"getMaximumSize","parameterTypes":[] }, {"name":"setInitialCapacity","parameterTypes":["int"] }, {"name":"setMaximumSize","parameterTypes":["long"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, + "name":"org.apache.shardingsphere.parser.yaml.config.YamlSQLParserRuleConfiguration" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.parser.yaml.config.YamlSQLParserRuleConfiguration"}, + "name":"org.apache.shardingsphere.parser.yaml.config.YamlSQLParserRuleConfiguration", + "allDeclaredFields":true, + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"setParseTreeCache","parameterTypes":["org.apache.shardingsphere.parser.yaml.config.YamlSQLParserCacheOptionRuleConfiguration"] }, {"name":"setSqlCommentParseEnabled","parameterTypes":["boolean"] }, {"name":"setSqlStatementCache","parameterTypes":["org.apache.shardingsphere.parser.yaml.config.YamlSQLParserCacheOptionRuleConfiguration"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.parser.yaml.swapper.NewYamlSQLParserRuleConfigurationSwapper"}, + "name":"org.apache.shardingsphere.parser.yaml.config.YamlSQLParserRuleConfiguration", + "allDeclaredFields":true, + "methods":[{"name":"getParseTreeCache","parameterTypes":[] }, {"name":"getSqlStatementCache","parameterTypes":[] }, {"name":"isSqlCommentParseEnabled","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.readwritesplitting.rule.ReadwriteSplittingRule"}, + "name":"org.apache.shardingsphere.readwritesplitting.algorithm.loadbalance.RandomReadQueryLoadBalanceAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.readwritesplitting.rule.ReadwriteSplittingRule"}, + "name":"org.apache.shardingsphere.readwritesplitting.algorithm.loadbalance.RoundRobinReadQueryLoadBalanceAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.readwritesplitting.rule.ReadwriteSplittingRule"}, + "name":"org.apache.shardingsphere.readwritesplitting.algorithm.loadbalance.WeightReadQueryLoadBalanceAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, + "name":"org.apache.shardingsphere.readwritesplitting.yaml.config.YamlReadwriteSplittingRuleConfiguration" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.readwritesplitting.yaml.config.YamlReadwriteSplittingRuleConfiguration"}, + "name":"org.apache.shardingsphere.readwritesplitting.yaml.config.YamlReadwriteSplittingRuleConfiguration", + "allDeclaredFields":true, + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"setDataSources","parameterTypes":["java.util.Map"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.readwritesplitting.yaml.config.rule.YamlReadwriteSplittingDataSourceRuleConfiguration"}, + "name":"org.apache.shardingsphere.readwritesplitting.yaml.config.rule.YamlReadwriteSplittingDataSourceRuleConfiguration", + "allDeclaredFields":true, + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"setReadDataSourceNames","parameterTypes":["java.util.List"] }, {"name":"setWriteDataSourceName","parameterTypes":["java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.readwritesplitting.yaml.swapper.NewYamlReadwriteSplittingRuleConfigurationSwapper"}, + "name":"org.apache.shardingsphere.readwritesplitting.yaml.config.rule.YamlReadwriteSplittingDataSourceRuleConfiguration", + "allDeclaredFields":true, + "methods":[{"name":"getLoadBalancerName","parameterTypes":[] }, {"name":"getReadDataSourceNames","parameterTypes":[] }, {"name":"getTransactionalReadQueryStrategy","parameterTypes":[] }, {"name":"getWriteDataSourceName","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.shadow.rule.ShadowRule"}, + "name":"org.apache.shardingsphere.shadow.algorithm.shadow.column.ColumnRegexMatchedShadowAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.shadow.rule.ShadowRule"}, + "name":"org.apache.shardingsphere.shadow.algorithm.shadow.column.ColumnValueMatchedShadowAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.shadow.rule.ShadowRule"}, + "name":"org.apache.shardingsphere.shadow.algorithm.shadow.hint.SQLHintShadowAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, + "name":"org.apache.shardingsphere.shadow.yaml.config.YamlShadowRuleConfiguration" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.shadow.yaml.config.YamlShadowRuleConfiguration"}, + "name":"org.apache.shardingsphere.shadow.yaml.config.YamlShadowRuleConfiguration", + "allDeclaredFields":true, + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"setDataSources","parameterTypes":["java.util.Map"] }, {"name":"setDefaultShadowAlgorithmName","parameterTypes":["java.lang.String"] }, {"name":"setShadowAlgorithms","parameterTypes":["java.util.Map"] }, {"name":"setTables","parameterTypes":["java.util.Map"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.shadow.yaml.config.datasource.YamlShadowDataSourceConfiguration"}, + "name":"org.apache.shardingsphere.shadow.yaml.config.datasource.YamlShadowDataSourceConfiguration", + "allDeclaredFields":true, + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"setProductionDataSourceName","parameterTypes":["java.lang.String"] }, {"name":"setShadowDataSourceName","parameterTypes":["java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.shadow.yaml.swapper.NewYamlShadowRuleConfigurationSwapper"}, + "name":"org.apache.shardingsphere.shadow.yaml.config.datasource.YamlShadowDataSourceConfiguration", + "allDeclaredFields":true, + "methods":[{"name":"getProductionDataSourceName","parameterTypes":[] }, {"name":"getShadowDataSourceName","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.shadow.yaml.config.table.YamlShadowTableConfiguration"}, + "name":"org.apache.shardingsphere.shadow.yaml.config.table.YamlShadowTableConfiguration", + "allDeclaredFields":true, + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"setDataSourceNames","parameterTypes":["java.util.Collection"] }, {"name":"setShadowAlgorithmNames","parameterTypes":["java.util.Collection"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.shadow.yaml.swapper.NewYamlShadowRuleConfigurationSwapper"}, + "name":"org.apache.shardingsphere.shadow.yaml.config.table.YamlShadowTableConfiguration", + "allDeclaredFields":true, + "methods":[{"name":"getDataSourceNames","parameterTypes":[] }, {"name":"getShadowAlgorithmNames","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, + "name":"org.apache.shardingsphere.sharding.algorithm.audit.DMLShardingConditionsShardingAuditAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, + "name":"org.apache.shardingsphere.sharding.algorithm.keygen.SnowflakeKeyGenerateAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, + "name":"org.apache.shardingsphere.sharding.algorithm.keygen.UUIDKeyGenerateAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, + "name":"org.apache.shardingsphere.sharding.algorithm.sharding.classbased.ClassBasedShardingAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, + "name":"org.apache.shardingsphere.sharding.algorithm.sharding.datetime.AutoIntervalShardingAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, + "name":"org.apache.shardingsphere.sharding.algorithm.sharding.datetime.IntervalShardingAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, + "name":"org.apache.shardingsphere.sharding.algorithm.sharding.hint.HintInlineShardingAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, + "name":"org.apache.shardingsphere.sharding.algorithm.sharding.inline.ComplexInlineShardingAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, + "name":"org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, + "name":"org.apache.shardingsphere.sharding.algorithm.sharding.mod.HashModShardingAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, + "name":"org.apache.shardingsphere.sharding.algorithm.sharding.mod.ModShardingAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, + "name":"org.apache.shardingsphere.sharding.algorithm.sharding.range.BoundaryBasedRangeShardingAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, + "name":"org.apache.shardingsphere.sharding.algorithm.sharding.range.VolumeBasedRangeShardingAlgorithm", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, + "name":"org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration"}, + "name":"org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration", + "allDeclaredFields":true, + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"setAuditors","parameterTypes":["java.util.Map"] }, {"name":"setDefaultDatabaseStrategy","parameterTypes":["org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfiguration"] }, {"name":"setKeyGenerators","parameterTypes":["java.util.Map"] }, {"name":"setShardingAlgorithms","parameterTypes":["java.util.Map"] }, {"name":"setTables","parameterTypes":["java.util.Map"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.config.rule.YamlTableRuleConfiguration"}, + "name":"org.apache.shardingsphere.sharding.yaml.config.rule.YamlTableRuleConfiguration", + "allDeclaredFields":true, + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"setActualDataNodes","parameterTypes":["java.lang.String"] }, {"name":"setKeyGenerateStrategy","parameterTypes":["org.apache.shardingsphere.sharding.yaml.config.strategy.keygen.YamlKeyGenerateStrategyConfiguration"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.swapper.NewYamlShardingRuleConfigurationSwapper"}, + "name":"org.apache.shardingsphere.sharding.yaml.config.rule.YamlTableRuleConfiguration", + "allDeclaredFields":true, + "methods":[{"name":"getActualDataNodes","parameterTypes":[] }, {"name":"getAuditStrategy","parameterTypes":[] }, {"name":"getDatabaseStrategy","parameterTypes":[] }, {"name":"getKeyGenerateStrategy","parameterTypes":[] }, {"name":"getLogicTable","parameterTypes":[] }, {"name":"getTableStrategy","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.config.strategy.keygen.YamlKeyGenerateStrategyConfiguration"}, + "name":"org.apache.shardingsphere.sharding.yaml.config.strategy.keygen.YamlKeyGenerateStrategyConfiguration", + "allDeclaredFields":true, + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"getColumn","parameterTypes":[] }, {"name":"getKeyGeneratorName","parameterTypes":[] }, {"name":"setColumn","parameterTypes":["java.lang.String"] }, {"name":"setKeyGeneratorName","parameterTypes":["java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfiguration"}, + "name":"org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfiguration", + "allDeclaredFields":true, + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"setStandard","parameterTypes":["org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlStandardShardingStrategyConfiguration"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.swapper.NewYamlShardingRuleConfigurationSwapper"}, + "name":"org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfiguration", + "allDeclaredFields":true, + "methods":[{"name":"getComplex","parameterTypes":[] }, {"name":"getHint","parameterTypes":[] }, {"name":"getNone","parameterTypes":[] }, {"name":"getStandard","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlStandardShardingStrategyConfiguration"}, + "name":"org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlStandardShardingStrategyConfiguration", + "allDeclaredFields":true, + "queryAllPublicMethods":true, + "methods":[{"name":"","parameterTypes":[] }, {"name":"getShardingAlgorithmName","parameterTypes":[] }, {"name":"getShardingColumn","parameterTypes":[] }, {"name":"setShardingAlgorithmName","parameterTypes":["java.lang.String"] }, {"name":"setShardingColumn","parameterTypes":["java.lang.String"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, + "name":"org.apache.shardingsphere.single.yaml.config.pojo.YamlSingleRuleConfiguration" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.single.yaml.config.swapper.NewYamlSingleRuleConfigurationSwapper"}, + "name":"org.apache.shardingsphere.single.yaml.config.pojo.YamlSingleRuleConfiguration", + "allDeclaredFields":true, + "methods":[{"name":"getDefaultDataSource","parameterTypes":[] }, {"name":"getTables","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.core.database.cache.ParseTreeCacheBuilder"}, + "name":"org.apache.shardingsphere.sql.parser.core.database.cache.ParseTreeCacheLoader" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.core.SQLParserFactory"}, + "name":"org.apache.shardingsphere.sql.parser.mysql.parser.MySQLLexer", + "methods":[{"name":"","parameterTypes":["org.antlr.v4.runtime.CharStream"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.core.SQLParserFactory"}, + "name":"org.apache.shardingsphere.sql.parser.mysql.parser.MySQLParser", + "methods":[{"name":"","parameterTypes":["org.antlr.v4.runtime.TokenStream"] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.core.database.visitor.SQLStatementVisitorFactory"}, + "name":"org.apache.shardingsphere.sql.parser.mysql.visitor.statement.MySQLStatementVisitorFacade", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement"}, + "name":"org.apache.shardingsphere.sql.parser.mysql.visitor.statement.type.MySQLDDLStatementVisitor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.parser.cache.SQLStatementCacheLoader"}, + "name":"org.apache.shardingsphere.sql.parser.mysql.visitor.statement.type.MySQLDMLStatementVisitor", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.core.database.visitor.SQLStatementVisitorFactory"}, + "name":"org.apache.shardingsphere.sql.parser.opengauss.visitor.statement.OpenGaussStatementVisitorFacade", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.core.database.visitor.SQLStatementVisitorFactory"}, + "name":"org.apache.shardingsphere.sql.parser.oracle.visitor.statement.OracleStatementVisitorFacade", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.core.database.visitor.SQLStatementVisitorFactory"}, + "name":"org.apache.shardingsphere.sql.parser.postgresql.visitor.statement.PostgreSQLStatementVisitorFacade", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.binder.statement.dml.DeleteStatementBinder"}, + "name":"org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLDeleteStatement", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.binder.statement.dml.InsertStatementBinder"}, + "name":"org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLInsertStatement", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementBinder"}, + "name":"org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLSelectStatement", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.core.database.visitor.SQLStatementVisitorFactory"}, + "name":"org.apache.shardingsphere.sql.parser.sql92.visitor.statement.SQL92StatementVisitorFacade", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sql.parser.core.database.visitor.SQLStatementVisitorFactory"}, + "name":"org.apache.shardingsphere.sql.parser.sqlserver.visitor.statement.SQLServerStatementVisitorFacade", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.driver.api.ShardingSphereDataSourceFactory"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.connection.refresher.type.table.DropTableStatementSchemaRefresher"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.rule.builder.global.GlobalRulesBuilder"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.context.ConfigurationContextManager"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.standalone.NewStandaloneContextManagerBuilder"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mode.manager.standalone.NewStandaloneModeContextManager"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.mode.metadata.NewMetaDataContextsFactory"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.optimizer.context.OptimizerContextFactory"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.optimizer.context.planner.OptimizerPlannerContextFactory"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationPlannerUtils"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.rule.SQLFederationRule"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.rule.builder.SQLFederationRuleBuilder"}, + "name":"org.apache.shardingsphere.sqlfederation.optimizer.planner.util.SQLFederationFunctionUtils" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, + "name":"org.apache.shardingsphere.sqlfederation.yaml.config.YamlSQLFederationRuleConfiguration" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, + "name":"org.apache.shardingsphere.sqltranslator.yaml.config.YamlSQLTranslatorRuleConfiguration" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.timeservice.core.rule.TimestampServiceRule"}, + "name":"org.apache.shardingsphere.timeservice.type.system.SystemTimestampService", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, + "name":"org.apache.shardingsphere.traffic.yaml.config.YamlTrafficRuleConfiguration" +}, +{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.shortcut.YamlRuleConfigurationShortcuts"}, + "name":"org.apache.shardingsphere.transaction.yaml.config.YamlTransactionRuleConfiguration" +} +] diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/resource-config.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/resource-config.json new file mode 100644 index 0000000000000..c2dc772615781 --- /dev/null +++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/resource-config.json @@ -0,0 +1,107 @@ +{ + "resources":{ + "includes":[{ + "condition":{"typeReachable":"org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPILoader"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.metadata.persist.NewMetaDataPersistService"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.config.rule.decorator.RuleConfigurationDecorator\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.database.core.metadata.data.loader.MetaDataLoader"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.database.core.metadata.data.loader.DialectMetaDataLoader\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.database.core.type.DatabaseTypeRegistry"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.database.core.metadata.database.DialectDatabaseMetaData\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.database.core.metadata.database.system.SystemDatabase"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.database.core.metadata.database.system.DialectSystemDatabase\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.database.core.type.DatabaseTypeFactory"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.database.core.type.DatabaseType\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.datanode.DataNodes"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.datanode.DataNodeBuilder\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.datasource.pool.props.domain.DataSourcePoolProperties"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.executor.audit.SQLAuditEngine"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.executor.audit.SQLAuditor\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.executor.sql.prepare.driver.DriverExecutionPrepareEngine"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.executor.sql.prepare.driver.SQLExecutionUnitBuilder\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.expr.core.InlineExpressionParserFactory"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.merge.MergeEngine"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.merge.engine.ResultProcessEngine\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.metadata.database.schema.builder.GenericSchemaBuilder"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.metadata.database.schema.reviser.MetaDataReviseEntry\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.mode.metadata.MetaDataContexts"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.metadata.statistics.builder.ShardingSphereStatisticsBuilder\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.rewrite.SQLRewriteEntry"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.rewrite.context.SQLRewriteContextDecorator\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.route.engine.impl.PartialSQLRouteExecutor"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.route.SQLRouter\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.rule.builder.database.DatabaseRulesBuilder"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.rule.builder.database.DatabaseRuleBuilder\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.rule.builder.database.DatabaseRulesBuilder"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.rule.builder.database.DefaultDatabaseRuleConfigurationBuilder\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.rule.builder.global.GlobalRulesBuilder"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.rule.builder.global.DefaultGlobalRuleConfigurationBuilder\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.rule.builder.global.GlobalRulesBuilder"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.rule.builder.global.GlobalRuleBuilder\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.swapper.mode.YamlModeConfigurationSwapper"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.mode.YamlPersistRepositoryConfigurationSwapper\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.swapper.rule.NewYamlGlobalRuleConfigurationSwapperEngine"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.NewYamlGlobalRuleConfigurationSwapper\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.infra.yaml.config.swapper.rule.NewYamlRuleConfigurationSwapperEngine"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.infra.yaml.config.swapper.rule.NewYamlRuleConfigurationSwapper\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.readwritesplitting.route.standard.StandardReadwriteSplittingDataSourceRouter"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.readwritesplitting.route.standard.filter.ReadDataSourcesFilter\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.sharding.spi.ShardingAlgorithm\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.sharding.rule.ShardingRule"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.sharding.spi.ShardingAuditAlgorithm\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.optimizer.context.parser.dialect.OptimizerSQLPropertiesBuilder"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.sqlfederation.optimizer.context.parser.dialect.OptimizerSQLDialectBuilder\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.engine.SQLFederationEngine"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.sqlfederation.spi.SQLFederationDecider\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.sqltranslator.rule.SQLTranslatorRule"}, + "pattern":"\\QMETA-INF/services/org.apache.shardingsphere.sqltranslator.spi.SQLTranslator\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.sqlfederation.optimizer.context.parser.dialect.impl.H2OptimizerBuilder"}, + "pattern":"\\Qsaffron.properties\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.mode.repository.standalone.jdbc.sql.JDBCRepositorySQLLoader"}, + "pattern":"\\Qsql\\E" + },{ + "condition":{"typeReachable":"org.apache.shardingsphere.mode.repository.standalone.jdbc.sql.JDBCRepositorySQLLoader"}, + "pattern":"\\Qsql/H2.xml\\E" + }, { + "condition":{"typeReachable":"org.apache.shardingsphere.mode.repository.standalone.jdbc.sql.JDBCRepositorySQLLoader"}, + "pattern":"\\Qsql/MySQL.xml\\E" + }]}, + "bundles":[] +} diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.zookeeper/zookeeper/3.9.0/reflect-config.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.zookeeper/zookeeper/3.9.0/reflect-config.json new file mode 100644 index 0000000000000..a6e52201ca758 --- /dev/null +++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.zookeeper/zookeeper/3.9.0/reflect-config.json @@ -0,0 +1,56 @@ +[ +{ + "condition":{"typeReachable":"org.apache.zookeeper.ZooKeeper"}, + "name":"org.apache.zookeeper.ClientCnxnSocketNIO", + "methods":[{"name":"","parameterTypes":["org.apache.zookeeper.client.ZKClientConfig"] }] +}, +{ + "condition":{"typeReachable":"org.apache.zookeeper.metrics.impl.MetricsProviderBootstrap"}, + "name":"org.apache.zookeeper.metrics.impl.DefaultMetricsProvider", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.zookeeper.server.quorum.QuorumPeerConfig"}, + "name":"org.apache.zookeeper.metrics.impl.DefaultMetricsProvider" +}, +{ + "condition":{"typeReachable":"org.apache.zookeeper.server.ServerCnxnFactory"}, + "name":"org.apache.zookeeper.server.ConnectionBean", + "queryAllPublicConstructors":true +}, +{ + "condition":{"typeReachable":"org.apache.zookeeper.server.ServerCnxnFactory"}, + "name":"org.apache.zookeeper.server.ConnectionMXBean", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.zookeeper.server.ZooKeeperServer"}, + "name":"org.apache.zookeeper.server.DataTreeBean", + "queryAllPublicConstructors":true +}, +{ + "condition":{"typeReachable":"org.apache.zookeeper.server.ZooKeeperServer"}, + "name":"org.apache.zookeeper.server.DataTreeMXBean", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.zookeeper.server.ServerCnxnFactory"}, + "name":"org.apache.zookeeper.server.NIOServerCnxnFactory", + "methods":[{"name":"","parameterTypes":[] }] +}, +{ + "condition":{"typeReachable":"org.apache.zookeeper.server.ZooKeeperServer"}, + "name":"org.apache.zookeeper.server.ZooKeeperServerBean", + "queryAllPublicConstructors":true +}, +{ + "condition":{"typeReachable":"org.apache.zookeeper.server.ZooKeeperServer"}, + "name":"org.apache.zookeeper.server.ZooKeeperServerMXBean", + "queryAllPublicMethods":true +}, +{ + "condition":{"typeReachable":"org.apache.zookeeper.server.watch.WatchManagerFactory"}, + "name":"org.apache.zookeeper.server.watch.WatchManager", + "methods":[{"name":"","parameterTypes":[] }] +} +] diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.glassfish.jaxb/jaxb-runtime/2.3.1/reflect-config.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.glassfish.jaxb/jaxb-runtime/2.3.1/reflect-config.json new file mode 100644 index 0000000000000..bf4ceb54aca29 --- /dev/null +++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.glassfish.jaxb/jaxb-runtime/2.3.1/reflect-config.json @@ -0,0 +1,12 @@ +[ +{ + "condition":{"typeReachable":"com.sun.xml.bind.v2.ContextFactory"}, + "name":"com.sun.xml.bind.v2.ContextFactory", + "methods":[{"name":"createContext","parameterTypes":["java.lang.Class[]","java.util.Map"] }] +}, +{ + "condition":{"typeReachable":"com.sun.xml.bind.v2.runtime.property.SingleElementLeafProperty"}, + "name":"com.sun.xml.bind.v2.runtime.property.SingleElementLeafProperty", + "methods":[{"name":"","parameterTypes":["com.sun.xml.bind.v2.runtime.JAXBContextImpl","com.sun.xml.bind.v2.model.runtime.RuntimeElementPropertyInfo"] }] +} +] diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.slf4j/slf4j-api/1.7.36/reflect-config.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.slf4j/slf4j-api/1.7.36/reflect-config.json new file mode 100644 index 0000000000000..6cc9abf091869 --- /dev/null +++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.slf4j/slf4j-api/1.7.36/reflect-config.json @@ -0,0 +1,7 @@ +[ +{ + "condition":{"typeReachable":"org.slf4j.event.Level"}, + "name":"org.slf4j.event.Level", + "methods":[{"name":"valueOf","parameterTypes":["java.lang.String"] }] +} +] diff --git a/jdbc/core/pom.xml b/jdbc/core/pom.xml index 561f26fce4c6a..f5b2f769f98e4 100644 --- a/jdbc/core/pom.xml +++ b/jdbc/core/pom.xml @@ -164,6 +164,11 @@ shardingsphere-logging-core ${project.version} + + org.apache.shardingsphere + shardingsphere-infra-reachability-metadata + ${project.version} + org.apache.shardingsphere diff --git a/pom.xml b/pom.xml index 737a886fe56e2..20a863812bfe3 100644 --- a/pom.xml +++ b/pom.xml @@ -155,7 +155,7 @@ 1.4.13 4.0.0 1.6.2 - 0.9.27 + 0.9.28 1.0.0 @@ -1002,8 +1002,9 @@ - generateStandardMetadata + generateMetadata + 17 true true true @@ -1011,64 +1012,106 @@ true - - - maven-compiler-plugin - ${maven-compiler-plugin.version} - - 17 - 17 - - - - maven-surefire-plugin - ${maven-surefire-plugin.version} - - - org.apache.shardingsphere.agent.core.** - - - - - org.graalvm.buildtools - native-maven-plugin - ${native-maven-plugin.version} - true - - - true - Direct - - config-output-dir=${project.basedir}/src/main/resources/META-INF/native-image/${project.groupId}/${project.artifactId} - - - - ${user.dir}/distribution/proxy-native/caller-filter.json - - - ${user.dir}/distribution/proxy-native/access-filter.json - - - - - - - test-native - - test - - test - - - build-native - - compile-no-fork - - package - - - - + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + org.apache.shardingsphere.infra.nativetest.** + + + + + org.graalvm.buildtools + native-maven-plugin + ${native-maven-plugin.version} + true + + + true + Conditional + + + ${user.dir}/infra/nativetest/native-image-filter/user-code-filter.json + ${user.dir}/infra/nativetest/native-image-filter/extra-filter.json + true + + + + + main + + false + ${user.dir}/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/ + + + + + + build-native + + compile-no-fork + + package + + + test-native + + test + + test + + + + + + + + + nativeTestInShardingSphere + + 17 + + + + + + maven-surefire-plugin + + + org.apache.shardingsphere.infra.nativetest.** + + + + + org.graalvm.buildtools + native-maven-plugin + ${native-maven-plugin.version} + true + + + --report-unsupported-elements-at-runtime + + ${project.build.outputDirectory} + + true + + + + + test-native + + test + + test + + + + + From 2e570f5b1710b90023c749b4652360f4d4471653 Mon Sep 17 00:00:00 2001 From: linghengqian Date: Tue, 14 Nov 2023 19:12:24 +0800 Subject: [PATCH 2/3] Deal with coding style --- .../infra/nativetest/jdbc/features/EncryptTest.java | 2 -- .../infra/nativetest/jdbc/features/MaskTest.java | 3 --- .../nativetest/jdbc/features/ReadWriteSplittingTest.java | 3 --- .../infra/nativetest/jdbc/features/ShadowTest.java | 3 --- .../infra/nativetest/jdbc/features/ShardingTest.java | 6 ------ infra/nativetest/src/test/resources/yaml/mask.yaml | 2 +- .../src/test/resources/yaml/readwrite-splitting.yaml | 1 - infra/nativetest/src/test/resources/yaml/sharding.yaml | 1 - 8 files changed, 1 insertion(+), 20 deletions(-) diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/EncryptTest.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/EncryptTest.java index 4fd0146d78245..8141235b8ece2 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/EncryptTest.java +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/EncryptTest.java @@ -91,14 +91,12 @@ private List insertData() throws SQLException { order.setAddressId(i); order.setStatus("INSERT_TEST"); orderRepository.insert(order); - OrderItem orderItem = new OrderItem(); orderItem.setOrderId(order.getOrderId()); orderItem.setUserId(i); orderItem.setPhone("13800000001"); orderItem.setStatus("INSERT_TEST"); orderItemRepository.insert(orderItem); - Address address = new Address((long) i, "address_test_" + i); addressRepository.insert(address); result.add(order.getOrderId()); diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/MaskTest.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/MaskTest.java index 18b11bf6af87d..32a1fd863b94d 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/MaskTest.java +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/MaskTest.java @@ -90,17 +90,14 @@ private List insertData() throws SQLException { order.setAddressId(i); order.setStatus("INSERT_TEST"); orderRepository.insert(order); - OrderItem orderItem = new OrderItem(); orderItem.setOrderId(order.getOrderId()); orderItem.setUserId(i); orderItem.setPhone("13800000001"); orderItem.setStatus("INSERT_TEST"); orderItemRepository.insert(orderItem); - Address address = new Address((long) i, "address_test_" + i); addressRepository.insert(address); - result.add(order.getOrderId()); } return result; diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ReadWriteSplittingTest.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ReadWriteSplittingTest.java index 9d6e1311e4fe3..ae5818a53e8c5 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ReadWriteSplittingTest.java +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ReadWriteSplittingTest.java @@ -82,17 +82,14 @@ private List insertData() throws SQLException { order.setAddressId(i); order.setStatus("INSERT_TEST"); orderRepository.insert(order); - OrderItem orderItem = new OrderItem(); orderItem.setOrderId(order.getOrderId()); orderItem.setUserId(i); orderItem.setPhone("13800000001"); orderItem.setStatus("INSERT_TEST"); orderItemRepository.insert(orderItem); - Address address = new Address((long) i, "address_test_" + i); addressRepository.insert(address); - result.add(order.getOrderId()); } return result; diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShadowTest.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShadowTest.java index 34eef534fee1d..8f795c0dcbe26 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShadowTest.java +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShadowTest.java @@ -111,17 +111,14 @@ private List insertData() throws SQLException { order.setAddressId(i); order.setStatus("INSERT_TEST"); orderRepository.insert(order); - OrderItem orderItem = new OrderItem(); orderItem.setOrderId(order.getOrderId()); orderItem.setUserId(i); orderItem.setPhone("13800000001"); orderItem.setStatus("INSERT_TEST"); orderItemRepository.insert(orderItem); - Address address = new Address((long) i, "address_test_" + i); addressRepository.insert(address); - result.add(order.getOrderId()); } return result; diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShardingTest.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShardingTest.java index 9a7e96ff6cab5..2ffa47962ba7b 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShardingTest.java +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShardingTest.java @@ -69,7 +69,6 @@ private void initEnvironment() throws SQLException { private void processSuccess() throws SQLException { final List orderIds = insertData(); - List orders = orderRepository.selectAll(); assertThat(orders.stream().map(Order::getOrderType).collect(Collectors.toList()), equalTo(Arrays.asList(1, 1, 1, 1, 1, 0, 0, 0, 0, 0))); @@ -79,7 +78,6 @@ private void processSuccess() throws SQLException { equalTo(new ArrayList<>(Arrays.asList(1L, 3L, 5L, 7L, 9L, 2L, 4L, 6L, 8L, 10L)))); assertThat(orders.stream().map(Order::getStatus).collect(Collectors.toList()), equalTo(IntStream.range(1, 11).mapToObj(i -> "INSERT_TEST").collect(Collectors.toList()))); - List orderItems = orderItemRepository.selectAll(); assertThat(orderItems.stream().map(OrderItem::getUserId).collect(Collectors.toList()), equalTo(new ArrayList<>(Arrays.asList(1, 3, 5, 7, 9, 2, 4, 6, 8, 10)))); @@ -87,7 +85,6 @@ private void processSuccess() throws SQLException { equalTo(IntStream.range(1, 11).mapToObj(i -> "13800000001").collect(Collectors.toList()))); assertThat(orderItems.stream().map(OrderItem::getStatus).collect(Collectors.toList()), equalTo(IntStream.range(1, 11).mapToObj(i -> "INSERT_TEST").collect(Collectors.toList()))); - assertThat(addressRepository.selectAll(), equalTo(LongStream.range(1, 11).mapToObj(i -> new Address(i, "address_test_" + i)).collect(Collectors.toList()))); deleteData(orderIds); @@ -105,17 +102,14 @@ private List insertData() throws SQLException { order.setAddressId(i); order.setStatus("INSERT_TEST"); orderRepository.insert(order); - OrderItem orderItem = new OrderItem(); orderItem.setOrderId(order.getOrderId()); orderItem.setUserId(i); orderItem.setPhone("13800000001"); orderItem.setStatus("INSERT_TEST"); orderItemRepository.insert(orderItem); - Address address = new Address((long) i, "address_test_" + i); addressRepository.insert(address); - result.add(order.getOrderId()); } return result; diff --git a/infra/nativetest/src/test/resources/yaml/mask.yaml b/infra/nativetest/src/test/resources/yaml/mask.yaml index 2457dc6ad16e1..6020ba6c1cabd 100644 --- a/infra/nativetest/src/test/resources/yaml/mask.yaml +++ b/infra/nativetest/src/test/resources/yaml/mask.yaml @@ -44,4 +44,4 @@ rules: replace-char: '*' props: - sql-show: false \ No newline at end of file + sql-show: false diff --git a/infra/nativetest/src/test/resources/yaml/readwrite-splitting.yaml b/infra/nativetest/src/test/resources/yaml/readwrite-splitting.yaml index 2b22ac2f64e17..36782ac1bd9f6 100644 --- a/infra/nativetest/src/test/resources/yaml/readwrite-splitting.yaml +++ b/infra/nativetest/src/test/resources/yaml/readwrite-splitting.yaml @@ -54,4 +54,3 @@ rules: props: sql-show: false - diff --git a/infra/nativetest/src/test/resources/yaml/sharding.yaml b/infra/nativetest/src/test/resources/yaml/sharding.yaml index 37d2cf51f2174..10dc57f5e98ff 100644 --- a/infra/nativetest/src/test/resources/yaml/sharding.yaml +++ b/infra/nativetest/src/test/resources/yaml/sharding.yaml @@ -79,4 +79,3 @@ rules: props: sql-show: false - From 7ca5dbc5389ae01007f886bc66990fc9d72fd4a4 Mon Sep 17 00:00:00 2001 From: linghengqian Date: Tue, 14 Nov 2023 19:51:40 +0800 Subject: [PATCH 3/3] Use `java.util.Collection` instead of `java.util.List` in unit tests --- .../nativetest/jdbc/features/EncryptTest.java | 11 +++++------ .../infra/nativetest/jdbc/features/MaskTest.java | 10 +++++----- .../jdbc/features/ReadWriteSplittingTest.java | 10 +++++----- .../infra/nativetest/jdbc/features/ShadowTest.java | 14 +++++++------- .../nativetest/jdbc/features/ShardingTest.java | 14 +++++++------- 5 files changed, 29 insertions(+), 30 deletions(-) diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/EncryptTest.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/EncryptTest.java index 8141235b8ece2..d689197ba2ef9 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/EncryptTest.java +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/EncryptTest.java @@ -19,7 +19,6 @@ import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory; import org.apache.shardingsphere.infra.nativetest.FileTestUtils; - import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Address; import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.Order; import org.apache.shardingsphere.infra.nativetest.jdbc.features.entity.OrderItem; @@ -32,7 +31,7 @@ import java.io.IOException; import java.sql.SQLException; import java.util.ArrayList; -import java.util.List; +import java.util.Collection; import java.util.stream.Collectors; import java.util.stream.IntStream; import java.util.stream.LongStream; @@ -69,7 +68,7 @@ private void initEnvironment() throws SQLException { } private void processSuccess() throws SQLException { - final List orderIds = insertData(); + final Collection orderIds = insertData(); assertThat(orderRepository.selectAll(), equalTo(IntStream.range(1, 11).mapToObj(i -> new Order(i, i % 2, i, i, "INSERT_TEST")).collect(Collectors.toList()))); assertThat(orderItemRepository.selectAll(), @@ -82,8 +81,8 @@ private void processSuccess() throws SQLException { assertThat(addressRepository.selectAll(), equalTo(new ArrayList<>())); } - private List insertData() throws SQLException { - List result = new ArrayList<>(10); + private Collection insertData() throws SQLException { + Collection result = new ArrayList<>(10); for (int i = 1; i <= 10; i++) { Order order = new Order(); order.setUserId(i); @@ -104,7 +103,7 @@ private List insertData() throws SQLException { return result; } - private void deleteData(final List orderIds) throws SQLException { + private void deleteData(final Collection orderIds) throws SQLException { long count = 1; for (Long each : orderIds) { orderRepository.delete(each); diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/MaskTest.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/MaskTest.java index 32a1fd863b94d..db6f21e6e48a6 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/MaskTest.java +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/MaskTest.java @@ -31,7 +31,7 @@ import java.io.IOException; import java.sql.SQLException; import java.util.ArrayList; -import java.util.List; +import java.util.Collection; import java.util.stream.Collectors; import java.util.stream.IntStream; import java.util.stream.LongStream; @@ -68,7 +68,7 @@ private void initEnvironment() throws SQLException { } private void processSuccess() throws SQLException { - final List orderIds = insertData(); + final Collection orderIds = insertData(); assertThat(orderRepository.selectAll(), equalTo(IntStream.range(1, 11).mapToObj(i -> new Order(i, i % 2, i, i, "INSERT_TEST")).collect(Collectors.toList()))); assertThat(orderItemRepository.selectAll(), @@ -81,8 +81,8 @@ private void processSuccess() throws SQLException { assertThat(addressRepository.selectAll(), equalTo(new ArrayList<>())); } - private List insertData() throws SQLException { - List result = new ArrayList<>(10); + private Collection insertData() throws SQLException { + Collection result = new ArrayList<>(10); for (int i = 1; i <= 10; i++) { Order order = new Order(); order.setUserId(i); @@ -103,7 +103,7 @@ private List insertData() throws SQLException { return result; } - private void deleteData(final List orderIds) throws SQLException { + private void deleteData(final Collection orderIds) throws SQLException { long count = 1; for (Long each : orderIds) { orderRepository.delete(each); diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ReadWriteSplittingTest.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ReadWriteSplittingTest.java index ae5818a53e8c5..3f8737e931ba2 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ReadWriteSplittingTest.java +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ReadWriteSplittingTest.java @@ -32,7 +32,7 @@ import java.io.IOException; import java.sql.SQLException; import java.util.ArrayList; -import java.util.List; +import java.util.Collection; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -65,7 +65,7 @@ private void initEnvironment() throws SQLException { } private void processSuccess() throws SQLException { - List orderIds = insertData(); + Collection orderIds = insertData(); // This is intentional because the read operation is in the slave database and the corresponding table does not exist. assertThrows(JdbcSQLSyntaxErrorException.class, this::printData); deleteData(orderIds); @@ -73,8 +73,8 @@ private void processSuccess() throws SQLException { assertThrows(JdbcSQLSyntaxErrorException.class, this::printData); } - private List insertData() throws SQLException { - List result = new ArrayList<>(10); + private Collection insertData() throws SQLException { + Collection result = new ArrayList<>(10); for (int i = 1; i <= 10; i++) { Order order = new Order(); order.setUserId(i); @@ -95,7 +95,7 @@ private List insertData() throws SQLException { return result; } - private void deleteData(final List orderIds) throws SQLException { + private void deleteData(final Collection orderIds) throws SQLException { long count = 1; for (Long each : orderIds) { orderRepository.delete(each); diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShadowTest.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShadowTest.java index 8f795c0dcbe26..106deacf87636 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShadowTest.java +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShadowTest.java @@ -32,8 +32,8 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.Collections; -import java.util.List; import java.util.stream.Collectors; import java.util.stream.LongStream; @@ -71,7 +71,7 @@ private void initEnvironment() throws SQLException { } private void processSuccess() throws SQLException { - final List orderIds = insertData(); + final Collection orderIds = insertData(); assertThat(this.selectAll(), equalTo(Arrays.asList( new Order(1, 0, 2, 2, "INSERT_TEST"), new Order(2, 0, 4, 4, "INSERT_TEST"), @@ -102,8 +102,8 @@ private void processSuccess() throws SQLException { assertThat(addressRepository.selectAll(), equalTo(new ArrayList<>())); } - private List insertData() throws SQLException { - List result = new ArrayList<>(10); + private Collection insertData() throws SQLException { + Collection result = new ArrayList<>(10); for (int i = 1; i <= 10; i++) { Order order = new Order(); order.setUserId(i); @@ -124,7 +124,7 @@ private List insertData() throws SQLException { return result; } - private void deleteData(final List orderIds) throws SQLException { + private void deleteData(final Collection orderIds) throws SQLException { long count = 1; for (Long each : orderIds) { orderRepository.deleteShadow(each); @@ -134,8 +134,8 @@ private void deleteData(final List orderIds) throws SQLException { } } - private List selectAll() throws SQLException { - List result = orderRepository.selectAll(); + private Collection selectAll() throws SQLException { + Collection result = orderRepository.selectAll(); result.addAll(orderRepository.selectShadowOrder()); return result; } diff --git a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShardingTest.java b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShardingTest.java index 2ffa47962ba7b..2bd5d4620edf3 100644 --- a/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShardingTest.java +++ b/infra/nativetest/src/test/java/org/apache/shardingsphere/infra/nativetest/jdbc/features/ShardingTest.java @@ -32,7 +32,7 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.Arrays; -import java.util.List; +import java.util.Collection; import java.util.stream.Collectors; import java.util.stream.IntStream; import java.util.stream.LongStream; @@ -68,8 +68,8 @@ private void initEnvironment() throws SQLException { } private void processSuccess() throws SQLException { - final List orderIds = insertData(); - List orders = orderRepository.selectAll(); + final Collection orderIds = insertData(); + Collection orders = orderRepository.selectAll(); assertThat(orders.stream().map(Order::getOrderType).collect(Collectors.toList()), equalTo(Arrays.asList(1, 1, 1, 1, 1, 0, 0, 0, 0, 0))); assertThat(orders.stream().map(Order::getUserId).collect(Collectors.toList()), @@ -78,7 +78,7 @@ private void processSuccess() throws SQLException { equalTo(new ArrayList<>(Arrays.asList(1L, 3L, 5L, 7L, 9L, 2L, 4L, 6L, 8L, 10L)))); assertThat(orders.stream().map(Order::getStatus).collect(Collectors.toList()), equalTo(IntStream.range(1, 11).mapToObj(i -> "INSERT_TEST").collect(Collectors.toList()))); - List orderItems = orderItemRepository.selectAll(); + Collection orderItems = orderItemRepository.selectAll(); assertThat(orderItems.stream().map(OrderItem::getUserId).collect(Collectors.toList()), equalTo(new ArrayList<>(Arrays.asList(1, 3, 5, 7, 9, 2, 4, 6, 8, 10)))); assertThat(orderItems.stream().map(OrderItem::getPhone).collect(Collectors.toList()), @@ -93,8 +93,8 @@ private void processSuccess() throws SQLException { assertThat(addressRepository.selectAll(), equalTo(new ArrayList<>())); } - private List insertData() throws SQLException { - List result = new ArrayList<>(10); + private Collection insertData() throws SQLException { + Collection result = new ArrayList<>(10); for (int i = 1; i <= 10; i++) { Order order = new Order(); order.setUserId(i); @@ -115,7 +115,7 @@ private List insertData() throws SQLException { return result; } - private void deleteData(final List orderIds) throws SQLException { + private void deleteData(final Collection orderIds) throws SQLException { long count = 1; for (Long each : orderIds) { orderRepository.delete(each);