From 7dbe3c20724c7800290d89396c107bebee55f70a Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Thu, 18 Jan 2024 14:54:59 +0100 Subject: [PATCH 01/31] - added CI matrix for Exasol 7 and 8 - updated dependencies - changed default DB version used to run CI tests - ran PK and artifact unifier tool --- .github/workflows/broken_links_checker.yml | 2 + .github/workflows/ci-build-next-java.yml | 8 +- .github/workflows/ci-build.yml | 26 ++--- .github/workflows/dependencies_check.yml | 11 ++- ...elease_droid_prepare_original_checksum.yml | 11 ++- .../release_droid_print_quick_checksum.yml | 11 ++- ...release_droid_release_on_maven_central.yml | 9 +- ...ase_droid_upload_github_release_assets.yml | 11 ++- .project-keeper.yml | 4 +- dependencies.md | 96 ++++++++++--------- doc/changes/changelog.md | 1 + doc/changes/changes_8.0.0.md | 33 +++++++ doc/dialects/exasol.md | 2 +- pk_generated_parent.pom | 34 ++++++- pom.xml | 20 ++-- .../exasol/IntegrationTestConfiguration.java | 4 +- 16 files changed, 184 insertions(+), 99 deletions(-) create mode 100644 doc/changes/changes_8.0.0.md diff --git a/.github/workflows/broken_links_checker.yml b/.github/workflows/broken_links_checker.yml index 82ec1cd..0fbcad5 100644 --- a/.github/workflows/broken_links_checker.yml +++ b/.github/workflows/broken_links_checker.yml @@ -1,3 +1,5 @@ +# Generated by Project Keeper +# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/broken_links_checker.yml name: Broken Links Checker on: diff --git a/.github/workflows/ci-build-next-java.yml b/.github/workflows/ci-build-next-java.yml index 7cbab08..e3acdb7 100644 --- a/.github/workflows/ci-build-next-java.yml +++ b/.github/workflows/ci-build-next-java.yml @@ -1,5 +1,6 @@ +# Generated by Project Keeper +# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/ci-build-next-java.yml name: CI Build next Java - on: push: branches: @@ -18,7 +19,7 @@ jobs: with: fetch-depth: 0 - name: Set up JDK 17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: "temurin" java-version: 17 @@ -26,8 +27,9 @@ jobs: - name: Run tests and build with Maven run: | mvn --batch-mode --update-snapshots clean package -DtrimStackTrace=false \ + -Djava.version=17 \ -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn - - name: Publish Test Report + - name: Publish Test Report for Java 17 uses: scacap/action-surefire-report@v1 if: ${{ always() && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }} with: diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index acf3c0e..76adff4 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -8,7 +8,7 @@ on: pull_request: jobs: - build: + matrix-build: runs-on: ubuntu-20.04 concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.exasol_db_version }} @@ -16,9 +16,9 @@ jobs: strategy: fail-fast: false matrix: - exasol_db_version: ["7.1.24"] + exasol_db_version: ["7.1.25", "8.24.0"] env: - DEFAULT_EXASOL_DB_VERSION: "7.1.24" + DEFAULT_EXASOL_DB_VERSION: "7.1.25" steps: - name: Free Disk Space if: ${{ false }} @@ -29,13 +29,13 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Set up JDK 11 & 17 - uses: actions/setup-java@v3 + - name: Set up JDKs + uses: actions/setup-java@v4 with: distribution: "temurin" java-version: | - 17 11 + 17 cache: "maven" - name: Cache SonarCloud packages uses: actions/cache@v3 @@ -47,7 +47,7 @@ jobs: run: echo 'testcontainers.reuse.enable=true' > "$HOME/.testcontainers.properties" - name: Run tests and build with Maven run: | - JAVA_HOME=$JAVA_HOME_11_X64 mvn --batch-mode clean verify \ + mvn --batch-mode clean verify \ -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ -DtrimStackTrace=false \ -Dcom.exasol.dockerdb.image=${{ matrix.exasol_db_version }} @@ -55,7 +55,7 @@ jobs: # Set additional environment variable as in scala projects the scalatest plugin does not forward # the system property -Dcom.exasol.dockerdb.image to the test's implementation. EXASOL_DB_VERSION: ${{ matrix.exasol_db_version }} - - name: Publish Test Report + - name: Publish Test Report for Exasol ${{ matrix.exasol_db_version }} uses: scacap/action-surefire-report@v1 if: ${{ always() && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }} with: @@ -63,12 +63,16 @@ jobs: - name: Sonar analysis if: ${{ env.SONAR_TOKEN != null && matrix.exasol_db_version == env.DEFAULT_EXASOL_DB_VERSION }} run: | - JAVA_HOME=$JAVA_HOME_17_X64 mvn --batch-mode org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \ + mvn --batch-mode org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \ -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ -DtrimStackTrace=false \ - -Dsonar.organization=exasol \ - -Dsonar.host.url=https://sonarcloud.io \ -Dsonar.token=$SONAR_TOKEN env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + build: + needs: matrix-build + runs-on: ubuntu-latest + steps: + - run: echo "Build successful" diff --git a/.github/workflows/dependencies_check.yml b/.github/workflows/dependencies_check.yml index 4b6eadf..87b64ba 100644 --- a/.github/workflows/dependencies_check.yml +++ b/.github/workflows/dependencies_check.yml @@ -1,5 +1,6 @@ +# Generated by Project Keeper +# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/dependencies_check.yml name: Report Security Issues for Repository - on: workflow_dispatch: schedule: @@ -13,11 +14,13 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up JDK 11 - uses: actions/setup-java@v3 + - name: Set up JDKs + uses: actions/setup-java@v4 with: distribution: "temurin" - java-version: 11 + java-version: | + 11 + 17 cache: "maven" - name: Generate ossindex report diff --git a/.github/workflows/release_droid_prepare_original_checksum.yml b/.github/workflows/release_droid_prepare_original_checksum.yml index bc76555..413274b 100644 --- a/.github/workflows/release_droid_prepare_original_checksum.yml +++ b/.github/workflows/release_droid_prepare_original_checksum.yml @@ -1,5 +1,6 @@ +# Generated by Project Keeper +# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/release_droid_prepare_original_checksum.yml name: Release Droid - Prepare Original Checksum - on: workflow_dispatch: @@ -16,11 +17,13 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Set up JDK 11 - uses: actions/setup-java@v3 + - name: Set up JDKs + uses: actions/setup-java@v4 with: distribution: "temurin" - java-version: 11 + java-version: | + 11 + 17 cache: "maven" - name: Enable testcontainer reuse run: echo 'testcontainers.reuse.enable=true' > "$HOME/.testcontainers.properties" diff --git a/.github/workflows/release_droid_print_quick_checksum.yml b/.github/workflows/release_droid_print_quick_checksum.yml index aed4444..86979cd 100644 --- a/.github/workflows/release_droid_print_quick_checksum.yml +++ b/.github/workflows/release_droid_print_quick_checksum.yml @@ -1,5 +1,6 @@ +# Generated by Project Keeper +# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/release_droid_print_quick_checksum.yml name: Release Droid - Print Quick Checksum - on: workflow_dispatch: @@ -11,11 +12,13 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Set up JDK 11 - uses: actions/setup-java@v3 + - name: Set up JDKs + uses: actions/setup-java@v4 with: distribution: "temurin" - java-version: 11 + java-version: | + 11 + 17 cache: "maven" - name: Build with Maven skipping tests run: mvn --batch-mode clean verify -DskipTests diff --git a/.github/workflows/release_droid_release_on_maven_central.yml b/.github/workflows/release_droid_release_on_maven_central.yml index dfdbd6a..51d0659 100644 --- a/.github/workflows/release_droid_release_on_maven_central.yml +++ b/.github/workflows/release_droid_release_on_maven_central.yml @@ -1,5 +1,6 @@ +# Generated by Project Keeper +# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/release_droid_release_on_maven_central.yml name: Release Droid - Release On Maven Central - on: workflow_dispatch: @@ -12,10 +13,12 @@ jobs: with: fetch-depth: 0 - name: Set up Maven Central Repository - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: "temurin" - java-version: 11 + java-version: | + 11 + 17 cache: "maven" server-id: ossrh server-username: MAVEN_USERNAME diff --git a/.github/workflows/release_droid_upload_github_release_assets.yml b/.github/workflows/release_droid_upload_github_release_assets.yml index 7ae8bbb..b19f7cf 100644 --- a/.github/workflows/release_droid_upload_github_release_assets.yml +++ b/.github/workflows/release_droid_upload_github_release_assets.yml @@ -1,5 +1,6 @@ +# Generated by Project Keeper +# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/release_droid_upload_github_release_assets.yml name: Release Droid - Upload GitHub Release Assets - on: workflow_dispatch: inputs: @@ -15,11 +16,13 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Set up JDK 11 - uses: actions/setup-java@v3 + - name: Set up JDKs + uses: actions/setup-java@v4 with: distribution: "temurin" - java-version: 11 + java-version: | + 11 + 17 cache: "maven" - name: Build with Maven skipping tests run: mvn --batch-mode clean verify -DskipTests diff --git a/.project-keeper.yml b/.project-keeper.yml index aeb7ad1..478bded 100644 --- a/.project-keeper.yml +++ b/.project-keeper.yml @@ -8,5 +8,7 @@ sources: - maven_central build: runnerOs: ubuntu-20.04 + freeDiskSpace: false exasolDbVersions: - - "7.1.24" + - "7.1.25" + - "8.24.0" diff --git a/dependencies.md b/dependencies.md index fec6150..af05106 100644 --- a/dependencies.md +++ b/dependencies.md @@ -30,27 +30,28 @@ | Dependency | License | | ------------------------------------------------------- | --------------------------------- | | [SonarQube Scanner for Maven][26] | [GNU LGPL 3][27] | -| [Apache Maven Compiler Plugin][28] | [Apache-2.0][29] | -| [Apache Maven Enforcer Plugin][30] | [Apache-2.0][29] | -| [Maven Flatten Plugin][31] | [Apache Software Licenese][29] | -| [org.sonatype.ossindex.maven:ossindex-maven-plugin][32] | [ASL2][33] | -| [Maven Surefire Plugin][34] | [Apache-2.0][29] | -| [Versions Maven Plugin][35] | [Apache License, Version 2.0][29] | -| [duplicate-finder-maven-plugin Maven Mojo][36] | [Apache License 2.0][37] | -| [Project keeper maven plugin][38] | [The MIT License][39] | -| [Apache Maven Assembly Plugin][40] | [Apache-2.0][29] | -| [Apache Maven JAR Plugin][41] | [Apache License, Version 2.0][29] | -| [Artifact reference checker and unifier][42] | [MIT][11] | -| [Apache Maven Deploy Plugin][43] | [Apache-2.0][29] | -| [Apache Maven GPG Plugin][44] | [Apache-2.0][29] | -| [Apache Maven Source Plugin][45] | [Apache License, Version 2.0][29] | -| [Apache Maven Javadoc Plugin][46] | [Apache License, Version 2.0][29] | -| [Nexus Staging Maven Plugin][47] | [Eclipse Public License][48] | -| [Apache Maven Dependency Plugin][49] | [Apache-2.0][29] | -| [Maven Failsafe Plugin][50] | [Apache-2.0][29] | -| [JaCoCo :: Maven Plugin][51] | [Eclipse Public License 2.0][25] | -| [error-code-crawler-maven-plugin][52] | [MIT License][53] | -| [Reproducible Build Maven Plugin][54] | [Apache 2.0][33] | +| [Apache Maven Toolchains Plugin][28] | [Apache License, Version 2.0][29] | +| [Apache Maven Compiler Plugin][30] | [Apache-2.0][29] | +| [Apache Maven Enforcer Plugin][31] | [Apache-2.0][29] | +| [Maven Flatten Plugin][32] | [Apache Software Licenese][29] | +| [org.sonatype.ossindex.maven:ossindex-maven-plugin][33] | [ASL2][34] | +| [Maven Surefire Plugin][35] | [Apache-2.0][29] | +| [Versions Maven Plugin][36] | [Apache License, Version 2.0][29] | +| [duplicate-finder-maven-plugin Maven Mojo][37] | [Apache License 2.0][38] | +| [Project Keeper Maven plugin][39] | [The MIT License][40] | +| [Apache Maven Assembly Plugin][41] | [Apache-2.0][29] | +| [Apache Maven JAR Plugin][42] | [Apache License, Version 2.0][29] | +| [Artifact reference checker and unifier][43] | [MIT][11] | +| [Apache Maven Deploy Plugin][44] | [Apache-2.0][29] | +| [Apache Maven GPG Plugin][45] | [Apache-2.0][29] | +| [Apache Maven Source Plugin][46] | [Apache License, Version 2.0][29] | +| [Apache Maven Javadoc Plugin][47] | [Apache License, Version 2.0][29] | +| [Nexus Staging Maven Plugin][48] | [Eclipse Public License][49] | +| [Apache Maven Dependency Plugin][50] | [Apache-2.0][29] | +| [Maven Failsafe Plugin][51] | [Apache-2.0][29] | +| [JaCoCo :: Maven Plugin][52] | [Eclipse Public License 2.0][25] | +| [error-code-crawler-maven-plugin][53] | [MIT License][54] | +| [Reproducible Build Maven Plugin][55] | [Apache 2.0][34] | [0]: https://github.com/exasol/virtual-schema-common-jdbc/ [1]: https://github.com/exasol/virtual-schema-common-jdbc/blob/main/LICENSE @@ -80,30 +81,31 @@ [25]: https://www.eclipse.org/legal/epl-2.0/ [26]: http://sonarsource.github.io/sonar-scanner-maven/ [27]: http://www.gnu.org/licenses/lgpl.txt -[28]: https://maven.apache.org/plugins/maven-compiler-plugin/ +[28]: https://maven.apache.org/plugins/maven-toolchains-plugin/ [29]: https://www.apache.org/licenses/LICENSE-2.0.txt -[30]: https://maven.apache.org/enforcer/maven-enforcer-plugin/ -[31]: https://www.mojohaus.org/flatten-maven-plugin/ -[32]: https://sonatype.github.io/ossindex-maven/maven-plugin/ -[33]: http://www.apache.org/licenses/LICENSE-2.0.txt -[34]: https://maven.apache.org/surefire/maven-surefire-plugin/ -[35]: https://www.mojohaus.org/versions/versions-maven-plugin/ -[36]: https://basepom.github.io/duplicate-finder-maven-plugin -[37]: http://www.apache.org/licenses/LICENSE-2.0.html -[38]: https://github.com/exasol/project-keeper/ -[39]: https://github.com/exasol/project-keeper/blob/main/LICENSE -[40]: https://maven.apache.org/plugins/maven-assembly-plugin/ -[41]: https://maven.apache.org/plugins/maven-jar-plugin/ -[42]: https://github.com/exasol/artifact-reference-checker-maven-plugin -[43]: https://maven.apache.org/plugins/maven-deploy-plugin/ -[44]: https://maven.apache.org/plugins/maven-gpg-plugin/ -[45]: https://maven.apache.org/plugins/maven-source-plugin/ -[46]: https://maven.apache.org/plugins/maven-javadoc-plugin/ -[47]: http://www.sonatype.com/public-parent/nexus-maven-plugins/nexus-staging/nexus-staging-maven-plugin/ -[48]: http://www.eclipse.org/legal/epl-v10.html -[49]: https://maven.apache.org/plugins/maven-dependency-plugin/ -[50]: https://maven.apache.org/surefire/maven-failsafe-plugin/ -[51]: https://www.jacoco.org/jacoco/trunk/doc/maven.html -[52]: https://github.com/exasol/error-code-crawler-maven-plugin/ -[53]: https://github.com/exasol/error-code-crawler-maven-plugin/blob/main/LICENSE -[54]: http://zlika.github.io/reproducible-build-maven-plugin +[30]: https://maven.apache.org/plugins/maven-compiler-plugin/ +[31]: https://maven.apache.org/enforcer/maven-enforcer-plugin/ +[32]: https://www.mojohaus.org/flatten-maven-plugin/ +[33]: https://sonatype.github.io/ossindex-maven/maven-plugin/ +[34]: http://www.apache.org/licenses/LICENSE-2.0.txt +[35]: https://maven.apache.org/surefire/maven-surefire-plugin/ +[36]: https://www.mojohaus.org/versions/versions-maven-plugin/ +[37]: https://basepom.github.io/duplicate-finder-maven-plugin +[38]: http://www.apache.org/licenses/LICENSE-2.0.html +[39]: https://github.com/exasol/project-keeper/ +[40]: https://github.com/exasol/project-keeper/blob/main/LICENSE +[41]: https://maven.apache.org/plugins/maven-assembly-plugin/ +[42]: https://maven.apache.org/plugins/maven-jar-plugin/ +[43]: https://github.com/exasol/artifact-reference-checker-maven-plugin +[44]: https://maven.apache.org/plugins/maven-deploy-plugin/ +[45]: https://maven.apache.org/plugins/maven-gpg-plugin/ +[46]: https://maven.apache.org/plugins/maven-source-plugin/ +[47]: https://maven.apache.org/plugins/maven-javadoc-plugin/ +[48]: http://www.sonatype.com/public-parent/nexus-maven-plugins/nexus-staging/nexus-staging-maven-plugin/ +[49]: http://www.eclipse.org/legal/epl-v10.html +[50]: https://maven.apache.org/plugins/maven-dependency-plugin/ +[51]: https://maven.apache.org/surefire/maven-failsafe-plugin/ +[52]: https://www.jacoco.org/jacoco/trunk/doc/maven.html +[53]: https://github.com/exasol/error-code-crawler-maven-plugin/ +[54]: https://github.com/exasol/error-code-crawler-maven-plugin/blob/main/LICENSE +[55]: http://zlika.github.io/reproducible-build-maven-plugin diff --git a/doc/changes/changelog.md b/doc/changes/changelog.md index e833da0..dd1bb4b 100644 --- a/doc/changes/changelog.md +++ b/doc/changes/changelog.md @@ -1,5 +1,6 @@ # Changes +* [8.0.0](changes_8.0.0.md) * [7.1.6](changes_7.1.6.md) * [7.1.5](changes_7.1.5.md) * [7.1.4](changes_7.1.4.md) diff --git a/doc/changes/changes_8.0.0.md b/doc/changes/changes_8.0.0.md new file mode 100644 index 0000000..b398a99 --- /dev/null +++ b/doc/changes/changes_8.0.0.md @@ -0,0 +1,33 @@ +# Exasol Virtual Schema 8.0.0, released 2024-??-?? + +Code name: + +## Summary + +## Features + +* ISSUE_NUMBER: description + +## Dependency Updates + +### Compile Dependency Updates + +* Updated `com.exasol:virtual-schema-common-jdbc:11.0.2` to `12.0.0` + +### Test Dependency Updates + +* Updated `com.exasol:exasol-testcontainers:6.6.3` to `7.0.0` +* Updated `com.exasol:hamcrest-resultset-matcher:1.6.3` to `1.6.4` +* Updated `com.exasol:test-db-builder-java:3.5.2` to `3.5.3` +* Updated `com.exasol:virtual-schema-common-jdbc:11.0.2` to `12.0.0` +* Updated `org.mockito:mockito-junit-jupiter:5.7.0` to `5.9.0` +* Updated `org.slf4j:slf4j-jdk14:2.0.9` to `2.0.11` +* Updated `org.testcontainers:junit-jupiter:1.19.2` to `1.19.3` + +### Plugin Dependency Updates + +* Updated `com.exasol:project-keeper-maven-plugin:2.9.16` to `3.0.0` +* Updated `org.apache.maven.plugins:maven-failsafe-plugin:3.2.2` to `3.2.3` +* Updated `org.apache.maven.plugins:maven-surefire-plugin:3.2.2` to `3.2.3` +* Added `org.apache.maven.plugins:maven-toolchains-plugin:3.1.0` +* Updated `org.codehaus.mojo:versions-maven-plugin:2.16.1` to `2.16.2` diff --git a/doc/dialects/exasol.md b/doc/dialects/exasol.md index e61a343..c12b4e2 100644 --- a/doc/dialects/exasol.md +++ b/doc/dialects/exasol.md @@ -17,7 +17,7 @@ The SQL statement below creates the adapter script, defines the Java class that ```sql CREATE JAVA ADAPTER SCRIPT SCHEMA_FOR_VS_SCRIPT.ADAPTER_SCRIPT_EXASOL AS %scriptclass com.exasol.adapter.RequestDispatcher; - %jar /buckets///virtual-schema-dist-11.0.2-exasol-7.1.6.jar; + %jar /buckets///virtual-schema-dist-12.0.0-exasol-8.0.0.jar; / ``` diff --git a/pk_generated_parent.pom b/pk_generated_parent.pom index 4891cfa..967a3d5 100644 --- a/pk_generated_parent.pom +++ b/pk_generated_parent.pom @@ -3,12 +3,14 @@ 4.0.0 com.exasol exasol-virtual-schema-generated-parent - 7.1.6 + 8.0.0 pom UTF-8 UTF-8 11 + exasol + https://sonarcloud.io true @@ -58,6 +60,25 @@ sonar-maven-plugin 3.10.0.2594 + + org.apache.maven.plugins + maven-toolchains-plugin + 3.1.0 + + + + toolchain + + + + + + + ${java.version} + + + + org.apache.maven.plugins maven-compiler-plugin @@ -88,6 +109,9 @@ 3.6.3 + + 17 + @@ -135,7 +159,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.2.2 + 3.2.3 @@ -146,7 +170,7 @@ org.codehaus.mojo versions-maven-plugin - 2.16.1 + 2.16.2 display-updates @@ -283,7 +307,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.6.2 + 3.6.3 attach-javadocs @@ -345,7 +369,7 @@ org.apache.maven.plugins maven-failsafe-plugin - 3.2.2 + 3.2.3 -Djava.util.logging.config.file=src/test/resources/logging.properties ${argLine} diff --git a/pom.xml b/pom.xml index c8d1b95..9dc9f1e 100644 --- a/pom.xml +++ b/pom.xml @@ -2,12 +2,12 @@ 4.0.0 exasol-virtual-schema - 7.1.6 + 8.0.0 Exasol Virtual Schema This projects contains the Exasol dialect for Exasol's Virtual Schema https://github.com/exasol/exasol-virtual-schema/ - 11.0.2 + 12.0.0 @@ -49,38 +49,38 @@ org.mockito mockito-junit-jupiter - 5.7.0 + 5.9.0 test com.exasol exasol-testcontainers - 6.6.3 + 7.0.0 test org.testcontainers junit-jupiter - 1.19.2 + 1.19.3 test com.exasol hamcrest-resultset-matcher - 1.6.3 + 1.6.4 test org.slf4j slf4j-jdk14 - 2.0.9 + 2.0.11 test com.exasol test-db-builder-java - 3.5.2 + 3.5.3 test @@ -95,7 +95,7 @@ com.exasol project-keeper-maven-plugin - 2.9.16 + 3.0.0 @@ -162,7 +162,7 @@ exasol-virtual-schema-generated-parent com.exasol - 7.1.6 + 8.0.0 pk_generated_parent.pom diff --git a/src/test/java/com/exasol/adapter/dialects/exasol/IntegrationTestConfiguration.java b/src/test/java/com/exasol/adapter/dialects/exasol/IntegrationTestConfiguration.java index bf2052e..993f2cb 100644 --- a/src/test/java/com/exasol/adapter/dialects/exasol/IntegrationTestConfiguration.java +++ b/src/test/java/com/exasol/adapter/dialects/exasol/IntegrationTestConfiguration.java @@ -3,12 +3,12 @@ import java.nio.file.Path; public final class IntegrationTestConfiguration { - private static final String DEFAULT_DOCKER_DB_REFERENCE = "7.1.24"; + private static final String DEFAULT_DOCKER_DB_REFERENCE = "8.24.0"; /** * Do not use MavenProjectVersionGetter here to enable reference checker to check if reference points to the latest * version. */ - public static final String VIRTUAL_SCHEMAS_JAR_NAME_AND_VERSION = "virtual-schema-dist-11.0.2-exasol-7.1.6.jar"; + public static final String VIRTUAL_SCHEMAS_JAR_NAME_AND_VERSION = "virtual-schema-dist-12.0.0-exasol-8.0.0.jar"; public static final Path PATH_TO_VIRTUAL_SCHEMAS_JAR = Path.of("target", VIRTUAL_SCHEMAS_JAR_NAME_AND_VERSION); private IntegrationTestConfiguration() { From 8ea77f06edabd7db66c9bc3154dee0bf2d76edeb Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Thu, 18 Jan 2024 14:56:34 +0100 Subject: [PATCH 02/31] altered tests after changed vsjdbc 12.0.0 behaviour --- .../dialects/exasol/ExasolColumnMetadataReaderTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/exasol/adapter/dialects/exasol/ExasolColumnMetadataReaderTest.java b/src/test/java/com/exasol/adapter/dialects/exasol/ExasolColumnMetadataReaderTest.java index e16a9f2..a9b85de 100644 --- a/src/test/java/com/exasol/adapter/dialects/exasol/ExasolColumnMetadataReaderTest.java +++ b/src/test/java/com/exasol/adapter/dialects/exasol/ExasolColumnMetadataReaderTest.java @@ -104,7 +104,7 @@ void testMapJdbcTypeVarchar() { @Test void testMapJdbcTypeVarcharAscii() { - assertTypeMapped(varchar(5).byteSize(5), DataType.createVarChar(5, ExaCharset.ASCII)); + assertTypeMapped(varchar(5).byteSize(5), DataType.createVarChar(5, ExaCharset.UTF8)); } @Test @@ -124,7 +124,7 @@ void testMapJdbcTypeCharUtf8() { @Test void testMapJdbcTypeCharAscii() { - assertTypeMapped(charType(5).byteSize(5), DataType.createChar(5, ExaCharset.ASCII)); + assertTypeMapped(charType(5).byteSize(5), DataType.createChar(5, ExaCharset.UTF8)); } @Test From c96b765097ced3a5ad70fa23f9d44d4e24d9f892 Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Fri, 19 Jan 2024 12:27:14 +0100 Subject: [PATCH 03/31] fix wildcard test using describe (zonemapping is a new column) --- .../exasol/AbstractExasolSqlDialectIT.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java b/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java index 09fe05f..e7511f9 100644 --- a/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java +++ b/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java @@ -11,6 +11,7 @@ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.matchesPattern; import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import java.io.FileNotFoundException; import java.math.BigDecimal; @@ -841,8 +842,27 @@ void testCurrentClusterFunction() throws SQLException { } } + static void assumeExasol8OrHigher() { + assumeTrue(isExasol8OrHigher(), "is Exasol version 8 or higher"); + } + + static void assumeExasol7OrLower() { + assumeTrue(isExasol7OrLower(), "is Exasol version 7 or lower"); + } + + static boolean isExasol8OrHigher() { + final ExasolDockerImageReference imageReference = EXASOL.getDockerImageReference(); + return imageReference.hasMajor() && (imageReference.getMajor() >= 8); + } + + static boolean isExasol7OrLower() { + final ExasolDockerImageReference imageReference = EXASOL.getDockerImageReference(); + return imageReference.hasMajor() && (imageReference.getMajor() <= 7); + } + @Test void testWildcards() throws SQLException { + assumeExasol7OrLower(); final String nameWithWildcard = "A_A"; this.sourceSchema.createTable(nameWithWildcard, "A", "VARCHAR(20)"); this.sourceSchema.createTable("AXA", "X", "VARCHAR(20)"); @@ -851,6 +871,17 @@ void testWildcards() throws SQLException { table().row("A", "VARCHAR(20) UTF8", null, null, null).matches()); } + @Test + void testWildcardsExasolV8() throws SQLException { + assumeExasol8OrHigher(); + final String nameWithWildcard = "A_A"; + this.sourceSchema.createTable(nameWithWildcard, "A", "VARCHAR(20)"); + this.sourceSchema.createTable("AXA", "X", "VARCHAR(20)"); + this.virtualSchema = createVirtualSchema(this.sourceSchema); + assertVsQuery("describe " + this.virtualSchema.getFullyQualifiedName() + ".\"" + nameWithWildcard + "\"", + table().row("A", "VARCHAR(20) UTF8", null, null, null, null).matches()); + } + @Test @DisplayName("Verify DISTINCT with integer literal") void testDistinctWithIntegerLiteral() throws SQLException { From becad8a82cc89bb825721c5c568f0c5ce954b2b4 Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Fri, 19 Jan 2024 12:27:31 +0100 Subject: [PATCH 04/31] fix grammatical error --- doc/dialects/exasol.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/dialects/exasol.md b/doc/dialects/exasol.md index c12b4e2..03dfd66 100644 --- a/doc/dialects/exasol.md +++ b/doc/dialects/exasol.md @@ -174,7 +174,7 @@ The Exasol SQL dialect supports all capabilities that are supported by the virtu ### Data type `TIMESTAMP WITH LOCAL TIME ZONE` -Using literals and constant expressions with `TIMESTAMP WITH LOCAL TIME ZONE` data type in Virtual Schemas can produce an incorrect results. +Using literals and constant expressions with `TIMESTAMP WITH LOCAL TIME ZONE` data type in Virtual Schemas can produce incorrect results. * We recommend using `TIMESTAMP` instead. * If you are willing to take the risk and want to use `TIMESTAMP WITH LOCAL TIME ZONE` anyway, please, create a Virtual Schema with the following additional property `IGNORE_ERRORS = 'TIMESTAMP_WITH_LOCAL_TIME_ZONE_USAGE'`. * We also recommend to set Exasol system `time_zone` to UTC while working with `TIMESTAMP WITH LOCAL TIME ZONE`. From 2b7518012cfba042ff26a59e1a9032eff1ea45cc Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Mon, 22 Jan 2024 14:34:49 +0100 Subject: [PATCH 05/31] add support for remote debugging via udf-debugging-java --- pom.xml | 7 ++++ .../exasol/AbstractExasolSqlDialectIT.java | 36 ++++++++++++++----- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 9dc9f1e..de0852d 100644 --- a/pom.xml +++ b/pom.xml @@ -8,6 +8,7 @@ https://github.com/exasol/exasol-virtual-schema/ 12.0.0 + 1.19.0 @@ -89,6 +90,12 @@ 1.2.0 test + + com.exasol + udf-debugging-java + 0.6.11 + test + diff --git a/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java b/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java index e7511f9..e3d0582 100644 --- a/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java +++ b/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java @@ -5,11 +5,9 @@ import static com.exasol.adapter.dialects.exasol.IntegrationTestConfiguration.VIRTUAL_SCHEMAS_JAR_NAME_AND_VERSION; import static com.exasol.dbbuilder.dialects.exasol.ExasolObjectPrivilege.SELECT; import static com.exasol.matcher.ResultSetStructureMatcher.table; -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.Matchers.matchesPattern; +import static org.junit.Assert.assertThat; import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assumptions.assumeTrue; @@ -39,6 +37,8 @@ import com.exasol.dbbuilder.dialects.exasol.AdapterScript.Language; import com.exasol.matcher.ResultSetStructureMatcher.Builder; import com.exasol.matcher.TypeMatchMode; +import com.exasol.udfdebugging.UdfTestSetup; +import com.github.dockerjava.api.model.ContainerNetwork; @Tag("integration") @Testcontainers @@ -58,13 +58,33 @@ abstract class AbstractExasolSqlDialectIT { private ConnectionDefinition jdbcConnection; private final Set expectVarcharFor = expectVarcharFor(); + AbstractExasolSqlDialectIT() { + try { + connection = EXASOL.createConnection(""); + final UdfTestSetup udfTestSetup = new UdfTestSetup(getTestHostIpFromInsideExasol(), + EXASOL.getDefaultBucket(), connection); + objectFactory = new ExasolObjectFactory(connection, + ExasolObjectConfiguration.builder().withJvmOptions(udfTestSetup.getJvmOptions()).build()); + adapterSchema = objectFactory.createSchema("ADAPTER_SCHEMA"); + adapterScript = installVirtualSchemaAdapter(adapterSchema); + + } catch (final SQLException | BucketAccessException | TimeoutException | FileNotFoundException exception) { + throw new IllegalStateException("Failed to created test setup.", exception); + } + } + @BeforeAll static void beforeAll() throws BucketAccessException, TimeoutException, NoDriverFoundException, SQLException, FileNotFoundException { - connection = EXASOL.createConnection(""); - objectFactory = new ExasolObjectFactory(connection); - adapterSchema = objectFactory.createSchema("ADAPTER_SCHEMA"); - adapterScript = installVirtualSchemaAdapter(adapterSchema); + + } + + private String getTestHostIpFromInsideExasol() { + final Map networks = EXASOL.getContainerInfo().getNetworkSettings().getNetworks(); + if (networks.size() == 0) { + return null; + } + return networks.values().iterator().next().getGateway(); } private static AdapterScript installVirtualSchemaAdapter(final ExasolSchema adapterSchema) From dcba82634222887852c00ea104b4475fa71eab82 Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Mon, 22 Jan 2024 14:35:26 +0100 Subject: [PATCH 06/31] ran pk fix after updating dependencies --- dependencies.md | 115 ++++++++++++++++++----------------- doc/changes/changes_8.0.0.md | 1 + 2 files changed, 60 insertions(+), 56 deletions(-) diff --git a/dependencies.md b/dependencies.md index af05106..b333153 100644 --- a/dependencies.md +++ b/dependencies.md @@ -23,35 +23,36 @@ | [SLF4J JDK14 Provider][18] | [MIT License][19] | | [Test Database Builder for Java][20] | [MIT License][21] | | [Maven Project Version Getter][22] | [MIT License][23] | -| [JaCoCo :: Agent][24] | [Eclipse Public License 2.0][25] | +| [udf-debugging-java][24] | [MIT License][25] | +| [JaCoCo :: Agent][26] | [Eclipse Public License 2.0][27] | ## Plugin Dependencies | Dependency | License | | ------------------------------------------------------- | --------------------------------- | -| [SonarQube Scanner for Maven][26] | [GNU LGPL 3][27] | -| [Apache Maven Toolchains Plugin][28] | [Apache License, Version 2.0][29] | -| [Apache Maven Compiler Plugin][30] | [Apache-2.0][29] | -| [Apache Maven Enforcer Plugin][31] | [Apache-2.0][29] | -| [Maven Flatten Plugin][32] | [Apache Software Licenese][29] | -| [org.sonatype.ossindex.maven:ossindex-maven-plugin][33] | [ASL2][34] | -| [Maven Surefire Plugin][35] | [Apache-2.0][29] | -| [Versions Maven Plugin][36] | [Apache License, Version 2.0][29] | -| [duplicate-finder-maven-plugin Maven Mojo][37] | [Apache License 2.0][38] | -| [Project Keeper Maven plugin][39] | [The MIT License][40] | -| [Apache Maven Assembly Plugin][41] | [Apache-2.0][29] | -| [Apache Maven JAR Plugin][42] | [Apache License, Version 2.0][29] | -| [Artifact reference checker and unifier][43] | [MIT][11] | -| [Apache Maven Deploy Plugin][44] | [Apache-2.0][29] | -| [Apache Maven GPG Plugin][45] | [Apache-2.0][29] | -| [Apache Maven Source Plugin][46] | [Apache License, Version 2.0][29] | -| [Apache Maven Javadoc Plugin][47] | [Apache License, Version 2.0][29] | -| [Nexus Staging Maven Plugin][48] | [Eclipse Public License][49] | -| [Apache Maven Dependency Plugin][50] | [Apache-2.0][29] | -| [Maven Failsafe Plugin][51] | [Apache-2.0][29] | -| [JaCoCo :: Maven Plugin][52] | [Eclipse Public License 2.0][25] | -| [error-code-crawler-maven-plugin][53] | [MIT License][54] | -| [Reproducible Build Maven Plugin][55] | [Apache 2.0][34] | +| [SonarQube Scanner for Maven][28] | [GNU LGPL 3][29] | +| [Apache Maven Toolchains Plugin][30] | [Apache License, Version 2.0][31] | +| [Apache Maven Compiler Plugin][32] | [Apache-2.0][31] | +| [Apache Maven Enforcer Plugin][33] | [Apache-2.0][31] | +| [Maven Flatten Plugin][34] | [Apache Software Licenese][31] | +| [org.sonatype.ossindex.maven:ossindex-maven-plugin][35] | [ASL2][36] | +| [Maven Surefire Plugin][37] | [Apache-2.0][31] | +| [Versions Maven Plugin][38] | [Apache License, Version 2.0][31] | +| [duplicate-finder-maven-plugin Maven Mojo][39] | [Apache License 2.0][40] | +| [Project Keeper Maven plugin][41] | [The MIT License][42] | +| [Apache Maven Assembly Plugin][43] | [Apache-2.0][31] | +| [Apache Maven JAR Plugin][44] | [Apache License, Version 2.0][31] | +| [Artifact reference checker and unifier][45] | [MIT][11] | +| [Apache Maven Deploy Plugin][46] | [Apache-2.0][31] | +| [Apache Maven GPG Plugin][47] | [Apache-2.0][31] | +| [Apache Maven Source Plugin][48] | [Apache License, Version 2.0][31] | +| [Apache Maven Javadoc Plugin][49] | [Apache License, Version 2.0][31] | +| [Nexus Staging Maven Plugin][50] | [Eclipse Public License][51] | +| [Apache Maven Dependency Plugin][52] | [Apache-2.0][31] | +| [Maven Failsafe Plugin][53] | [Apache-2.0][31] | +| [JaCoCo :: Maven Plugin][54] | [Eclipse Public License 2.0][27] | +| [error-code-crawler-maven-plugin][55] | [MIT License][56] | +| [Reproducible Build Maven Plugin][57] | [Apache 2.0][36] | [0]: https://github.com/exasol/virtual-schema-common-jdbc/ [1]: https://github.com/exasol/virtual-schema-common-jdbc/blob/main/LICENSE @@ -77,35 +78,37 @@ [21]: https://github.com/exasol/test-db-builder-java/blob/main/LICENSE [22]: https://github.com/exasol/maven-project-version-getter/ [23]: https://github.com/exasol/maven-project-version-getter/blob/main/LICENSE -[24]: https://www.eclemma.org/jacoco/index.html -[25]: https://www.eclipse.org/legal/epl-2.0/ -[26]: http://sonarsource.github.io/sonar-scanner-maven/ -[27]: http://www.gnu.org/licenses/lgpl.txt -[28]: https://maven.apache.org/plugins/maven-toolchains-plugin/ -[29]: https://www.apache.org/licenses/LICENSE-2.0.txt -[30]: https://maven.apache.org/plugins/maven-compiler-plugin/ -[31]: https://maven.apache.org/enforcer/maven-enforcer-plugin/ -[32]: https://www.mojohaus.org/flatten-maven-plugin/ -[33]: https://sonatype.github.io/ossindex-maven/maven-plugin/ -[34]: http://www.apache.org/licenses/LICENSE-2.0.txt -[35]: https://maven.apache.org/surefire/maven-surefire-plugin/ -[36]: https://www.mojohaus.org/versions/versions-maven-plugin/ -[37]: https://basepom.github.io/duplicate-finder-maven-plugin -[38]: http://www.apache.org/licenses/LICENSE-2.0.html -[39]: https://github.com/exasol/project-keeper/ -[40]: https://github.com/exasol/project-keeper/blob/main/LICENSE -[41]: https://maven.apache.org/plugins/maven-assembly-plugin/ -[42]: https://maven.apache.org/plugins/maven-jar-plugin/ -[43]: https://github.com/exasol/artifact-reference-checker-maven-plugin -[44]: https://maven.apache.org/plugins/maven-deploy-plugin/ -[45]: https://maven.apache.org/plugins/maven-gpg-plugin/ -[46]: https://maven.apache.org/plugins/maven-source-plugin/ -[47]: https://maven.apache.org/plugins/maven-javadoc-plugin/ -[48]: http://www.sonatype.com/public-parent/nexus-maven-plugins/nexus-staging/nexus-staging-maven-plugin/ -[49]: http://www.eclipse.org/legal/epl-v10.html -[50]: https://maven.apache.org/plugins/maven-dependency-plugin/ -[51]: https://maven.apache.org/surefire/maven-failsafe-plugin/ -[52]: https://www.jacoco.org/jacoco/trunk/doc/maven.html -[53]: https://github.com/exasol/error-code-crawler-maven-plugin/ -[54]: https://github.com/exasol/error-code-crawler-maven-plugin/blob/main/LICENSE -[55]: http://zlika.github.io/reproducible-build-maven-plugin +[24]: https://github.com/exasol/udf-debugging-java/ +[25]: https://github.com/exasol/udf-debugging-java/blob/main/LICENSE +[26]: https://www.eclemma.org/jacoco/index.html +[27]: https://www.eclipse.org/legal/epl-2.0/ +[28]: http://sonarsource.github.io/sonar-scanner-maven/ +[29]: http://www.gnu.org/licenses/lgpl.txt +[30]: https://maven.apache.org/plugins/maven-toolchains-plugin/ +[31]: https://www.apache.org/licenses/LICENSE-2.0.txt +[32]: https://maven.apache.org/plugins/maven-compiler-plugin/ +[33]: https://maven.apache.org/enforcer/maven-enforcer-plugin/ +[34]: https://www.mojohaus.org/flatten-maven-plugin/ +[35]: https://sonatype.github.io/ossindex-maven/maven-plugin/ +[36]: http://www.apache.org/licenses/LICENSE-2.0.txt +[37]: https://maven.apache.org/surefire/maven-surefire-plugin/ +[38]: https://www.mojohaus.org/versions/versions-maven-plugin/ +[39]: https://basepom.github.io/duplicate-finder-maven-plugin +[40]: http://www.apache.org/licenses/LICENSE-2.0.html +[41]: https://github.com/exasol/project-keeper/ +[42]: https://github.com/exasol/project-keeper/blob/main/LICENSE +[43]: https://maven.apache.org/plugins/maven-assembly-plugin/ +[44]: https://maven.apache.org/plugins/maven-jar-plugin/ +[45]: https://github.com/exasol/artifact-reference-checker-maven-plugin +[46]: https://maven.apache.org/plugins/maven-deploy-plugin/ +[47]: https://maven.apache.org/plugins/maven-gpg-plugin/ +[48]: https://maven.apache.org/plugins/maven-source-plugin/ +[49]: https://maven.apache.org/plugins/maven-javadoc-plugin/ +[50]: http://www.sonatype.com/public-parent/nexus-maven-plugins/nexus-staging/nexus-staging-maven-plugin/ +[51]: http://www.eclipse.org/legal/epl-v10.html +[52]: https://maven.apache.org/plugins/maven-dependency-plugin/ +[53]: https://maven.apache.org/surefire/maven-failsafe-plugin/ +[54]: https://www.jacoco.org/jacoco/trunk/doc/maven.html +[55]: https://github.com/exasol/error-code-crawler-maven-plugin/ +[56]: https://github.com/exasol/error-code-crawler-maven-plugin/blob/main/LICENSE +[57]: http://zlika.github.io/reproducible-build-maven-plugin diff --git a/doc/changes/changes_8.0.0.md b/doc/changes/changes_8.0.0.md index b398a99..64e2652 100644 --- a/doc/changes/changes_8.0.0.md +++ b/doc/changes/changes_8.0.0.md @@ -19,6 +19,7 @@ Code name: * Updated `com.exasol:exasol-testcontainers:6.6.3` to `7.0.0` * Updated `com.exasol:hamcrest-resultset-matcher:1.6.3` to `1.6.4` * Updated `com.exasol:test-db-builder-java:3.5.2` to `3.5.3` +* Added `com.exasol:udf-debugging-java:0.6.11` * Updated `com.exasol:virtual-schema-common-jdbc:11.0.2` to `12.0.0` * Updated `org.mockito:mockito-junit-jupiter:5.7.0` to `5.9.0` * Updated `org.slf4j:slf4j-jdk14:2.0.9` to `2.0.11` From 0cb06f14152f40f6ef679d2fe7a0984d38c96129 Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Tue, 23 Jan 2024 13:15:42 +0100 Subject: [PATCH 07/31] disable fail on error for javadoc for now --- dependencies.md | 2 +- doc/changes/changes_8.0.0.md | 1 + pom.xml | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dependencies.md b/dependencies.md index b333153..70ca089 100644 --- a/dependencies.md +++ b/dependencies.md @@ -46,7 +46,7 @@ | [Apache Maven Deploy Plugin][46] | [Apache-2.0][31] | | [Apache Maven GPG Plugin][47] | [Apache-2.0][31] | | [Apache Maven Source Plugin][48] | [Apache License, Version 2.0][31] | -| [Apache Maven Javadoc Plugin][49] | [Apache License, Version 2.0][31] | +| [Apache Maven Javadoc Plugin][49] | [Apache-2.0][31] | | [Nexus Staging Maven Plugin][50] | [Eclipse Public License][51] | | [Apache Maven Dependency Plugin][52] | [Apache-2.0][31] | | [Maven Failsafe Plugin][53] | [Apache-2.0][31] | diff --git a/doc/changes/changes_8.0.0.md b/doc/changes/changes_8.0.0.md index 64e2652..e4e2e09 100644 --- a/doc/changes/changes_8.0.0.md +++ b/doc/changes/changes_8.0.0.md @@ -29,6 +29,7 @@ Code name: * Updated `com.exasol:project-keeper-maven-plugin:2.9.16` to `3.0.0` * Updated `org.apache.maven.plugins:maven-failsafe-plugin:3.2.2` to `3.2.3` +* Updated `org.apache.maven.plugins:maven-javadoc-plugin:3.4.1` to `3.6.3` * Updated `org.apache.maven.plugins:maven-surefire-plugin:3.2.2` to `3.2.3` * Added `org.apache.maven.plugins:maven-toolchains-plugin:3.1.0` * Updated `org.codehaus.mojo:versions-maven-plugin:2.16.1` to `2.16.2` diff --git a/pom.xml b/pom.xml index de0852d..b9f2c67 100644 --- a/pom.xml +++ b/pom.xml @@ -154,14 +154,15 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.4.1 + 3.6.3 + false - + From 543a74dada86d33b8c4ab61d461f1e61758b91b7 Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Tue, 23 Jan 2024 13:58:10 +0100 Subject: [PATCH 08/31] fix tests --- .../dialects/exasol/AbstractExasolSqlDialectIT.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java b/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java index e3d0582..ba586d1 100644 --- a/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java +++ b/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java @@ -58,7 +58,9 @@ abstract class AbstractExasolSqlDialectIT { private ConnectionDefinition jdbcConnection; private final Set expectVarcharFor = expectVarcharFor(); - AbstractExasolSqlDialectIT() { + @BeforeAll + static void beforeAll() throws BucketAccessException, TimeoutException, NoDriverFoundException, SQLException, + FileNotFoundException { try { connection = EXASOL.createConnection(""); final UdfTestSetup udfTestSetup = new UdfTestSetup(getTestHostIpFromInsideExasol(), @@ -73,13 +75,7 @@ abstract class AbstractExasolSqlDialectIT { } } - @BeforeAll - static void beforeAll() throws BucketAccessException, TimeoutException, NoDriverFoundException, SQLException, - FileNotFoundException { - - } - - private String getTestHostIpFromInsideExasol() { + private static String getTestHostIpFromInsideExasol() { final Map networks = EXASOL.getContainerInfo().getNetworkSettings().getNetworks(); if (networks.size() == 0) { return null; From be93b5f70b8436d9c530d82b0334c221fef9f16d Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Thu, 29 Feb 2024 16:23:52 +0100 Subject: [PATCH 09/31] update dependencies --- dependencies.md | 51 ++++++++++++++++++------------------ doc/changes/changes_8.0.0.md | 5 ++-- pom.xml | 6 ++--- 3 files changed, 32 insertions(+), 30 deletions(-) diff --git a/dependencies.md b/dependencies.md index 70ca089..bf9fd5e 100644 --- a/dependencies.md +++ b/dependencies.md @@ -16,7 +16,7 @@ | [Virtual Schema Common JDBC][0] | [MIT License][1] | | [Hamcrest][6] | [BSD License 3][7] | | [JUnit Jupiter (Aggregator)][8] | [Eclipse Public License v2.0][9] | -| [mockito-junit-jupiter][10] | [MIT][11] | +| [mockito-junit-jupiter][10] | [The MIT License][11] | | [Test containers for Exasol on Docker][12] | [MIT License][13] | | [Testcontainers :: JUnit Jupiter Extension][14] | [MIT][15] | | [Matcher for SQL Result Sets][16] | [MIT License][17] | @@ -42,17 +42,17 @@ | [Project Keeper Maven plugin][41] | [The MIT License][42] | | [Apache Maven Assembly Plugin][43] | [Apache-2.0][31] | | [Apache Maven JAR Plugin][44] | [Apache License, Version 2.0][31] | -| [Artifact reference checker and unifier][45] | [MIT][11] | -| [Apache Maven Deploy Plugin][46] | [Apache-2.0][31] | -| [Apache Maven GPG Plugin][47] | [Apache-2.0][31] | -| [Apache Maven Source Plugin][48] | [Apache License, Version 2.0][31] | -| [Apache Maven Javadoc Plugin][49] | [Apache-2.0][31] | -| [Nexus Staging Maven Plugin][50] | [Eclipse Public License][51] | -| [Apache Maven Dependency Plugin][52] | [Apache-2.0][31] | -| [Maven Failsafe Plugin][53] | [Apache-2.0][31] | -| [JaCoCo :: Maven Plugin][54] | [Eclipse Public License 2.0][27] | -| [error-code-crawler-maven-plugin][55] | [MIT License][56] | -| [Reproducible Build Maven Plugin][57] | [Apache 2.0][36] | +| [Artifact reference checker and unifier][45] | [MIT][46] | +| [Apache Maven Deploy Plugin][47] | [Apache-2.0][31] | +| [Apache Maven GPG Plugin][48] | [Apache-2.0][31] | +| [Apache Maven Source Plugin][49] | [Apache License, Version 2.0][31] | +| [Apache Maven Javadoc Plugin][50] | [Apache-2.0][31] | +| [Nexus Staging Maven Plugin][51] | [Eclipse Public License][52] | +| [Apache Maven Dependency Plugin][53] | [Apache-2.0][31] | +| [Maven Failsafe Plugin][54] | [Apache-2.0][31] | +| [JaCoCo :: Maven Plugin][55] | [Eclipse Public License 2.0][27] | +| [error-code-crawler-maven-plugin][56] | [MIT License][57] | +| [Reproducible Build Maven Plugin][58] | [Apache 2.0][36] | [0]: https://github.com/exasol/virtual-schema-common-jdbc/ [1]: https://github.com/exasol/virtual-schema-common-jdbc/blob/main/LICENSE @@ -65,7 +65,7 @@ [8]: https://junit.org/junit5/ [9]: https://www.eclipse.org/legal/epl-v20.html [10]: https://github.com/mockito/mockito -[11]: https://opensource.org/licenses/MIT +[11]: https://github.com/mockito/mockito/blob/main/LICENSE [12]: https://github.com/exasol/exasol-testcontainers/ [13]: https://github.com/exasol/exasol-testcontainers/blob/main/LICENSE [14]: https://java.testcontainers.org @@ -100,15 +100,16 @@ [43]: https://maven.apache.org/plugins/maven-assembly-plugin/ [44]: https://maven.apache.org/plugins/maven-jar-plugin/ [45]: https://github.com/exasol/artifact-reference-checker-maven-plugin -[46]: https://maven.apache.org/plugins/maven-deploy-plugin/ -[47]: https://maven.apache.org/plugins/maven-gpg-plugin/ -[48]: https://maven.apache.org/plugins/maven-source-plugin/ -[49]: https://maven.apache.org/plugins/maven-javadoc-plugin/ -[50]: http://www.sonatype.com/public-parent/nexus-maven-plugins/nexus-staging/nexus-staging-maven-plugin/ -[51]: http://www.eclipse.org/legal/epl-v10.html -[52]: https://maven.apache.org/plugins/maven-dependency-plugin/ -[53]: https://maven.apache.org/surefire/maven-failsafe-plugin/ -[54]: https://www.jacoco.org/jacoco/trunk/doc/maven.html -[55]: https://github.com/exasol/error-code-crawler-maven-plugin/ -[56]: https://github.com/exasol/error-code-crawler-maven-plugin/blob/main/LICENSE -[57]: http://zlika.github.io/reproducible-build-maven-plugin +[46]: https://opensource.org/licenses/MIT +[47]: https://maven.apache.org/plugins/maven-deploy-plugin/ +[48]: https://maven.apache.org/plugins/maven-gpg-plugin/ +[49]: https://maven.apache.org/plugins/maven-source-plugin/ +[50]: https://maven.apache.org/plugins/maven-javadoc-plugin/ +[51]: http://www.sonatype.com/public-parent/nexus-maven-plugins/nexus-staging/nexus-staging-maven-plugin/ +[52]: http://www.eclipse.org/legal/epl-v10.html +[53]: https://maven.apache.org/plugins/maven-dependency-plugin/ +[54]: https://maven.apache.org/surefire/maven-failsafe-plugin/ +[55]: https://www.jacoco.org/jacoco/trunk/doc/maven.html +[56]: https://github.com/exasol/error-code-crawler-maven-plugin/ +[57]: https://github.com/exasol/error-code-crawler-maven-plugin/blob/main/LICENSE +[58]: http://zlika.github.io/reproducible-build-maven-plugin diff --git a/doc/changes/changes_8.0.0.md b/doc/changes/changes_8.0.0.md index e4e2e09..507e40c 100644 --- a/doc/changes/changes_8.0.0.md +++ b/doc/changes/changes_8.0.0.md @@ -21,9 +21,10 @@ Code name: * Updated `com.exasol:test-db-builder-java:3.5.2` to `3.5.3` * Added `com.exasol:udf-debugging-java:0.6.11` * Updated `com.exasol:virtual-schema-common-jdbc:11.0.2` to `12.0.0` -* Updated `org.mockito:mockito-junit-jupiter:5.7.0` to `5.9.0` +* Updated `org.junit.jupiter:junit-jupiter:5.10.1` to `5.10.0` +* Updated `org.mockito:mockito-junit-jupiter:5.7.0` to `5.5.0` * Updated `org.slf4j:slf4j-jdk14:2.0.9` to `2.0.11` -* Updated `org.testcontainers:junit-jupiter:1.19.2` to `1.19.3` +* Updated `org.testcontainers:junit-jupiter:1.19.2` to `1.19.0` ### Plugin Dependency Updates diff --git a/pom.xml b/pom.xml index b9f2c67..54da495 100644 --- a/pom.xml +++ b/pom.xml @@ -44,13 +44,13 @@ org.junit.jupiter junit-jupiter - 5.10.1 + 5.10.0 test org.mockito mockito-junit-jupiter - 5.9.0 + 5.5.0 test @@ -63,7 +63,7 @@ org.testcontainers junit-jupiter - 1.19.3 + ${org.testcontainers.version} test From 68f20cfe0d35b7464aed3f1c806dfcbb4d04117d Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Thu, 29 Feb 2024 17:02:05 +0100 Subject: [PATCH 10/31] fix deprecated method warnings --- .../adapter/dialects/exasol/AbstractExasolSqlDialectIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java b/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java index 343d9ab..240d96a 100644 --- a/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java +++ b/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java @@ -6,8 +6,8 @@ import static com.exasol.dbbuilder.dialects.exasol.ExasolObjectPrivilege.SELECT; import static com.exasol.matcher.ResultSetStructureMatcher.table; import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.matchesPattern; -import static org.junit.Assert.assertThat; import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assumptions.assumeTrue; From 993239ec21fbf4ee6064cfa450a21ce32170d7f5 Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Thu, 29 Feb 2024 17:02:16 +0100 Subject: [PATCH 11/31] ran pk fix --- .github/workflows/ci-build.yml | 2 +- .github/workflows/dependencies_check.yml | 32 +++- .github/workflows/dependencies_update.yml | 169 ++++++++++++++++++ ...elease_droid_prepare_original_checksum.yml | 2 +- ...release_droid_release_on_maven_central.yml | 2 + doc/changes/changes_8.0.0.md | 18 +- pk_generated_parent.pom | 22 ++- 7 files changed, 225 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/dependencies_update.yml diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 76adff4..73fcdcb 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -38,7 +38,7 @@ jobs: 17 cache: "maven" - name: Cache SonarCloud packages - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.sonar/cache key: ${{ runner.os }}-sonar diff --git a/.github/workflows/dependencies_check.yml b/.github/workflows/dependencies_check.yml index 87b64ba..6926e55 100644 --- a/.github/workflows/dependencies_check.yml +++ b/.github/workflows/dependencies_check.yml @@ -1,6 +1,6 @@ # Generated by Project Keeper # https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/dependencies_check.yml -name: Report Security Issues for Repository +name: Report Security Issues on: workflow_dispatch: schedule: @@ -10,10 +10,13 @@ jobs: report_security_issues: runs-on: ubuntu-latest permissions: + contents: read issues: write - + outputs: + created-issues: ${{ steps.security-issues.outputs.created-issues }} steps: - uses: actions/checkout@v4 + - name: Set up JDKs uses: actions/setup-java@v4 with: @@ -25,14 +28,37 @@ jobs: - name: Generate ossindex report run: | - mvn org.sonatype.ossindex.maven:ossindex-maven-plugin:audit \ + mvn --batch-mode org.sonatype.ossindex.maven:ossindex-maven-plugin:audit \ org.sonatype.ossindex.maven:ossindex-maven-plugin:audit-aggregate \ -Dossindex.reportFile=$(pwd)/ossindex-report.json \ -Dossindex.fail=false - name: Report Security Issues + id: security-issues uses: exasol/python-toolbox/.github/actions/security-issues@main with: format: "maven" command: "cat ossindex-report.json" github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Output security issues (Debugging) + run: | + echo "$CREATED_ISSUES" > test.jsonl + cat test.jsonl + env: + CREATED_ISSUES: ${{ steps.security-issues.outputs.created-issues }} + + start_dependency_udpate: + needs: report_security_issues + if: ${{ needs.report_security_issues.outputs.created-issues }} + concurrency: + cancel-in-progress: true + group: "dependency_update" + # Workflow needs secret INTEGRATION_TEAM_SLACK_NOTIFICATION_WEBHOOK + secrets: inherit + permissions: + contents: write + pull-requests: write + uses: ./.github/workflows/dependencies_update.yml + with: + vulnerability_issues: ${{ needs.report_security_issues.outputs.created-issues }} diff --git a/.github/workflows/dependencies_update.yml b/.github/workflows/dependencies_update.yml new file mode 100644 index 0000000..58222ba --- /dev/null +++ b/.github/workflows/dependencies_update.yml @@ -0,0 +1,169 @@ +# Generated by Project Keeper +# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/dependencies_update.yml +name: Update dependencies +on: + workflow_call: + inputs: + vulnerability_issues: + description: "GitHub issues for vulnerable dependencies as JSONL" + required: true + type: string + workflow_dispatch: + +jobs: + update_dependencies: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up JDKs + uses: actions/setup-java@v4 + with: + distribution: "temurin" + java-version: | + 11 + 17 + cache: "maven" + + - name: Print issues + run: | + echo "Issues from Action input: $ISSUES" + env: + ISSUES: ${{ inputs.vulnerability_issues }} + + - name: Fail if not running on a branch + if: ${{ !startsWith(github.ref, 'refs/heads/') }} + uses: actions/github-script@v7 + with: + script: | + core.setFailed('Not running on a branch, github.ref is ${{ github.ref }}. Please start this workflow only on main or a branch') + + - name: Update dependencies + run: | + mvn --batch-mode com.exasol:project-keeper-maven-plugin:update-dependencies --projects . \ + -Dproject-keeper:vulnerabilities="$CREATED_ISSUES" + env: + CREATED_ISSUES: ${{ inputs.vulnerability_issues }} + + - name: Project Keeper Fix + run: | + mvn --batch-mode com.exasol:project-keeper-maven-plugin:fix --projects . + + - name: Project Keeper Fix for updated Project Keeper version + # Calling PK fix a second time is necessary because the first invocation potentially updated PK itself. + # So we need to run PK fix again with the latest PK version. + # [impl->dsn~dependency-updater.workflow.start-pk-fix~1] + run: | + mvn --batch-mode com.exasol:project-keeper-maven-plugin:fix --projects . + + - name: Generate Pull Request comment + id: pr-comment + # [impl->dsn~dependency-updater.workflow.pull-request-trigger-ci-build~1] + run: | + echo 'comment<> "$GITHUB_OUTPUT" + echo 'This Pull Request was created by [`dependencies_update.yml`](https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/dependencies_update.yml) workflow.' >> "$GITHUB_OUTPUT" + if [ -n "$CREATED_ISSUES" ]; then + echo 'It updates dependencies to fix the following vulnerabilities:' >> "$GITHUB_OUTPUT" + echo $CREATED_ISSUES | jq --raw-output '. | "* Closes " + .issue_url + " (" + .cve + ")"' >> "$GITHUB_OUTPUT" + else + echo 'It updates dependencies.' >> "$GITHUB_OUTPUT" + fi + echo >> "$GITHUB_OUTPUT" + echo '# ⚠️ This PR does not trigger CI workflows by default ⚠️' >> "$GITHUB_OUTPUT" + echo 'Please click the **Close pull request** button and then **Reopen pull request** to trigger running checks.' >> "$GITHUB_OUTPUT" + echo 'See https://github.com/exasol/project-keeper/issues/534 for details.' >> "$GITHUB_OUTPUT" + echo 'EOF' >> "$GITHUB_OUTPUT" + + cat "$GITHUB_OUTPUT" + env: + CREATED_ISSUES: ${{ inputs.vulnerability_issues }} + + - name: Generate Pull Request Title + id: pr-title + run: | + if [ -n "$CREATED_ISSUES" ]; then + echo "Security issues are available" + echo "title=🔐 Update dependencies to fix vulnerabilities" >> "$GITHUB_OUTPUT" + else + echo "Security issues are not available" + echo "title=Update dependencies" >> "$GITHUB_OUTPUT" + fi + + cat "$GITHUB_OUTPUT" + env: + CREATED_ISSUES: ${{ inputs.vulnerability_issues }} + + - name: Configure git + run: | + git config --global user.email "opensource@exasol.com" + git config --global user.name "Automatic Dependency Updater" + + - name: Create branch + if: ${{ github.ref == 'refs/heads/main' }} + run: | + branch_name="dependency-update/$(date "+%Y%m%d%H%M%S")" + echo "Creating branch $branch_name" + git checkout -b "$branch_name" + + - name: Commit changes & push + if: ${{ startsWith(github.ref, 'refs/heads/' ) }} + run: | + branch_name=$(git rev-parse --abbrev-ref HEAD) + echo "Current branch: $branch_name" + echo "git diff --stat" + git diff --stat + echo "git diff --numstat" + git diff --numstat + echo "git diff --name-status" + git diff --name-status + echo "Adding untracked files:" + git add . --verbose --all + echo "Committing changes..." + git commit --message "$TITLE" + echo "Pushing branch $branch_name..." + git push --set-upstream origin "$branch_name" + echo "Done." + env: + TITLE: ${{ steps.pr-title.outputs.title }} + + - name: Create pull request + id: create-pr + if: ${{ github.ref == 'refs/heads/main' }} + run: | + pr_url=$(gh pr create --base main --title "$TITLE" --body "$COMMENT") + echo "Created Pull Request: $pr_url" + echo "pr_url=$pr_url" >> "$GITHUB_OUTPUT" + env: + COMMENT: ${{ steps.pr-comment.outputs.comment }} + TITLE: ${{ steps.pr-title.outputs.title }} + GH_TOKEN: ${{ github.token }} + + - name: Report failure Status to Slack channel + # Also run this step in case of failures + if: ${{ always() }} + uses: ravsamhq/notify-slack-action@v2 + with: + status: ${{ job.status }} + token: ${{ secrets.GITHUB_TOKEN }} + notification_title: "Dependency check in {repo} has {status_message}" + message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>" + notify_when: "failure,cancelled,warnings" + env: + SLACK_WEBHOOK_URL: ${{ secrets.INTEGRATION_TEAM_SLACK_NOTIFICATION_WEBHOOK }} + + - name: Report new Pull Request to Slack channel + if: ${{ steps.create-pr.outputs.pr_url }} + uses: ravsamhq/notify-slack-action@v2 + with: + status: ${{ job.status }} + token: ${{ secrets.GITHUB_TOKEN }} + notification_title: "Dependency update for {repo} created a Pull Request" + message_format: "{workflow} created Pull Request ${{ steps.create-pr.outputs.pr_url }}" + env: + SLACK_WEBHOOK_URL: ${{ secrets.INTEGRATION_TEAM_SLACK_NOTIFICATION_WEBHOOK }} diff --git a/.github/workflows/release_droid_prepare_original_checksum.yml b/.github/workflows/release_droid_prepare_original_checksum.yml index 413274b..2ff28b3 100644 --- a/.github/workflows/release_droid_prepare_original_checksum.yml +++ b/.github/workflows/release_droid_prepare_original_checksum.yml @@ -32,7 +32,7 @@ jobs: - name: Prepare checksum run: find target -maxdepth 1 -name *.jar -exec sha256sum "{}" + > original_checksum - name: Upload checksum to the artifactory - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: original_checksum retention-days: 5 diff --git a/.github/workflows/release_droid_release_on_maven_central.yml b/.github/workflows/release_droid_release_on_maven_central.yml index 51d0659..0a5ee04 100644 --- a/.github/workflows/release_droid_release_on_maven_central.yml +++ b/.github/workflows/release_droid_release_on_maven_central.yml @@ -25,6 +25,8 @@ jobs: server-password: MAVEN_PASSWORD gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }} gpg-passphrase: MAVEN_GPG_PASSPHRASE + - name: List secret GPG keys + run: gpg --list-secret-keys - name: Publish to Central Repository run: mvn --batch-mode -Dgpg.skip=false -DskipTests clean deploy env: diff --git a/doc/changes/changes_8.0.0.md b/doc/changes/changes_8.0.0.md index fcfeb71..eeaaaf8 100644 --- a/doc/changes/changes_8.0.0.md +++ b/doc/changes/changes_8.0.0.md @@ -16,21 +16,15 @@ Code name: ### Test Dependency Updates -* Updated `com.exasol:exasol-testcontainers:6.6.3` to `7.0.1` -* Updated `com.exasol:hamcrest-resultset-matcher:1.6.3` to `1.6.4` -* Updated `com.exasol:test-db-builder-java:3.5.2` to `3.5.3` * Added `com.exasol:udf-debugging-java:0.6.11` * Updated `com.exasol:virtual-schema-common-jdbc:11.0.2` to `12.0.0` -* Updated `org.junit.jupiter:junit-jupiter:5.10.1` to `5.10.2` -* Updated `org.mockito:mockito-junit-jupiter:5.7.0` to `5.10.0` -* Updated `org.slf4j:slf4j-jdk14:2.0.9` to `2.0.12` -* Updated `org.testcontainers:junit-jupiter:1.19.2` to `1.19.6` ### Plugin Dependency Updates -* Updated `com.exasol:project-keeper-maven-plugin:2.9.16` to `4.1.0` -* Updated `org.apache.maven.plugins:maven-failsafe-plugin:3.2.2` to `3.2.3` +* Updated `com.exasol:error-code-crawler-maven-plugin:1.3.1` to `2.0.0` +* Updated `com.exasol:project-keeper-maven-plugin:3.0.1` to `4.1.0` +* Updated `org.apache.maven.plugins:maven-compiler-plugin:3.11.0` to `3.12.1` +* Updated `org.apache.maven.plugins:maven-failsafe-plugin:3.2.3` to `3.2.5` * Updated `org.apache.maven.plugins:maven-javadoc-plugin:3.4.1` to `3.6.3` -* Updated `org.apache.maven.plugins:maven-surefire-plugin:3.2.2` to `3.2.3` -* Added `org.apache.maven.plugins:maven-toolchains-plugin:3.1.0` -* Updated `org.codehaus.mojo:versions-maven-plugin:2.16.1` to `2.16.2` +* Updated `org.apache.maven.plugins:maven-surefire-plugin:3.2.3` to `3.2.5` +* Updated `org.codehaus.mojo:flatten-maven-plugin:1.5.0` to `1.6.0` diff --git a/pk_generated_parent.pom b/pk_generated_parent.pom index 967a3d5..f498de1 100644 --- a/pk_generated_parent.pom +++ b/pk_generated_parent.pom @@ -82,7 +82,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.11.0 + 3.12.1 ${java.version} ${java.version} @@ -120,7 +120,7 @@ org.codehaus.mojo flatten-maven-plugin - 1.5.0 + 1.6.0 true oss @@ -159,7 +159,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.2.3 + 3.2.5 @@ -183,6 +183,17 @@ file:///${project.basedir}/versionsMavenPluginRules.xml + false + true + true + true + false + true + true + true + false + true + true @@ -323,6 +334,7 @@ true true true + ${java.version} @@ -369,7 +381,7 @@ org.apache.maven.plugins maven-failsafe-plugin - 3.2.3 + 3.2.5 -Djava.util.logging.config.file=src/test/resources/logging.properties ${argLine} @@ -438,7 +450,7 @@ com.exasol error-code-crawler-maven-plugin - 1.3.1 + 2.0.0 verify From ee49c833977ad17449bed4a274c9fd6c982432bd Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Tue, 5 Mar 2024 16:16:25 +0100 Subject: [PATCH 12/31] fix return type for timestamp with local date time according to strict data type checking --- .../adapter/dialects/exasol/ExasolSqlGenerationVisitor.java | 3 ++- .../dialects/exasol/ExasolSqlGenerationVisitorTest.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/exasol/adapter/dialects/exasol/ExasolSqlGenerationVisitor.java b/src/main/java/com/exasol/adapter/dialects/exasol/ExasolSqlGenerationVisitor.java index 7722dd6..8bcfc39 100644 --- a/src/main/java/com/exasol/adapter/dialects/exasol/ExasolSqlGenerationVisitor.java +++ b/src/main/java/com/exasol/adapter/dialects/exasol/ExasolSqlGenerationVisitor.java @@ -32,7 +32,8 @@ public String visit(final SqlLiteralTimestampUtc literal) { final ExasolSqlDialect exasolSqlDialect = (ExasolSqlDialect) getDialect(); if (exasolSqlDialect.isTimestampWithLocalTimeZoneEnabled()) { LOGGER.info("IGNORE_ERRORS = '" + EXASOL_TIMESTAMP_WITH_LOCAL_TIME_ZONE_SWITCH + "' property is enabled."); - return super.visit(literal); + + return "LOCALTIMESTAMP " + getDialect().getStringLiteral(literal.getValue()); } else { throw new UnsupportedOperationException(ExaError.messageBuilder("E-VSEXA-5") // .message("Attention! Using literals and constant expressions with datatype " diff --git a/src/test/java/com/exasol/adapter/dialects/exasol/ExasolSqlGenerationVisitorTest.java b/src/test/java/com/exasol/adapter/dialects/exasol/ExasolSqlGenerationVisitorTest.java index 583f56d..84b41f8 100644 --- a/src/test/java/com/exasol/adapter/dialects/exasol/ExasolSqlGenerationVisitorTest.java +++ b/src/test/java/com/exasol/adapter/dialects/exasol/ExasolSqlGenerationVisitorTest.java @@ -39,7 +39,7 @@ void testVisitSqlLiteralTimestampUtc() { this.exasolSqlDialect, null); final SqlLiteralTimestampUtc sqlLiteralTimestampUtc = new SqlLiteralTimestampUtc(value); assertThat(exasolSqlGenerationVisitor.visit(sqlLiteralTimestampUtc), - equalTo("TIMESTAMP '2015-12-01 12:01:01.1234'")); + equalTo("LOCALTIMESTAMP '2015-12-01 12:01:01.1234'")); } @Test From 45ed9302be47858b1af96ffd647b716ceaaf8fca Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Thu, 7 Mar 2024 15:36:00 +0100 Subject: [PATCH 13/31] split and fix failing integration tests for exa connection mode, related to strict datatype checks in the compiler --- .../exasol/AbstractExasolSqlDialectIT.java | 4 +- .../ExasolSqlDialectExaConnectionIT.java | 530 ++++++++++++++++++ 2 files changed, 532 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java b/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java index 240d96a..96d0bcb 100644 --- a/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java +++ b/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java @@ -204,7 +204,7 @@ private ResultSet selectAllFrom(final String tableName) throws SQLException { return query("SELECT * FROM " + tableName); } - private String getVirtualTableName(final VirtualSchema virtualSchema, final Table table) { + protected String getVirtualTableName(final VirtualSchema virtualSchema, final Table table) { return virtualSchema.getFullyQualifiedName() + ".\"" + table.getName() + "\""; } @@ -375,7 +375,7 @@ void testIdentifierCaseSensitivityOnTable() { } } - private void assertVsQuery(final String sql, final Matcher expected) { + protected void assertVsQuery(final String sql, final Matcher expected) { try { assertThat(query(sql), expected); } catch (final SQLException exception) { diff --git a/src/test/java/com/exasol/adapter/dialects/exasol/ExasolSqlDialectExaConnectionIT.java b/src/test/java/com/exasol/adapter/dialects/exasol/ExasolSqlDialectExaConnectionIT.java index 25ba89b..a9d665d 100644 --- a/src/test/java/com/exasol/adapter/dialects/exasol/ExasolSqlDialectExaConnectionIT.java +++ b/src/test/java/com/exasol/adapter/dialects/exasol/ExasolSqlDialectExaConnectionIT.java @@ -12,6 +12,8 @@ import java.util.Set; import org.junit.jupiter.api.*; +import org.opentest4j.AssertionFailedError; +import org.opentest4j.MultipleFailuresError; import org.testcontainers.containers.JdbcDatabaseContainer.NoDriverFoundException; import com.exasol.adapter.properties.PropertyValidationException; @@ -34,6 +36,7 @@ *
  • {@code GEOMETRY} types are reported with JDBC type name {@code VARCHAR} in ResultSets
  • *
      */ + class ExasolSqlDialectExaConnectionIT extends AbstractRemoteExasolVirtualSchemaConnectionIT { private static final String EXA_CONNECTION_NAME = "EXA_CONNECTION"; private ConnectionDefinition exaConnection; @@ -69,8 +72,19 @@ protected Map getConnectionSpecificVirtualSchemaProperties() { return Map.of("IMPORT_FROM_EXA", "true", EXASOL_CONNECTION_PROPERTY, this.exaConnection.getName()); } + // These tests were overridden and split up according to DB versions for the following reasons: + // Strict datatype checking that's enabled for Exasol V8 makes a number of these tests fail. + // + // The old tests that work for DB versions prior to strict datatype checking + // thus can only be run for earlier Exasol DB versions and have to be disabled for V8. + // + // The tests using the newer GENERATE_JDBC_DATATYPE_MAPPING_FOR_EXA switch that fixes most of the issues with strict + // datatype checking on the pushed down queries + // can be found in ExasolSqlDialectExaConnectionWithDataTypesIT . + @Test void testPasswordNotVisibleInImportFromExa() throws NoDriverFoundException, SQLException { + assumeExasol7OrLower(); final Table table = this.sourceSchema.createTable("T1", "C1", "VARCHAR(20)").insert("Hello."); this.virtualSchema = createVirtualSchema(this.sourceSchema); final String sql = "SELECT * FROM " + this.virtualSchema.getFullyQualifiedName() + ".\"" + table.getName() @@ -106,6 +120,7 @@ private ResultSet explainVirtual(final String sql) throws SQLException { @Override @Test void testCharMappingAscii() { + assumeExasol7OrLower(); final Table table = createSingleColumnTable("CHAR(20) ASCII").insert("sun").insert("rain"); assertVirtualTableContents(table, table("VARCHAR").row(pad("sun", 20)).row(pad("rain", 20)).matches()); } @@ -113,12 +128,14 @@ void testCharMappingAscii() { @Override @Test void testCharMappingUtf8() { + assumeExasol7OrLower(); verifyCharMappingUtf8("VARCHAR"); } @Override @Test void testCastVarcharToChar() { + assumeExasol7OrLower(); castFrom("VARCHAR(20)").to("CHAR(40)").input("Hello.").accept("VARCHAR").verify(pad("Hello.", 40)); } @@ -133,4 +150,517 @@ void joinHashtypeTables() { containsString( "Adapter generated invalid pushdown query for virtual table VIRTUAL: Data type mismatch in column number 1 (1-indexed).Expected HASHTYPE(16 BYTE), but got VARCHAR(32) UTF8."))); } + + @Test + @Override + void testNonDefaultGeometry() { + assumeExasol7OrLower(); + typeAssertionFor("GEOMETRY(4321)").withValue("POINT (2 5)") // + .expectTypeOf("GEOMETRY(4321)") // + .expectDescribeType("GEOMETRY(4321)") // + .expectResultSetType(expectDataType("GEOMETRY")) // + .runAssert(); + + } + + @Override + @Test + void testHashTypeWithBitSize() { + assumeExasol7OrLower(); + typeAssertionFor("HASHTYPE(16 BIT)").withValue("550e") // + .expectDescribeType("HASHTYPE(2 BYTE)") // + .expectTypeOf("HASHTYPE(2 BYTE)") // + .expectResultSetType(expectDataType("HASHTYPE")) // + .runAssert(); + } + + @Override + @Test + void testDefaultIntervalYearToMonth() { + assumeExasol7OrLower(); + typeAssertionFor("INTERVAL YEAR TO MONTH").withValue("5-3") // + .expectTypeOf("INTERVAL YEAR(2) TO MONTH") // + .expectDescribeType("INTERVAL YEAR(2) TO MONTH") // + .expectResultSetType(expectDataType("INTERVAL YEAR TO MONTH")) // + .expectValue("+05-03") // + .runAssert(); + } + + @Override + @Test + void testDefaultGeometry() { + assumeExasol7OrLower(); + typeAssertionFor("GEOMETRY").withValue("POINT (2 5)") // + .expectTypeOf("GEOMETRY") // + .expectDescribeType("GEOMETRY") // + .expectResultSetType(expectDataType("GEOMETRY")) // + .runAssert(); + } + + @Override + @Test + void testDefaultIntervalDayToSecond() { + assumeExasol7OrLower(); + typeAssertionFor("INTERVAL DAY TO SECOND").withValue("2 12:50:10.123") // + // day: 2 digits, seconds: 3 digits after decimal point + .expectTypeOf("INTERVAL DAY(2) TO SECOND(3)") // + .expectDescribeType("INTERVAL DAY(2) TO SECOND(3)") // + .expectResultSetType(expectDataType("INTERVAL DAY TO SECOND")) // + .expectValue("+02 12:50:10.123") // + .runAssert(); + } + + @Override + @Test + void testGeometryMapping() { + assumeExasol7OrLower(); + // Note that the JDBC driver reports the result as VARCHAR for Exasol database with major version < 8 + final Table table = createSingleColumnTable("GEOMETRY").insert("POINT (2 3)"); + assertVirtualTableContents(table, table(expectDataType("GEOMETRY")).row("POINT (2 3)").matches()); + } + + @Override + @Test + void testNonDefaultIntervalYearToMonth() { + assumeExasol7OrLower(); + typeAssertionFor("INTERVAL YEAR(4) TO MONTH") // 4 digits for year + .withValue("5-3") // sample interval of 5 years and 3 months + .expectTypeOf("INTERVAL YEAR(4) TO MONTH") // + .expectDescribeType("INTERVAL YEAR(4) TO MONTH") // + .expectResultSetType(expectDataType("INTERVAL YEAR TO MONTH")) // + .expectValue("+0005-03") // 4 digits for year + .runAssert(); + } + + @Override + @Test + void testNonDefaultIntervalDayToSecond() { + assumeExasol7OrLower(); + // day: 4 digits, seconds: 6 digits after decimal point + typeAssertionFor("INTERVAL DAY(4) TO SECOND(6)").withValue("2 12:50:10.123") // + .expectTypeOf("INTERVAL DAY(4) TO SECOND(6)") // + .expectDescribeType("INTERVAL DAY(4) TO SECOND(6)") // + .expectResultSetType(expectDataType("INTERVAL DAY TO SECOND")) // + .expectValue("+0002 12:50:10.123000") // + .runAssert(); + } + + @Override + @Test + void testNonDefaultHashType() { + assumeExasol7OrLower(); + typeAssertionFor("HASHTYPE(4 BYTE)").withValue("550e8400") // + .expectDescribeType("HASHTYPE(4 BYTE)") // + .expectTypeOf("HASHTYPE(4 BYTE)") // + .expectResultSetType(expectDataType("HASHTYPE")) // + .runAssert(); + } + + @Override + @Test + void testCastVarcharAsGeometry() { + assumeExasol7OrLower(); + castFrom("VARCHAR(20)").to("GEOMETRY(5)").input("POINT(2 5)").accept(expectDataType("GEOMETRY")) + .verify("POINT (2 5)"); + } + + @Override + @Test + void testDefaultHashType() { + assumeExasol7OrLower(); + typeAssertionFor("HASHTYPE").withValue("550e8400-e29b-11d4-a716-446655440000") + .expectDescribeType("HASHTYPE(16 BYTE)") // + .expectTypeOf("HASHTYPE(16 BYTE)") // + .expectResultSetType(expectDataType("HASHTYPE")) // + .expectValue("550e8400e29b11d4a716446655440000") // + .runAssert(); + } + + @Override + @Test + void testIntervalYearToMonthMapping() { + assumeExasol7OrLower(); + final Table table = createSingleColumnTable("INTERVAL YEAR (9) TO MONTH")// + .insert("-999999999-11") // + .insert("-1-1") // + .insert("0-0") // + .insert("1-1") // + .insert("999999999-11"); + // why is precision 9 missing in expected data type? + assertVirtualTableContents(table, table(expectDataType("INTERVAL YEAR TO MONTH")) // + .row("-999999999-11") // + .row("-000000001-01") // + .row("+000000000-00") // + .row("+000000001-01") // + .row("+999999999-11") // + .matches()); + } + + @Override + @Test + void testIntervalDayToSecondMapping() { + assumeExasol7OrLower(); + final Table table = createSingleColumnTable("INTERVAL DAY (9) TO SECOND") // + .insert("-999999999 23:59:59.999") // + .insert("-1 12:34:56.789") // + .insert("0 00:00:00.000") // + .insert("1 12:34:56.789") // + .insert("999999999 23:59:59.999"); + // why is precision 9 missing in expected data type? + assertVirtualTableContents(table, table(expectDataType("INTERVAL DAY TO SECOND")) // + .row("-999999999 23:59:59.999") // + .row("-000000001 12:34:56.789") // + .row("+000000000 00:00:00.000") // + .row("+000000001 12:34:56.789") // + .row("+999999999 23:59:59.999") // + .matches()); + } + + @Override + @Test + void testCastVarcharAsIntervalDayToSecond() { + assumeExasol7OrLower(); + // why is precision 5 and 2 missing in expected data type? + castFrom("VARCHAR(30)").to("INTERVAL DAY (5) TO SECOND (2)").input("+00003 12:50:10.12") + .accept(expectDataType("INTERVAL DAY TO SECOND")).verify("+00003 12:50:10.12"); + } + + @Override + @Test + void testCastVarcharAsIntervalYearToMonth() { + assumeExasol7OrLower(); + // why is precision 5 missing in expectedDataType? + castFrom("VARCHAR(30)").to("INTERVAL YEAR (5) TO MONTH").input("+00004-06") + .accept(expectDataType("INTERVAL YEAR TO MONTH")).verify("+00004-06"); + } + + @Override + @Test + void testCaseEqual() { + assumeExasol7OrLower(); + final Table table = createSingleColumnTable("INTEGER").insert(1).insert(2).insert(3); + this.virtualSchema = createVirtualSchema(this.sourceSchema); + assertVsQuery("SELECT CASE C1 WHEN 1 THEN 'YES' WHEN 2 THEN 'PERHAPS' ELSE 'NO' END FROM " // + + getVirtualTableName(this.virtualSchema, table), // + table().row("YES").row("PERHAPS").row("NO").matches()); + } + + @Override + @Test + void testCaseGreaterThan() { + assumeExasol7OrLower(); + final Table table = createSingleColumnTable("INTEGER").insert(1).insert(2).insert(3); + this.virtualSchema = createVirtualSchema(this.sourceSchema); + assertVsQuery("SELECT CASE WHEN C1 > 1 THEN 'YES' ELSE 'NO' END FROM " // + + getVirtualTableName(this.virtualSchema, table), // + table().row("NO").row("YES").row("YES").matches()); + } + + // V8 tests start here + private void checkExceptionMessageForStrictDatatypeCheckFailures(final String message) { + assertThat(message, anyOf(// + containsString("Adapter generated invalid pushdown query for virtual table"), // + containsString("Data type mismatch in column"), // + containsString("Unable to run assertion query"), // + containsString("Unable to execute assertion query"))); + } + + private void assertThatStrictDatatypeCheckInCompilerFails(final Throwable exception) { + final String message = exception.getMessage(); + checkExceptionMessageForStrictDatatypeCheckFailures(message); + } + + @Test + void testNonDefaultGeometryV8() { + assumeExasol8OrHigher(); + final MultipleFailuresError exception = assertThrows(MultipleFailuresError.class, () -> { + typeAssertionFor("GEOMETRY(4321)").withValue("POINT (2 5)") // + .expectTypeOf("GEOMETRY(4321)") // + .expectDescribeType("GEOMETRY(4321)") // + .expectResultSetType(expectDataType("GEOMETRY")) // + .runAssert(); + }); + assertThatStrictDatatypeCheckInCompilerFails(exception); + } + + @Test + void testPasswordNotVisibleInImportFromExaV8() throws NoDriverFoundException, SQLException { + assumeExasol8OrHigher(); + final SQLException exception = assertThrows(SQLException.class, () -> { + final Table table = this.sourceSchema.createTable("T1", "C1", "VARCHAR(20)").insert("Hello."); + this.virtualSchema = createVirtualSchema(this.sourceSchema); + final String sql = "SELECT * FROM " + this.virtualSchema.getFullyQualifiedName() + ".\"" + table.getName() + + "\""; + assertThat(explainVirtual(sql), // + table().row( // + anything(), // + not(anyOf( // + containsString(this.user.getName()), // + containsString(this.user.getPassword()), // + containsString(EXASOL.getUsername()), // + containsString(EXASOL.getPassword()) // + )), // + anything(), // + anything() // + ).matches()); + }); + assertThatStrictDatatypeCheckInCompilerFails(exception); + } + + @Test + void testCharMappingAsciiV8() { + assumeExasol8OrHigher(); + final AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { + final Table table = createSingleColumnTable("CHAR(20) ASCII").insert("sun").insert("rain"); + assertVirtualTableContents(table, table("VARCHAR").row(pad("sun", 20)).row(pad("rain", 20)).matches()); + }); + assertThatStrictDatatypeCheckInCompilerFails(exception); + + } + + @Test + void testCharMappingUtf8V8() { + assumeExasol8OrHigher(); + final AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { + verifyCharMappingUtf8("VARCHAR"); + }); + assertThatStrictDatatypeCheckInCompilerFails(exception); + } + + @Test + void testCastVarcharToCharV8() { + assumeExasol8OrHigher(); + final AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { + castFrom("VARCHAR(20)").to("CHAR(40)").input("Hello.").accept("VARCHAR").verify(pad("Hello.", 40)); + }); + assertThatStrictDatatypeCheckInCompilerFails(exception); + } + + @Test + void testHashTypeWithBitSizeV8() { + assumeExasol8OrHigher(); + final MultipleFailuresError exception = assertThrows(MultipleFailuresError.class, () -> { + typeAssertionFor("HASHTYPE(16 BIT)").withValue("550e") // + .expectDescribeType("HASHTYPE(2 BYTE)") // + .expectTypeOf("HASHTYPE(2 BYTE)") // + .expectResultSetType(expectDataType("HASHTYPE")) // + .runAssert(); + }); + assertThatStrictDatatypeCheckInCompilerFails(exception); + } + + @Test + void testDefaultIntervalYearToMonthV8() { + assumeExasol8OrHigher(); + final MultipleFailuresError exception = assertThrows(MultipleFailuresError.class, () -> { + typeAssertionFor("INTERVAL YEAR TO MONTH").withValue("5-3") // + .expectTypeOf("INTERVAL YEAR(2) TO MONTH") // + .expectDescribeType("INTERVAL YEAR(2) TO MONTH") // + .expectResultSetType(expectDataType("INTERVAL YEAR TO MONTH")) // + .expectValue("+05-03") // + .runAssert(); + }); + assertThatStrictDatatypeCheckInCompilerFails(exception); + } + + @Test + void testDefaultGeometryV8() { + assumeExasol8OrHigher(); + final MultipleFailuresError exception = assertThrows(MultipleFailuresError.class, () -> { + typeAssertionFor("GEOMETRY").withValue("POINT (2 5)") // + .expectTypeOf("GEOMETRY") // + .expectDescribeType("GEOMETRY") // + .expectResultSetType(expectDataType("GEOMETRY")) // + .runAssert(); + }); + assertThatStrictDatatypeCheckInCompilerFails(exception); + } + + @Test + void testDefaultIntervalDayToSecondV8() { + assumeExasol8OrHigher(); + final MultipleFailuresError exception = assertThrows(MultipleFailuresError.class, () -> { + typeAssertionFor("INTERVAL DAY TO SECOND").withValue("2 12:50:10.123") // + // day: 2 digits, seconds: 3 digits after decimal point + .expectTypeOf("INTERVAL DAY(2) TO SECOND(3)") // + .expectDescribeType("INTERVAL DAY(2) TO SECOND(3)") // + .expectResultSetType(expectDataType("INTERVAL DAY TO SECOND")) // + .expectValue("+02 12:50:10.123") // + .runAssert(); + }); + assertThatStrictDatatypeCheckInCompilerFails(exception); + } + + @Test + void testGeometryMappingV8() { + assumeExasol8OrHigher(); + final AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { + // Note that the JDBC driver reports the result as VARCHAR for Exasol database with major version < 8 + final Table table = createSingleColumnTable("GEOMETRY").insert("POINT (2 3)"); + assertVirtualTableContents(table, table(expectDataType("GEOMETRY")).row("POINT (2 3)").matches()); + }); + assertThatStrictDatatypeCheckInCompilerFails(exception); + } + + @Test + void testNonDefaultIntervalYearToMonthV8() { + assumeExasol8OrHigher(); + final MultipleFailuresError exception = assertThrows(MultipleFailuresError.class, () -> { + typeAssertionFor("INTERVAL YEAR(4) TO MONTH") // 4 digits for year + .withValue("5-3") // sample interval of 5 years and 3 months + .expectTypeOf("INTERVAL YEAR(4) TO MONTH") // + .expectDescribeType("INTERVAL YEAR(4) TO MONTH") // + .expectResultSetType(expectDataType("INTERVAL YEAR TO MONTH")) // + .expectValue("+0005-03") // 4 digits for year + .runAssert(); + }); + assertThatStrictDatatypeCheckInCompilerFails(exception); + } + + @Test + void testNonDefaultIntervalDayToSecondV8() { + assumeExasol8OrHigher(); + final MultipleFailuresError exception = assertThrows(MultipleFailuresError.class, () -> { + // day: 4 digits, seconds: 6 digits after decimal point + typeAssertionFor("INTERVAL DAY(4) TO SECOND(6)").withValue("2 12:50:10.123") // + .expectTypeOf("INTERVAL DAY(4) TO SECOND(6)") // + .expectDescribeType("INTERVAL DAY(4) TO SECOND(6)") // + .expectResultSetType(expectDataType("INTERVAL DAY TO SECOND")) // + .expectValue("+0002 12:50:10.123000") // + .runAssert(); + }); + assertThatStrictDatatypeCheckInCompilerFails(exception); + } + + @Test + void testNonDefaultHashTypeV8() { + assumeExasol8OrHigher(); + final MultipleFailuresError exception = assertThrows(MultipleFailuresError.class, () -> { + typeAssertionFor("HASHTYPE(4 BYTE)").withValue("550e8400") // + .expectDescribeType("HASHTYPE(4 BYTE)") // + .expectTypeOf("HASHTYPE(4 BYTE)") // + .expectResultSetType(expectDataType("HASHTYPE")) // + .runAssert(); + }); + assertThatStrictDatatypeCheckInCompilerFails(exception); + } + + @Test + void testCastVarcharAsGeometryV8() { + assumeExasol8OrHigher(); + final AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { + castFrom("VARCHAR(20)").to("GEOMETRY(5)").input("POINT(2 5)").accept(expectDataType("GEOMETRY")) + .verify("POINT (2 5)"); + }); + assertThatStrictDatatypeCheckInCompilerFails(exception); + } + + @Test + void testDefaultHashTypeV8() { + assumeExasol8OrHigher(); + final MultipleFailuresError exception = assertThrows(MultipleFailuresError.class, () -> { + typeAssertionFor("HASHTYPE").withValue("550e8400-e29b-11d4-a716-446655440000") + .expectDescribeType("HASHTYPE(16 BYTE)") // + .expectTypeOf("HASHTYPE(16 BYTE)") // + .expectResultSetType(expectDataType("HASHTYPE")) // + .expectValue("550e8400e29b11d4a716446655440000") // + .runAssert(); + }); + assertThatStrictDatatypeCheckInCompilerFails(exception); + } + + @Test + void testIntervalYearToMonthMappingV8() { + assumeExasol8OrHigher(); + final AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { + final Table table = createSingleColumnTable("INTERVAL YEAR (9) TO MONTH")// + .insert("-999999999-11") // + .insert("-1-1") // + .insert("0-0") // + .insert("1-1") // + .insert("999999999-11"); + // why is precision 9 missing in expected data type? + assertVirtualTableContents(table, table(expectDataType("INTERVAL YEAR TO MONTH")) // + .row("-999999999-11") // + .row("-000000001-01") // + .row("+000000000-00") // + .row("+000000001-01") // + .row("+999999999-11") // + .matches()); + }); + assertThatStrictDatatypeCheckInCompilerFails(exception); + } + + @Test + void testIntervalDayToSecondMappingV8() { + assumeExasol8OrHigher(); + final AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { + final Table table = createSingleColumnTable("INTERVAL DAY (9) TO SECOND") // + .insert("-999999999 23:59:59.999") // + .insert("-1 12:34:56.789") // + .insert("0 00:00:00.000") // + .insert("1 12:34:56.789") // + .insert("999999999 23:59:59.999"); + // why is precision 9 missing in expected data type? + assertVirtualTableContents(table, table(expectDataType("INTERVAL DAY TO SECOND")) // + .row("-999999999 23:59:59.999") // + .row("-000000001 12:34:56.789") // + .row("+000000000 00:00:00.000") // + .row("+000000001 12:34:56.789") // + .row("+999999999 23:59:59.999") // + .matches()); + }); + assertThatStrictDatatypeCheckInCompilerFails(exception); + } + + @Test + void testCastVarcharAsIntervalDayToSecondV8() { + assumeExasol8OrHigher(); + final AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { + // why is precision 5 and 2 missing in expected data type? + castFrom("VARCHAR(30)").to("INTERVAL DAY (5) TO SECOND (2)").input("+00003 12:50:10.12") + .accept(expectDataType("INTERVAL DAY TO SECOND")).verify("+00003 12:50:10.12"); + }); + assertThatStrictDatatypeCheckInCompilerFails(exception); + } + + @Test + void testCastVarcharAsIntervalYearToMonthV8() { + assumeExasol8OrHigher(); + final AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { + // why is precision 5 missing in expectedDataType? + castFrom("VARCHAR(30)").to("INTERVAL YEAR (5) TO MONTH").input("+00004-06") + .accept(expectDataType("INTERVAL YEAR TO MONTH")).verify("+00004-06"); + }); + assertThatStrictDatatypeCheckInCompilerFails(exception); + } + + @Test + void testCaseEqualV8() { + assumeExasol8OrHigher(); + final AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { + final Table table = createSingleColumnTable("INTEGER").insert(1).insert(2).insert(3); + this.virtualSchema = createVirtualSchema(this.sourceSchema); + assertVsQuery("SELECT CASE C1 WHEN 1 THEN 'YES' WHEN 2 THEN 'PERHAPS' ELSE 'NO' END FROM " // + + getVirtualTableName(this.virtualSchema, table), // + table().row("YES").row("PERHAPS").row("NO").matches()); + }); + assertThatStrictDatatypeCheckInCompilerFails(exception); + } + + @Test + void testCaseGreaterThanV8() { + assumeExasol8OrHigher(); + final AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { + final Table table = createSingleColumnTable("INTEGER").insert(1).insert(2).insert(3); + this.virtualSchema = createVirtualSchema(this.sourceSchema); + assertVsQuery("SELECT CASE WHEN C1 > 1 THEN 'YES' ELSE 'NO' END FROM " // + + getVirtualTableName(this.virtualSchema, table), // + table().row("NO").row("YES").row("YES").matches()); + }); + assertThatStrictDatatypeCheckInCompilerFails(exception); + } + } + +// From 82f4a0803057320992139de75ef5b2407f5ac37c Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Thu, 21 Mar 2024 10:09:56 +0100 Subject: [PATCH 14/31] Add update to PK 4.2.0 exclusion --- .project-keeper.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.project-keeper.yml b/.project-keeper.yml index 478bded..5f1f89f 100644 --- a/.project-keeper.yml +++ b/.project-keeper.yml @@ -6,6 +6,8 @@ sources: - integration_tests - udf_coverage - maven_central +excludes: + - "W-PK-CORE-153: Project-keeper version 4.1.0 is outdated. Please update project-keeper to latest version 4.2.0." build: runnerOs: ubuntu-20.04 freeDiskSpace: false From 694e2420f8fe3d63cec3fda2e30947f63dc668b1 Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Fri, 22 Mar 2024 10:36:48 +0100 Subject: [PATCH 15/31] Use cast instead of localtimestamp for correct result --- .../adapter/dialects/exasol/ExasolSqlGenerationVisitor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/exasol/adapter/dialects/exasol/ExasolSqlGenerationVisitor.java b/src/main/java/com/exasol/adapter/dialects/exasol/ExasolSqlGenerationVisitor.java index 8bcfc39..4edfdab 100644 --- a/src/main/java/com/exasol/adapter/dialects/exasol/ExasolSqlGenerationVisitor.java +++ b/src/main/java/com/exasol/adapter/dialects/exasol/ExasolSqlGenerationVisitor.java @@ -33,7 +33,7 @@ public String visit(final SqlLiteralTimestampUtc literal) { if (exasolSqlDialect.isTimestampWithLocalTimeZoneEnabled()) { LOGGER.info("IGNORE_ERRORS = '" + EXASOL_TIMESTAMP_WITH_LOCAL_TIME_ZONE_SWITCH + "' property is enabled."); - return "LOCALTIMESTAMP " + getDialect().getStringLiteral(literal.getValue()); + return "cast(TIMESTAMP " + getDialect().getStringLiteral(literal.getValue()) + " as timestamp with local time zone)"; } else { throw new UnsupportedOperationException(ExaError.messageBuilder("E-VSEXA-5") // .message("Attention! Using literals and constant expressions with datatype " From aa62e3c91ec819a049efb386301f3297eab9bf84 Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Fri, 22 Mar 2024 10:56:59 +0100 Subject: [PATCH 16/31] fix testVisitSqlLiteralTimestampUtc test --- .../adapter/dialects/exasol/ExasolSqlGenerationVisitorTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/exasol/adapter/dialects/exasol/ExasolSqlGenerationVisitorTest.java b/src/test/java/com/exasol/adapter/dialects/exasol/ExasolSqlGenerationVisitorTest.java index 84b41f8..4195578 100644 --- a/src/test/java/com/exasol/adapter/dialects/exasol/ExasolSqlGenerationVisitorTest.java +++ b/src/test/java/com/exasol/adapter/dialects/exasol/ExasolSqlGenerationVisitorTest.java @@ -39,7 +39,7 @@ void testVisitSqlLiteralTimestampUtc() { this.exasolSqlDialect, null); final SqlLiteralTimestampUtc sqlLiteralTimestampUtc = new SqlLiteralTimestampUtc(value); assertThat(exasolSqlGenerationVisitor.visit(sqlLiteralTimestampUtc), - equalTo("LOCALTIMESTAMP '2015-12-01 12:01:01.1234'")); + equalTo("cast(TIMESTAMP '2015-12-01 12:01:01.1234' as timestamp with local time zone)")); } @Test From cd744f7c11fe30e3568a346c553a80ec75b99e11 Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Thu, 28 Mar 2024 12:26:26 +0100 Subject: [PATCH 17/31] Add special cases for Exasol VS Local modus: explicit cast to utf8 in the case of char and varchar datatypes --- .../exasol/ExasolLocalQueryRewriter.java | 2 +- .../ExasolLocalSqlGenerationVisitor.java | 40 +++++++++++++++++++ .../dialects/exasol/ExasolSqlDialect.java | 7 +++- 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitor.java diff --git a/src/main/java/com/exasol/adapter/dialects/exasol/ExasolLocalQueryRewriter.java b/src/main/java/com/exasol/adapter/dialects/exasol/ExasolLocalQueryRewriter.java index 08cf169..85a55ef 100644 --- a/src/main/java/com/exasol/adapter/dialects/exasol/ExasolLocalQueryRewriter.java +++ b/src/main/java/com/exasol/adapter/dialects/exasol/ExasolLocalQueryRewriter.java @@ -37,7 +37,7 @@ class ExasolLocalQueryRewriter implements QueryRewriter { public String rewrite(final SqlStatement statement, final List selectListDataTypes, final ExaMetadata exaMetadata, final AdapterProperties properties) throws AdapterException { final SqlGenerationContext context = new SqlGenerationContext(properties.getCatalogName(), - properties.getSchemaName(), false); + properties.getSchemaName(), true); final SqlGenerator sqlGeneratorVisitor = this.dialect.getSqlGenerator(context); final String selectStatement = sqlGeneratorVisitor.generateSqlFor(statement); LOGGER.finer(() -> "SELECT push-down statement:\n" + selectStatement); diff --git a/src/main/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitor.java b/src/main/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitor.java new file mode 100644 index 0000000..d5cc448 --- /dev/null +++ b/src/main/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitor.java @@ -0,0 +1,40 @@ +package com.exasol.adapter.dialects.exasol; + +import com.exasol.adapter.AdapterException; +import com.exasol.adapter.dialects.SqlDialect; +import com.exasol.adapter.dialects.rewriting.SqlGenerationContext; +import com.exasol.adapter.metadata.DataType; +import com.exasol.adapter.sql.SqlColumn; + +public class ExasolLocalSqlGenerationVisitor extends ExasolSqlGenerationVisitor{ + /** + * Creates a new instance of the {@link ExasolSqlGenerationVisitor}. + * + * @param dialect {@link ExasolSqlDialect} dialect + * @param context SQL generation context + */ + ExasolLocalSqlGenerationVisitor(SqlDialect dialect, SqlGenerationContext context) { + super(dialect, context); + } + @Override + public String visit(final SqlColumn column) throws AdapterException { + ExasolSqlDialect exasolSqlDialect = new ExasolSqlDialect(null,null); + String tablePrefix = ""; + if (column.hasTableAlias()) { + tablePrefix = exasolSqlDialect.applyQuote(column.getTableAlias()) + + exasolSqlDialect.getTableCatalogAndSchemaSeparator(); + } else if ((column.getTableName() != null) && !column.getTableName().isEmpty()) { + tablePrefix = exasolSqlDialect.applyQuote(column.getTableName()) + + exasolSqlDialect.getTableCatalogAndSchemaSeparator(); + } + //PROVIDE A CAST TO CORRESPONDING DATATYPE WITH THE SAME LENGTH BUT WITH UTF8 AS CHARSET + if (column.getMetadata().getType().getExaDataType() == DataType.ExaDataType.CHAR || // + column.getMetadata().getType().getExaDataType() == DataType.ExaDataType.VARCHAR) { + int size = column.getMetadata().getType().getSize(); + String dataTypeStr = column.getMetadata().getType().getExaDataType() == DataType.ExaDataType.CHAR ? "CHAR":"VARCHAR"; + return "CAST(" + tablePrefix + exasolSqlDialect.applyQuote(column.getName())+" AS "+ dataTypeStr+"("+size+") UTF8)"; + } else { + return tablePrefix + exasolSqlDialect.applyQuote(column.getName()); + } + } +} diff --git a/src/main/java/com/exasol/adapter/dialects/exasol/ExasolSqlDialect.java b/src/main/java/com/exasol/adapter/dialects/exasol/ExasolSqlDialect.java index 8ebd0a9..78592d5 100644 --- a/src/main/java/com/exasol/adapter/dialects/exasol/ExasolSqlDialect.java +++ b/src/main/java/com/exasol/adapter/dialects/exasol/ExasolSqlDialect.java @@ -155,7 +155,12 @@ public String getStringLiteral(final String value) { @Override public SqlGenerator getSqlGenerator(final SqlGenerationContext context) { - return new ExasolSqlGenerationVisitor(this, context); + if (context.isLocal()){ + return new ExasolLocalSqlGenerationVisitor(this, context); + } else { + return new ExasolSqlGenerationVisitor(this, context); + } + } /** From be2eae439aae71532d178c9423daf893cc596dd6 Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Thu, 28 Mar 2024 14:27:02 +0100 Subject: [PATCH 18/31] removed separate V8 tests I created cause, in hindsight, they serve little to no purpose, the assumeV7 indicator is enough. --- .../ExasolSqlDialectExaConnectionIT.java | 316 +----------------- 1 file changed, 3 insertions(+), 313 deletions(-) diff --git a/src/test/java/com/exasol/adapter/dialects/exasol/ExasolSqlDialectExaConnectionIT.java b/src/test/java/com/exasol/adapter/dialects/exasol/ExasolSqlDialectExaConnectionIT.java index a9d665d..13e2ee4 100644 --- a/src/test/java/com/exasol/adapter/dialects/exasol/ExasolSqlDialectExaConnectionIT.java +++ b/src/test/java/com/exasol/adapter/dialects/exasol/ExasolSqlDialectExaConnectionIT.java @@ -12,8 +12,6 @@ import java.util.Set; import org.junit.jupiter.api.*; -import org.opentest4j.AssertionFailedError; -import org.opentest4j.MultipleFailuresError; import org.testcontainers.containers.JdbcDatabaseContainer.NoDriverFoundException; import com.exasol.adapter.properties.PropertyValidationException; @@ -72,11 +70,11 @@ protected Map getConnectionSpecificVirtualSchemaProperties() { return Map.of("IMPORT_FROM_EXA", "true", EXASOL_CONNECTION_PROPERTY, this.exaConnection.getName()); } - // These tests were overridden and split up according to DB versions for the following reasons: - // Strict datatype checking that's enabled for Exasol V8 makes a number of these tests fail. + // These tests were overridden for the following reasons: + // Strict datatype checking which is by default enabled for Exasol V8 makes a number of these tests fail. // // The old tests that work for DB versions prior to strict datatype checking - // thus can only be run for earlier Exasol DB versions and have to be disabled for V8. + // thus can only be run for earlier Exasol DB versions and have to be skipped for V8. // // The tests using the newer GENERATE_JDBC_DATATYPE_MAPPING_FOR_EXA switch that fixes most of the issues with strict // datatype checking on the pushed down queries @@ -355,312 +353,4 @@ void testCaseGreaterThan() { + getVirtualTableName(this.virtualSchema, table), // table().row("NO").row("YES").row("YES").matches()); } - - // V8 tests start here - private void checkExceptionMessageForStrictDatatypeCheckFailures(final String message) { - assertThat(message, anyOf(// - containsString("Adapter generated invalid pushdown query for virtual table"), // - containsString("Data type mismatch in column"), // - containsString("Unable to run assertion query"), // - containsString("Unable to execute assertion query"))); - } - - private void assertThatStrictDatatypeCheckInCompilerFails(final Throwable exception) { - final String message = exception.getMessage(); - checkExceptionMessageForStrictDatatypeCheckFailures(message); - } - - @Test - void testNonDefaultGeometryV8() { - assumeExasol8OrHigher(); - final MultipleFailuresError exception = assertThrows(MultipleFailuresError.class, () -> { - typeAssertionFor("GEOMETRY(4321)").withValue("POINT (2 5)") // - .expectTypeOf("GEOMETRY(4321)") // - .expectDescribeType("GEOMETRY(4321)") // - .expectResultSetType(expectDataType("GEOMETRY")) // - .runAssert(); - }); - assertThatStrictDatatypeCheckInCompilerFails(exception); - } - - @Test - void testPasswordNotVisibleInImportFromExaV8() throws NoDriverFoundException, SQLException { - assumeExasol8OrHigher(); - final SQLException exception = assertThrows(SQLException.class, () -> { - final Table table = this.sourceSchema.createTable("T1", "C1", "VARCHAR(20)").insert("Hello."); - this.virtualSchema = createVirtualSchema(this.sourceSchema); - final String sql = "SELECT * FROM " + this.virtualSchema.getFullyQualifiedName() + ".\"" + table.getName() - + "\""; - assertThat(explainVirtual(sql), // - table().row( // - anything(), // - not(anyOf( // - containsString(this.user.getName()), // - containsString(this.user.getPassword()), // - containsString(EXASOL.getUsername()), // - containsString(EXASOL.getPassword()) // - )), // - anything(), // - anything() // - ).matches()); - }); - assertThatStrictDatatypeCheckInCompilerFails(exception); - } - - @Test - void testCharMappingAsciiV8() { - assumeExasol8OrHigher(); - final AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { - final Table table = createSingleColumnTable("CHAR(20) ASCII").insert("sun").insert("rain"); - assertVirtualTableContents(table, table("VARCHAR").row(pad("sun", 20)).row(pad("rain", 20)).matches()); - }); - assertThatStrictDatatypeCheckInCompilerFails(exception); - - } - - @Test - void testCharMappingUtf8V8() { - assumeExasol8OrHigher(); - final AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { - verifyCharMappingUtf8("VARCHAR"); - }); - assertThatStrictDatatypeCheckInCompilerFails(exception); - } - - @Test - void testCastVarcharToCharV8() { - assumeExasol8OrHigher(); - final AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { - castFrom("VARCHAR(20)").to("CHAR(40)").input("Hello.").accept("VARCHAR").verify(pad("Hello.", 40)); - }); - assertThatStrictDatatypeCheckInCompilerFails(exception); - } - - @Test - void testHashTypeWithBitSizeV8() { - assumeExasol8OrHigher(); - final MultipleFailuresError exception = assertThrows(MultipleFailuresError.class, () -> { - typeAssertionFor("HASHTYPE(16 BIT)").withValue("550e") // - .expectDescribeType("HASHTYPE(2 BYTE)") // - .expectTypeOf("HASHTYPE(2 BYTE)") // - .expectResultSetType(expectDataType("HASHTYPE")) // - .runAssert(); - }); - assertThatStrictDatatypeCheckInCompilerFails(exception); - } - - @Test - void testDefaultIntervalYearToMonthV8() { - assumeExasol8OrHigher(); - final MultipleFailuresError exception = assertThrows(MultipleFailuresError.class, () -> { - typeAssertionFor("INTERVAL YEAR TO MONTH").withValue("5-3") // - .expectTypeOf("INTERVAL YEAR(2) TO MONTH") // - .expectDescribeType("INTERVAL YEAR(2) TO MONTH") // - .expectResultSetType(expectDataType("INTERVAL YEAR TO MONTH")) // - .expectValue("+05-03") // - .runAssert(); - }); - assertThatStrictDatatypeCheckInCompilerFails(exception); - } - - @Test - void testDefaultGeometryV8() { - assumeExasol8OrHigher(); - final MultipleFailuresError exception = assertThrows(MultipleFailuresError.class, () -> { - typeAssertionFor("GEOMETRY").withValue("POINT (2 5)") // - .expectTypeOf("GEOMETRY") // - .expectDescribeType("GEOMETRY") // - .expectResultSetType(expectDataType("GEOMETRY")) // - .runAssert(); - }); - assertThatStrictDatatypeCheckInCompilerFails(exception); - } - - @Test - void testDefaultIntervalDayToSecondV8() { - assumeExasol8OrHigher(); - final MultipleFailuresError exception = assertThrows(MultipleFailuresError.class, () -> { - typeAssertionFor("INTERVAL DAY TO SECOND").withValue("2 12:50:10.123") // - // day: 2 digits, seconds: 3 digits after decimal point - .expectTypeOf("INTERVAL DAY(2) TO SECOND(3)") // - .expectDescribeType("INTERVAL DAY(2) TO SECOND(3)") // - .expectResultSetType(expectDataType("INTERVAL DAY TO SECOND")) // - .expectValue("+02 12:50:10.123") // - .runAssert(); - }); - assertThatStrictDatatypeCheckInCompilerFails(exception); - } - - @Test - void testGeometryMappingV8() { - assumeExasol8OrHigher(); - final AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { - // Note that the JDBC driver reports the result as VARCHAR for Exasol database with major version < 8 - final Table table = createSingleColumnTable("GEOMETRY").insert("POINT (2 3)"); - assertVirtualTableContents(table, table(expectDataType("GEOMETRY")).row("POINT (2 3)").matches()); - }); - assertThatStrictDatatypeCheckInCompilerFails(exception); - } - - @Test - void testNonDefaultIntervalYearToMonthV8() { - assumeExasol8OrHigher(); - final MultipleFailuresError exception = assertThrows(MultipleFailuresError.class, () -> { - typeAssertionFor("INTERVAL YEAR(4) TO MONTH") // 4 digits for year - .withValue("5-3") // sample interval of 5 years and 3 months - .expectTypeOf("INTERVAL YEAR(4) TO MONTH") // - .expectDescribeType("INTERVAL YEAR(4) TO MONTH") // - .expectResultSetType(expectDataType("INTERVAL YEAR TO MONTH")) // - .expectValue("+0005-03") // 4 digits for year - .runAssert(); - }); - assertThatStrictDatatypeCheckInCompilerFails(exception); - } - - @Test - void testNonDefaultIntervalDayToSecondV8() { - assumeExasol8OrHigher(); - final MultipleFailuresError exception = assertThrows(MultipleFailuresError.class, () -> { - // day: 4 digits, seconds: 6 digits after decimal point - typeAssertionFor("INTERVAL DAY(4) TO SECOND(6)").withValue("2 12:50:10.123") // - .expectTypeOf("INTERVAL DAY(4) TO SECOND(6)") // - .expectDescribeType("INTERVAL DAY(4) TO SECOND(6)") // - .expectResultSetType(expectDataType("INTERVAL DAY TO SECOND")) // - .expectValue("+0002 12:50:10.123000") // - .runAssert(); - }); - assertThatStrictDatatypeCheckInCompilerFails(exception); - } - - @Test - void testNonDefaultHashTypeV8() { - assumeExasol8OrHigher(); - final MultipleFailuresError exception = assertThrows(MultipleFailuresError.class, () -> { - typeAssertionFor("HASHTYPE(4 BYTE)").withValue("550e8400") // - .expectDescribeType("HASHTYPE(4 BYTE)") // - .expectTypeOf("HASHTYPE(4 BYTE)") // - .expectResultSetType(expectDataType("HASHTYPE")) // - .runAssert(); - }); - assertThatStrictDatatypeCheckInCompilerFails(exception); - } - - @Test - void testCastVarcharAsGeometryV8() { - assumeExasol8OrHigher(); - final AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { - castFrom("VARCHAR(20)").to("GEOMETRY(5)").input("POINT(2 5)").accept(expectDataType("GEOMETRY")) - .verify("POINT (2 5)"); - }); - assertThatStrictDatatypeCheckInCompilerFails(exception); - } - - @Test - void testDefaultHashTypeV8() { - assumeExasol8OrHigher(); - final MultipleFailuresError exception = assertThrows(MultipleFailuresError.class, () -> { - typeAssertionFor("HASHTYPE").withValue("550e8400-e29b-11d4-a716-446655440000") - .expectDescribeType("HASHTYPE(16 BYTE)") // - .expectTypeOf("HASHTYPE(16 BYTE)") // - .expectResultSetType(expectDataType("HASHTYPE")) // - .expectValue("550e8400e29b11d4a716446655440000") // - .runAssert(); - }); - assertThatStrictDatatypeCheckInCompilerFails(exception); - } - - @Test - void testIntervalYearToMonthMappingV8() { - assumeExasol8OrHigher(); - final AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { - final Table table = createSingleColumnTable("INTERVAL YEAR (9) TO MONTH")// - .insert("-999999999-11") // - .insert("-1-1") // - .insert("0-0") // - .insert("1-1") // - .insert("999999999-11"); - // why is precision 9 missing in expected data type? - assertVirtualTableContents(table, table(expectDataType("INTERVAL YEAR TO MONTH")) // - .row("-999999999-11") // - .row("-000000001-01") // - .row("+000000000-00") // - .row("+000000001-01") // - .row("+999999999-11") // - .matches()); - }); - assertThatStrictDatatypeCheckInCompilerFails(exception); - } - - @Test - void testIntervalDayToSecondMappingV8() { - assumeExasol8OrHigher(); - final AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { - final Table table = createSingleColumnTable("INTERVAL DAY (9) TO SECOND") // - .insert("-999999999 23:59:59.999") // - .insert("-1 12:34:56.789") // - .insert("0 00:00:00.000") // - .insert("1 12:34:56.789") // - .insert("999999999 23:59:59.999"); - // why is precision 9 missing in expected data type? - assertVirtualTableContents(table, table(expectDataType("INTERVAL DAY TO SECOND")) // - .row("-999999999 23:59:59.999") // - .row("-000000001 12:34:56.789") // - .row("+000000000 00:00:00.000") // - .row("+000000001 12:34:56.789") // - .row("+999999999 23:59:59.999") // - .matches()); - }); - assertThatStrictDatatypeCheckInCompilerFails(exception); - } - - @Test - void testCastVarcharAsIntervalDayToSecondV8() { - assumeExasol8OrHigher(); - final AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { - // why is precision 5 and 2 missing in expected data type? - castFrom("VARCHAR(30)").to("INTERVAL DAY (5) TO SECOND (2)").input("+00003 12:50:10.12") - .accept(expectDataType("INTERVAL DAY TO SECOND")).verify("+00003 12:50:10.12"); - }); - assertThatStrictDatatypeCheckInCompilerFails(exception); - } - - @Test - void testCastVarcharAsIntervalYearToMonthV8() { - assumeExasol8OrHigher(); - final AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { - // why is precision 5 missing in expectedDataType? - castFrom("VARCHAR(30)").to("INTERVAL YEAR (5) TO MONTH").input("+00004-06") - .accept(expectDataType("INTERVAL YEAR TO MONTH")).verify("+00004-06"); - }); - assertThatStrictDatatypeCheckInCompilerFails(exception); - } - - @Test - void testCaseEqualV8() { - assumeExasol8OrHigher(); - final AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { - final Table table = createSingleColumnTable("INTEGER").insert(1).insert(2).insert(3); - this.virtualSchema = createVirtualSchema(this.sourceSchema); - assertVsQuery("SELECT CASE C1 WHEN 1 THEN 'YES' WHEN 2 THEN 'PERHAPS' ELSE 'NO' END FROM " // - + getVirtualTableName(this.virtualSchema, table), // - table().row("YES").row("PERHAPS").row("NO").matches()); - }); - assertThatStrictDatatypeCheckInCompilerFails(exception); - } - - @Test - void testCaseGreaterThanV8() { - assumeExasol8OrHigher(); - final AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> { - final Table table = createSingleColumnTable("INTEGER").insert(1).insert(2).insert(3); - this.virtualSchema = createVirtualSchema(this.sourceSchema); - assertVsQuery("SELECT CASE WHEN C1 > 1 THEN 'YES' ELSE 'NO' END FROM " // - + getVirtualTableName(this.virtualSchema, table), // - table().row("NO").row("YES").row("YES").matches()); - }); - assertThatStrictDatatypeCheckInCompilerFails(exception); - } - } - -// From ce5e1671d68e910854e973a73f8702c6a70d359c Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Thu, 28 Mar 2024 15:07:24 +0100 Subject: [PATCH 19/31] Update documentation --- doc/dialects/exasol.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/dialects/exasol.md b/doc/dialects/exasol.md index ce8a8b6..30bcb59 100644 --- a/doc/dialects/exasol.md +++ b/doc/dialects/exasol.md @@ -113,6 +113,9 @@ Pushdown query with `GENERATE_JDBC_DATATYPE_MAPPING_FOR_EXA = 'true'`: ```sql IMPORT INTO (c1 DECIMAL(36,1), c2 .... ) FROM EXA AT "EXA_CONNECTION" STATEMENT '...' ``` +##### Data type mismatch + +In case you run into a `Data type mismatch` issue when using EXA import turning this property on will usually also solve the issue by providing type hints. ### Using `IMPORT FROM JDBC` From ce887513678f46c83b7728a64915c052998fdd44 Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Thu, 28 Mar 2024 15:36:11 +0100 Subject: [PATCH 20/31] #117 - fix javadoc generation --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 5003b16..9702db2 100644 --- a/pom.xml +++ b/pom.xml @@ -169,12 +169,12 @@ maven-javadoc-plugin 3.6.3 - false + true - + From e3c6b438a1a9b303db93161be51de3c6c8e2222c Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Thu, 28 Mar 2024 15:44:00 +0100 Subject: [PATCH 21/31] Add missing javadoc comment --- .../dialects/exasol/ExasolLocalSqlGenerationVisitor.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitor.java b/src/main/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitor.java index d5cc448..524e753 100644 --- a/src/main/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitor.java +++ b/src/main/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitor.java @@ -5,10 +5,12 @@ import com.exasol.adapter.dialects.rewriting.SqlGenerationContext; import com.exasol.adapter.metadata.DataType; import com.exasol.adapter.sql.SqlColumn; - +/** + * This class generates SQL queries for the {@link ExasolSqlDialect}. It is a 'specialisation' for LOCAL mode, based on {@link ExasolSqlGenerationVisitor}. + */ public class ExasolLocalSqlGenerationVisitor extends ExasolSqlGenerationVisitor{ /** - * Creates a new instance of the {@link ExasolSqlGenerationVisitor}. + * Creates a new instance of the {@link ExasolLocalSqlGenerationVisitor}. * * @param dialect {@link ExasolSqlDialect} dialect * @param context SQL generation context From 6fc7f5684ad286901394986e081f30f9410d816b Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Fri, 29 Mar 2024 10:22:36 +0100 Subject: [PATCH 22/31] Updated doc --- doc/changes/changes_8.0.0.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/doc/changes/changes_8.0.0.md b/doc/changes/changes_8.0.0.md index eeaaaf8..3d9bb9f 100644 --- a/doc/changes/changes_8.0.0.md +++ b/doc/changes/changes_8.0.0.md @@ -1,12 +1,22 @@ -# Exasol Virtual Schema 8.0.0, released 2024-??-?? +# Exasol Virtual Schema 8.0.0, released 2024-04-02 -Code name: +Code name: Charset is always `utf-8`, deprecated IMPORT_DATA_TYPES `FROM_RESULT_SET` value . ## Summary -## Features +The behaviour when it comes to character sets is now simplified, +The target charset is now always UTF-8. -* ISSUE_NUMBER: description +The `IMPORT_DATA_TYPES` property (and value `FROM_RESULT_SET`) are now deprecated (change in vs-common-jdbc): +An exception will be thrown when users use`FROM_RESULT_SET`. The exception message warns the user that the value is no longer supported and the property itself is also deprecated. + +Using timestamps with local timezone in the Exasol virtual schema now returns a proper timestamp with local timezone. + +Querying char and varchar datatypes in LOCAL mode are now returned with UTF8 characterset, as expected. + +## Refactoring + +* #105: Updated tests to include Exasol V8/ Update to vsjdbc 12.0.0 ## Dependency Updates From d25af86118477daf25dd32da93421ec5ba9b863c Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Tue, 2 Apr 2024 10:46:18 +0200 Subject: [PATCH 23/31] Apply suggestions from code review Co-authored-by: Christoph Pirkl <4711730+kaklakariada@users.noreply.github.com> --- doc/changes/changes_8.0.0.md | 2 +- doc/dialects/exasol.md | 1 + pom.xml | 1 - .../dialects/exasol/ExasolSqlDialectExaConnectionIT.java | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/changes/changes_8.0.0.md b/doc/changes/changes_8.0.0.md index 3d9bb9f..3c31846 100644 --- a/doc/changes/changes_8.0.0.md +++ b/doc/changes/changes_8.0.0.md @@ -1,6 +1,6 @@ # Exasol Virtual Schema 8.0.0, released 2024-04-02 -Code name: Charset is always `utf-8`, deprecated IMPORT_DATA_TYPES `FROM_RESULT_SET` value . +Code name: Charset is always `utf-8`, deprecated IMPORT_DATA_TYPES `FROM_RESULT_SET` value ## Summary diff --git a/doc/dialects/exasol.md b/doc/dialects/exasol.md index 30bcb59..ca8bce9 100644 --- a/doc/dialects/exasol.md +++ b/doc/dialects/exasol.md @@ -113,6 +113,7 @@ Pushdown query with `GENERATE_JDBC_DATATYPE_MAPPING_FOR_EXA = 'true'`: ```sql IMPORT INTO (c1 DECIMAL(36,1), c2 .... ) FROM EXA AT "EXA_CONNECTION" STATEMENT '...' ``` + ##### Data type mismatch In case you run into a `Data type mismatch` issue when using EXA import turning this property on will usually also solve the issue by providing type hints. diff --git a/pom.xml b/pom.xml index 9702db2..3670e8e 100644 --- a/pom.xml +++ b/pom.xml @@ -167,7 +167,6 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.6.3 true diff --git a/src/test/java/com/exasol/adapter/dialects/exasol/ExasolSqlDialectExaConnectionIT.java b/src/test/java/com/exasol/adapter/dialects/exasol/ExasolSqlDialectExaConnectionIT.java index 13e2ee4..ed24ac2 100644 --- a/src/test/java/com/exasol/adapter/dialects/exasol/ExasolSqlDialectExaConnectionIT.java +++ b/src/test/java/com/exasol/adapter/dialects/exasol/ExasolSqlDialectExaConnectionIT.java @@ -78,7 +78,7 @@ protected Map getConnectionSpecificVirtualSchemaProperties() { // // The tests using the newer GENERATE_JDBC_DATATYPE_MAPPING_FOR_EXA switch that fixes most of the issues with strict // datatype checking on the pushed down queries - // can be found in ExasolSqlDialectExaConnectionWithDataTypesIT . + // can be found in ExasolSqlDialectExaConnectionWithDataTypesIT. @Test void testPasswordNotVisibleInImportFromExa() throws NoDriverFoundException, SQLException { From 52bab2680c80c335e884f1696255025cc50a113f Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Tue, 2 Apr 2024 10:56:54 +0200 Subject: [PATCH 24/31] Update exasol.md Improved documentation on data type mismatches. --- doc/dialects/exasol.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/dialects/exasol.md b/doc/dialects/exasol.md index ca8bce9..dd58183 100644 --- a/doc/dialects/exasol.md +++ b/doc/dialects/exasol.md @@ -116,7 +116,11 @@ IMPORT INTO (c1 DECIMAL(36,1), c2 .... ) FROM EXA AT "EXA_CONNECTION" STATEMENT ##### Data type mismatch -In case you run into a `Data type mismatch` issue when using EXA import turning this property on will usually also solve the issue by providing type hints. +In case you run into a `Data type mismatch` issue which looks like this: +`Adapter generated invalid pushdown query for virtual table : Data type mismatch in column number (1-indexed).Expected , but got .` + +You can set the datatype mapping to true: `GENERATE_JDBC_DATATYPE_MAPPING_FOR_EXA = 'true'`. +This will usually solve the issue by providing type hints. ### Using `IMPORT FROM JDBC` From c83ed21841a214781111acb3263c8f72e5445b13 Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Tue, 2 Apr 2024 11:16:03 +0200 Subject: [PATCH 25/31] Update project keeper and workflow files + gitattributes file --- .gitattributes | 9 +- .github/workflows/broken_links_checker.yml | 3 + .github/workflows/ci-build-next-java.yml | 6 + .github/workflows/ci-build.yml | 60 +++++- .github/workflows/dependencies_check.yml | 6 +- .github/workflows/dependencies_update.yml | 6 + .github/workflows/release.yml | 193 ++++++++++++++++++ ...elease_droid_prepare_original_checksum.yml | 39 ---- .../release_droid_print_quick_checksum.yml | 26 --- ...release_droid_release_on_maven_central.yml | 35 ---- ...ase_droid_upload_github_release_assets.yml | 47 ----- .project-keeper.yml | 2 - doc/changes/changes_8.0.0.md | 4 +- pk_generated_parent.pom | 2 +- pom.xml | 4 +- 15 files changed, 279 insertions(+), 163 deletions(-) create mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/release_droid_prepare_original_checksum.yml delete mode 100644 .github/workflows/release_droid_print_quick_checksum.yml delete mode 100644 .github/workflows/release_droid_release_on_maven_central.yml delete mode 100644 .github/workflows/release_droid_upload_github_release_assets.yml diff --git a/.gitattributes b/.gitattributes index 200ee40..1cc4ca2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,16 +1,13 @@ dependencies.md linguist-generated=true doc/changes/changelog.md linguist-generated=true pk_generated_parent.pom linguist-generated=true -.github/workflows/ci-build.yml linguist-generated=true .github/workflows/broken_links_checker.yml linguist-generated=true +.github/workflows/ci-build.yml linguist-generated=true .github/workflows/ci-build-next-java.yml linguist-generated=true .github/workflows/dependencies_check.yml linguist-generated=true -.github/workflows/release_droid_prepare_original_checksum.yml linguist-generated=true -.github/workflows/release_droid_print_quick_checksum.yml linguist-generated=true -.github/workflows/release_droid_release_on_maven_central.yml linguist-generated=true -.github/workflows/release_droid_upload_github_release_assets.yml linguist-generated=true +.github/workflows/dependencies_update.yml linguist-generated=true +.github/workflows/release.yml linguist-generated=true .settings/org.eclipse.jdt.core.prefs linguist-generated=true .settings/org.eclipse.jdt.ui.prefs linguist-generated=true - .settings/org.eclipse.jdt.core.prefs linguist-generated=true .settings/org.eclipse.jdt.ui.prefs linguist-generated=true diff --git a/.github/workflows/broken_links_checker.yml b/.github/workflows/broken_links_checker.yml index 0fbcad5..d7a38b4 100644 --- a/.github/workflows/broken_links_checker.yml +++ b/.github/workflows/broken_links_checker.yml @@ -13,6 +13,9 @@ on: jobs: linkChecker: runs-on: ubuntu-latest + defaults: + run: + shell: "bash" concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/ci-build-next-java.yml b/.github/workflows/ci-build-next-java.yml index e3acdb7..8886e10 100644 --- a/.github/workflows/ci-build-next-java.yml +++ b/.github/workflows/ci-build-next-java.yml @@ -10,6 +10,12 @@ on: jobs: java-17-compatibility: runs-on: ubuntu-latest + defaults: + run: + shell: "bash" + permissions: + contents: read + checks: write # Allow scacap/action-surefire-report concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 73fcdcb..e847dc0 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -3,13 +3,18 @@ name: CI Build on: push: - branches: - - main + branches: ["main"] pull_request: jobs: matrix-build: runs-on: ubuntu-20.04 + defaults: + run: + shell: "bash" + permissions: + contents: read + checks: write # Allow scacap/action-surefire-report concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.exasol_db_version }} cancel-in-progress: true @@ -46,6 +51,7 @@ jobs: - name: Enable testcontainer reuse run: echo 'testcontainers.reuse.enable=true' > "$HOME/.testcontainers.properties" - name: Run tests and build with Maven + id: pk-verify run: | mvn --batch-mode clean verify \ -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ @@ -71,8 +77,58 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: Verify Release Artifacts + run: | + print_message() { + local -r message=$1 + echo "$message" + echo "$message" >> "$GITHUB_STEP_SUMMARY" + } + + print_message "# Release Artifacts" + + IFS=$'\n' artifacts_array=($ARTIFACTS) + missing_files=() + for file in "${artifacts_array[@]}"; + do + echo "Checking if file $file exists..." + if ! [[ -f "$file" ]]; then + print_message "* ⚠️ \`$file\` does not exist ⚠️" + echo "Content of directory $(dirname "$file"):" + ls "$(dirname "$file")" + missing_files+=("$file") + else + print_message "* \`$file\` ✅" + fi + done + print_message "" + number_of_missing_files=${#missing_files[@]} + if [[ $number_of_missing_files -gt 0 ]]; then + print_message "⚠️ $number_of_missing_files release artifact(s) missing ⚠️" + exit 1 + else + print_message "All ${#artifacts_array[@]} artifact(s) present ✅" + fi + env: + ARTIFACTS: ${{ steps.pk-verify.outputs.release-artifacts }} + build: needs: matrix-build runs-on: ubuntu-latest steps: - run: echo "Build successful" + + # [impl->dsn~release-workflow.ci-build-starts-release~1] + start_release: + needs: build + if: ${{ github.ref == 'refs/heads/main' }} + concurrency: + cancel-in-progress: false + group: "release" + secrets: inherit + permissions: + contents: write + actions: read + uses: ./.github/workflows/release.yml + with: + started-from-ci: true diff --git a/.github/workflows/dependencies_check.yml b/.github/workflows/dependencies_check.yml index 6926e55..bd26ab6 100644 --- a/.github/workflows/dependencies_check.yml +++ b/.github/workflows/dependencies_check.yml @@ -9,6 +9,9 @@ on: jobs: report_security_issues: runs-on: ubuntu-latest + defaults: + run: + shell: "bash" permissions: contents: read issues: write @@ -50,10 +53,11 @@ jobs: start_dependency_udpate: needs: report_security_issues + # [impl->dsn~trigger-dependency-updates~1] if: ${{ needs.report_security_issues.outputs.created-issues }} concurrency: cancel-in-progress: true - group: "dependency_update" + group: "dependencies_update" # Workflow needs secret INTEGRATION_TEAM_SLACK_NOTIFICATION_WEBHOOK secrets: inherit permissions: diff --git a/.github/workflows/dependencies_update.yml b/.github/workflows/dependencies_update.yml index 58222ba..0f6b816 100644 --- a/.github/workflows/dependencies_update.yml +++ b/.github/workflows/dependencies_update.yml @@ -4,6 +4,7 @@ name: Update dependencies on: workflow_call: inputs: + # [impl->dsn~dependency-updater.workflow.vulnerability-info~1] vulnerability_issues: description: "GitHub issues for vulnerable dependencies as JSONL" required: true @@ -13,6 +14,9 @@ on: jobs: update_dependencies: runs-on: ubuntu-latest + defaults: + run: + shell: "bash" permissions: contents: write pull-requests: write @@ -45,6 +49,7 @@ jobs: core.setFailed('Not running on a branch, github.ref is ${{ github.ref }}. Please start this workflow only on main or a branch') - name: Update dependencies + # [impl->dsn~dependency-updater.workflow.start-pk-update~1] run: | mvn --batch-mode com.exasol:project-keeper-maven-plugin:update-dependencies --projects . \ -Dproject-keeper:vulnerabilities="$CREATED_ISSUES" @@ -64,6 +69,7 @@ jobs: - name: Generate Pull Request comment id: pr-comment + # [impl->dsn~dependency-updater.workflow.create-pull-request~1] # [impl->dsn~dependency-updater.workflow.pull-request-trigger-ci-build~1] run: | echo 'comment<> "$GITHUB_OUTPUT" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..fe959c9 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,193 @@ +# Generated by Project Keeper +# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/release.yml +name: Release +on: + # [impl->dsn~release-workflow.triggers~1] + workflow_call: + inputs: + started-from-ci: + description: "Marks this release as started from CI, skipping precondition check" + type: boolean + required: true + default: false + workflow_dispatch: + inputs: + skip-maven-central: + description: "Skip deployment to Maven Central" + required: true + type: boolean + default: false + skip-github-release: + description: "Skip creating the GitHub release" + required: true + type: boolean + default: false + +jobs: + release: + runs-on: ubuntu-latest + defaults: + run: + shell: "bash" + concurrency: + group: ${{ github.workflow }} + cancel-in-progress: false + permissions: + contents: write + actions: read + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Maven Central Repository + if: ${{ true }} + uses: actions/setup-java@v4 + with: + distribution: "temurin" + java-version: | + 11 + 17 + cache: "maven" + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE + - name: Set up JDKs + if: ${{ ! true }} + uses: actions/setup-java@v4 + with: + distribution: "temurin" + java-version: | + 11 + 17 + cache: "maven" + + # Check preconditions + + - name: Fail if not running on main branch + if: ${{ github.ref != 'refs/heads/main' }} + uses: actions/github-script@v7 + with: + script: | + core.setFailed('Not running on main branch, github.ref is ${{ github.ref }}. Please start this workflow only on main') + + # [impl->dsn~release-workflow.verify-ci-build-success~1] + - name: Check CI build of this commit succeeded + # We skip this check if this was started from ci-build.yml, because the build status would be "in progress". + if: ${{ ! inputs.started-from-ci }} + run: | + echo "Commit SHA: $COMMIT_SHA" + gh run list --workflow ci-build.yml --branch main --event push --commit $COMMIT_SHA + ci_build_status=$(gh run list --workflow ci-build.yml --branch main --event push --commit $COMMIT_SHA --json conclusion --template '{{range .}}{{.conclusion}}{{"\n"}}{{end}}') + echo "CI build status at commit $COMMIT_SHA was '$ci_build_status'" + if [[ "$ci_build_status" != "success" ]]; then + gh run list --workflow ci-build.yml --commit $COMMIT_SHA >> $GITHUB_STEP_SUMMARY + echo "Status of CI build for commit $COMMIT_SHA was '$ci_build_status', expected 'success'" >> $GITHUB_STEP_SUMMARY + cat $GITHUB_STEP_SUMMARY + exit 1 + fi + env: + COMMIT_SHA: ${{ github.sha }} + GH_TOKEN: ${{ github.token }} + # [impl->dsn~release-workflow.run-verify-release~1] + - name: Verify release preconditions + id: verify-release + run: | + mvn --batch-mode com.exasol:project-keeper-maven-plugin:verify-release --projects . + echo "$GITHUB_OUTPUT" + env: + GITHUB_TOKEN: ${{ github.token }} + # [impl->dsn~release-workflow.verify-skip-tests~1] + - name: Build project + run: mvn --batch-mode -DskipTests clean verify + + # Maven Central Deployment + - name: List secret GPG keys + if: ${{ true && (! inputs.skip-maven-central) }} + run: gpg --list-secret-keys + # [impl->dsn~release-workflow.deploy-maven-central~1] + - name: Publish to Central Repository + if: ${{ true && (! inputs.skip-maven-central) }} + run: | + mvn --batch-mode -Dgpg.skip=false -DskipTests deploy + echo "Published to Maven Central" >> "$GITHUB_STEP_SUMMARY" + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} + + # Create GitHub releasse + + - name: Calculate Artifact Checksums + id: artifact-checksum + if: ${{ ! inputs.skip-github-release }} + run: | + ls target/ + echo "Calculating sha256 checksum for artifact files" + echo "artifacts<> "$GITHUB_OUTPUT" + IFS=$'\n' artifacts_array=($ARTIFACTS) + for file in "${artifacts_array[@]}"; + do + full_path=$(realpath "$file") + echo "Calculate sha256sum for file '$full_path'" + file_dir="$(dirname "$full_path")" + file_name=$(basename "$full_path") + pushd "$file_dir" + checksum_file_name="${file_name}.sha256" + sha256sum "$file_name" > "$checksum_file_name" + echo "$full_path" >> "$GITHUB_OUTPUT" + echo "${file_dir}/$checksum_file_name" >> "$GITHUB_OUTPUT" + popd + done + echo "EOF" >> "$GITHUB_OUTPUT" + echo "Full artifact file list" + cat "$GITHUB_OUTPUT" + env: + ARTIFACTS: ${{ steps.verify-release.outputs.release-artifacts }} + + # [impl->dsn~release-workflow.create-github-release~1] + - name: Create GitHub Release + id: create-github-release + if: ${{ ! inputs.skip-github-release }} + run: | + IFS=$'\n' artifacts_array=($ARTIFACTS) + for file in "${artifacts_array[@]}"; + do + echo "Attaching file '$file'" + done + release_url=$(gh release create --draft --latest --title "$TITLE" --notes "$NOTES" --target main $TAG "${artifacts_array[@]}") + echo "Created release $TAG with title '$TITLE' at $release_url" >> "$GITHUB_STEP_SUMMARY" + echo "release-url=$release_url" >> "$GITHUB_OUTPUT" + git fetch --tags origin + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ steps.verify-release.outputs.version }} + NOTES: ${{ steps.verify-release.outputs.release-notes }} + TITLE: ${{ steps.verify-release.outputs.release-title }} + ARTIFACTS: ${{ steps.artifact-checksum.outputs.artifacts }} + + - name: Report failure Status to Slack channel + # Also run this step in case of failures + if: ${{ always() }} + uses: ravsamhq/notify-slack-action@v2 + with: + status: ${{ job.status }} + token: ${{ github.token }} + notification_title: "Release build in {repo} has {status_message}" + message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>" + notify_when: "failure,cancelled,warnings,skipped" + env: + SLACK_WEBHOOK_URL: ${{ secrets.INTEGRATION_TEAM_SLACK_NOTIFICATION_WEBHOOK }} + + - name: Report new release to Slack channel + if: ${{ steps.create-github-release.outputs.release-url }} + uses: ravsamhq/notify-slack-action@v2 + with: + status: ${{ job.status }} + token: ${{ github.token }} + notification_title: "Release build for {repo} created a new release" + message_format: "{workflow} created release ${{ steps.create-github-release.outputs.release-url }}" + env: + SLACK_WEBHOOK_URL: ${{ secrets.INTEGRATION_TEAM_SLACK_NOTIFICATION_WEBHOOK }} diff --git a/.github/workflows/release_droid_prepare_original_checksum.yml b/.github/workflows/release_droid_prepare_original_checksum.yml deleted file mode 100644 index 2ff28b3..0000000 --- a/.github/workflows/release_droid_prepare_original_checksum.yml +++ /dev/null @@ -1,39 +0,0 @@ -# Generated by Project Keeper -# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/release_droid_prepare_original_checksum.yml -name: Release Droid - Prepare Original Checksum -on: - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-20.04 - steps: - - name: Free Disk Space - if: ${{ false }} - run: | - sudo rm -rf /usr/local/lib/android - sudo rm -rf /usr/share/dotnet - - name: Checkout the repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up JDKs - uses: actions/setup-java@v4 - with: - distribution: "temurin" - java-version: | - 11 - 17 - cache: "maven" - - name: Enable testcontainer reuse - run: echo 'testcontainers.reuse.enable=true' > "$HOME/.testcontainers.properties" - - name: Run tests and build with Maven - run: mvn --batch-mode clean verify --file pom.xml - - name: Prepare checksum - run: find target -maxdepth 1 -name *.jar -exec sha256sum "{}" + > original_checksum - - name: Upload checksum to the artifactory - uses: actions/upload-artifact@v4 - with: - name: original_checksum - retention-days: 5 - path: original_checksum diff --git a/.github/workflows/release_droid_print_quick_checksum.yml b/.github/workflows/release_droid_print_quick_checksum.yml deleted file mode 100644 index 86979cd..0000000 --- a/.github/workflows/release_droid_print_quick_checksum.yml +++ /dev/null @@ -1,26 +0,0 @@ -# Generated by Project Keeper -# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/release_droid_print_quick_checksum.yml -name: Release Droid - Print Quick Checksum -on: - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout the repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up JDKs - uses: actions/setup-java@v4 - with: - distribution: "temurin" - java-version: | - 11 - 17 - cache: "maven" - - name: Build with Maven skipping tests - run: mvn --batch-mode clean verify -DskipTests - - name: Print checksum - run: echo 'checksum_start==';find target -maxdepth 1 -name *.jar -exec sha256sum "{}" + | xargs;echo '==checksum_end' diff --git a/.github/workflows/release_droid_release_on_maven_central.yml b/.github/workflows/release_droid_release_on_maven_central.yml deleted file mode 100644 index 0a5ee04..0000000 --- a/.github/workflows/release_droid_release_on_maven_central.yml +++ /dev/null @@ -1,35 +0,0 @@ -# Generated by Project Keeper -# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/release_droid_release_on_maven_central.yml -name: Release Droid - Release On Maven Central -on: - workflow_dispatch: - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - name: Checkout the repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up Maven Central Repository - uses: actions/setup-java@v4 - with: - distribution: "temurin" - java-version: | - 11 - 17 - cache: "maven" - server-id: ossrh - server-username: MAVEN_USERNAME - server-password: MAVEN_PASSWORD - gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }} - gpg-passphrase: MAVEN_GPG_PASSPHRASE - - name: List secret GPG keys - run: gpg --list-secret-keys - - name: Publish to Central Repository - run: mvn --batch-mode -Dgpg.skip=false -DskipTests clean deploy - env: - MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} diff --git a/.github/workflows/release_droid_upload_github_release_assets.yml b/.github/workflows/release_droid_upload_github_release_assets.yml deleted file mode 100644 index b19f7cf..0000000 --- a/.github/workflows/release_droid_upload_github_release_assets.yml +++ /dev/null @@ -1,47 +0,0 @@ -# Generated by Project Keeper -# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/release_droid_upload_github_release_assets.yml -name: Release Droid - Upload GitHub Release Assets -on: - workflow_dispatch: - inputs: - upload_url: - description: "Assets upload URL" - required: true - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout the repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up JDKs - uses: actions/setup-java@v4 - with: - distribution: "temurin" - java-version: | - 11 - 17 - cache: "maven" - - name: Build with Maven skipping tests - run: mvn --batch-mode clean verify -DskipTests - - name: Generate sha256sum files - run: | - cd target - find . -maxdepth 1 -name \*.jar -exec bash -c 'sha256sum {} > {}.sha256' \; - - name: Upload assets to the GitHub release draft - uses: shogo82148/actions-upload-release-asset@v1 - with: - upload_url: ${{ github.event.inputs.upload_url }} - asset_path: target/*.jar - - name: Upload sha256sum files - uses: shogo82148/actions-upload-release-asset@v1 - with: - upload_url: ${{ github.event.inputs.upload_url }} - asset_path: target/*.sha256 - - name: Upload error-code-report - uses: shogo82148/actions-upload-release-asset@v1 - with: - upload_url: ${{ github.event.inputs.upload_url }} - asset_path: target/error_code_report.json diff --git a/.project-keeper.yml b/.project-keeper.yml index 5f1f89f..478bded 100644 --- a/.project-keeper.yml +++ b/.project-keeper.yml @@ -6,8 +6,6 @@ sources: - integration_tests - udf_coverage - maven_central -excludes: - - "W-PK-CORE-153: Project-keeper version 4.1.0 is outdated. Please update project-keeper to latest version 4.2.0." build: runnerOs: ubuntu-20.04 freeDiskSpace: false diff --git a/doc/changes/changes_8.0.0.md b/doc/changes/changes_8.0.0.md index 3c31846..52aff5d 100644 --- a/doc/changes/changes_8.0.0.md +++ b/doc/changes/changes_8.0.0.md @@ -31,8 +31,8 @@ Querying char and varchar datatypes in LOCAL mode are now returned with UTF8 cha ### Plugin Dependency Updates -* Updated `com.exasol:error-code-crawler-maven-plugin:1.3.1` to `2.0.0` -* Updated `com.exasol:project-keeper-maven-plugin:3.0.1` to `4.1.0` +* Updated `com.exasol:error-code-crawler-maven-plugin:1.3.1` to `2.0.1` +* Updated `com.exasol:project-keeper-maven-plugin:3.0.1` to `4.2.0` * Updated `org.apache.maven.plugins:maven-compiler-plugin:3.11.0` to `3.12.1` * Updated `org.apache.maven.plugins:maven-failsafe-plugin:3.2.3` to `3.2.5` * Updated `org.apache.maven.plugins:maven-javadoc-plugin:3.4.1` to `3.6.3` diff --git a/pk_generated_parent.pom b/pk_generated_parent.pom index f498de1..d215b61 100644 --- a/pk_generated_parent.pom +++ b/pk_generated_parent.pom @@ -450,7 +450,7 @@ com.exasol error-code-crawler-maven-plugin - 2.0.0 + 2.0.1 verify diff --git a/pom.xml b/pom.xml index 3670e8e..18c1ccf 100644 --- a/pom.xml +++ b/pom.xml @@ -102,7 +102,7 @@ com.exasol project-keeper-maven-plugin - 4.1.0 + 4.2.0 @@ -173,7 +173,7 @@ - + From bd3b23aeec139598fd22f5ad2d05249e145949fa Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Tue, 2 Apr 2024 11:32:51 +0200 Subject: [PATCH 26/31] refactored localsqlgenerationvisitor --- .../ExasolLocalSqlGenerationVisitor.java | 43 +++++++++++++------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitor.java b/src/main/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitor.java index 524e753..1eec0ab 100644 --- a/src/main/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitor.java +++ b/src/main/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitor.java @@ -4,24 +4,49 @@ import com.exasol.adapter.dialects.SqlDialect; import com.exasol.adapter.dialects.rewriting.SqlGenerationContext; import com.exasol.adapter.metadata.DataType; +import com.exasol.adapter.metadata.DataType.ExaDataType; import com.exasol.adapter.sql.SqlColumn; + /** - * This class generates SQL queries for the {@link ExasolSqlDialect}. It is a 'specialisation' for LOCAL mode, based on {@link ExasolSqlGenerationVisitor}. + * This class generates SQL queries for the {@link ExasolSqlDialect}. It is a 'specialisation' for LOCAL mode, based on + * {@link ExasolSqlGenerationVisitor}. It adds a cast to UTF8 for char and varchar datatype imports. */ -public class ExasolLocalSqlGenerationVisitor extends ExasolSqlGenerationVisitor{ +public class ExasolLocalSqlGenerationVisitor extends ExasolSqlGenerationVisitor { /** * Creates a new instance of the {@link ExasolLocalSqlGenerationVisitor}. * * @param dialect {@link ExasolSqlDialect} dialect * @param context SQL generation context */ - ExasolLocalSqlGenerationVisitor(SqlDialect dialect, SqlGenerationContext context) { + ExasolLocalSqlGenerationVisitor(final SqlDialect dialect, final SqlGenerationContext context) { super(dialect, context); } + @Override public String visit(final SqlColumn column) throws AdapterException { - ExasolSqlDialect exasolSqlDialect = new ExasolSqlDialect(null,null); + final ExasolSqlDialect exasolSqlDialect = new ExasolSqlDialect(null, null); String tablePrefix = ""; + tablePrefix = getTablePrefix(column, exasolSqlDialect, tablePrefix); + final ExaDataType exaDataType = column.getMetadata().getType().getExaDataType(); + if (exaDataType == DataType.ExaDataType.CHAR || // + exaDataType == DataType.ExaDataType.VARCHAR) { + // Provide a cast to corresponding datatype with the same length but with utf8 as charset. + return addCastAndReturnColumnName(exaDataType, column, exasolSqlDialect, tablePrefix); + } else { + return tablePrefix + exasolSqlDialect.applyQuote(column.getName()); + } + } + + private String addCastAndReturnColumnName(final ExaDataType exaDataType, final SqlColumn column, + final ExasolSqlDialect exasolSqlDialect, final String tablePrefix) { + final int size = column.getMetadata().getType().getSize(); + + final String dataTypeStr = exaDataType == DataType.ExaDataType.CHAR ? "CHAR" : "VARCHAR"; + return "CAST(" + tablePrefix + exasolSqlDialect.applyQuote(column.getName()) + " AS " + dataTypeStr + "(" + size + + ") UTF8)"; + } + + private String getTablePrefix(final SqlColumn column, final ExasolSqlDialect exasolSqlDialect, String tablePrefix) { if (column.hasTableAlias()) { tablePrefix = exasolSqlDialect.applyQuote(column.getTableAlias()) + exasolSqlDialect.getTableCatalogAndSchemaSeparator(); @@ -29,14 +54,6 @@ public String visit(final SqlColumn column) throws AdapterException { tablePrefix = exasolSqlDialect.applyQuote(column.getTableName()) + exasolSqlDialect.getTableCatalogAndSchemaSeparator(); } - //PROVIDE A CAST TO CORRESPONDING DATATYPE WITH THE SAME LENGTH BUT WITH UTF8 AS CHARSET - if (column.getMetadata().getType().getExaDataType() == DataType.ExaDataType.CHAR || // - column.getMetadata().getType().getExaDataType() == DataType.ExaDataType.VARCHAR) { - int size = column.getMetadata().getType().getSize(); - String dataTypeStr = column.getMetadata().getType().getExaDataType() == DataType.ExaDataType.CHAR ? "CHAR":"VARCHAR"; - return "CAST(" + tablePrefix + exasolSqlDialect.applyQuote(column.getName())+" AS "+ dataTypeStr+"("+size+") UTF8)"; - } else { - return tablePrefix + exasolSqlDialect.applyQuote(column.getName()); - } + return tablePrefix; } } From 24d556ebc915f4787fbd81c6d59ef58a76df27fb Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Tue, 2 Apr 2024 11:45:15 +0200 Subject: [PATCH 27/31] removed throws statement --- .../adapter/dialects/exasol/AbstractExasolSqlDialectIT.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java b/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java index 96d0bcb..9ffafd9 100644 --- a/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java +++ b/src/test/java/com/exasol/adapter/dialects/exasol/AbstractExasolSqlDialectIT.java @@ -25,7 +25,6 @@ import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.ValueSource; import org.opentest4j.AssertionFailedError; -import org.testcontainers.containers.JdbcDatabaseContainer.NoDriverFoundException; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; @@ -61,8 +60,7 @@ abstract class AbstractExasolSqlDialectIT { private final Set expectVarcharFor = expectVarcharFor(); @BeforeAll - static void beforeAll() throws BucketAccessException, TimeoutException, NoDriverFoundException, SQLException, - FileNotFoundException { + static void beforeAll() { try { connection = EXASOL.createConnection(""); final UdfTestSetup udfTestSetup = new UdfTestSetup(getTestHostIpFromInsideExasol(), From c6af507209b60596b0d03b3eeb5e054e0bc350ad Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Tue, 2 Apr 2024 14:19:59 +0200 Subject: [PATCH 28/31] unit tests for local sqlgeneration visitor --- .../ExasolLocalSqlGenerationVisitorTest.java | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/test/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitorTest.java diff --git a/src/test/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitorTest.java b/src/test/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitorTest.java new file mode 100644 index 0000000..8436646 --- /dev/null +++ b/src/test/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitorTest.java @@ -0,0 +1,67 @@ +package com.exasol.adapter.dialects.exasol; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.MatcherAssert.assertThat; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import com.exasol.adapter.AdapterException; +import com.exasol.adapter.AdapterProperties; +import com.exasol.adapter.dialects.SqlDialect; +import com.exasol.adapter.dialects.dummy.DummySqlDialect; +import com.exasol.adapter.dialects.rewriting.SqlGenerationContext; +import com.exasol.adapter.metadata.ColumnMetadata; +import com.exasol.adapter.metadata.DataType; +import com.exasol.adapter.metadata.DataType.ExaCharset; +import com.exasol.adapter.sql.SqlColumn; + +public class ExasolLocalSqlGenerationVisitorTest { + private static ExasolLocalSqlGenerationVisitor exasolLocalSqlGenerationVisitor; + + @BeforeAll + public static void beforeAll() { + final Map rawProperties = new HashMap<>(); + final AdapterProperties adapterProperties = new AdapterProperties(rawProperties); + final SqlDialect sqlDialect = new DummySqlDialect(null, adapterProperties); + final SqlGenerationContext context = new SqlGenerationContext("", "TEXT_SCHEMA_NAME", false); + exasolLocalSqlGenerationVisitor = new ExasolLocalSqlGenerationVisitor(sqlDialect, context); + } + + @Test + public void testVisitSqlLiteralVarchar() throws AdapterException { + + final SqlColumn argument = new SqlColumn(1, // + ColumnMetadata.builder().name("a").type(DataType.createVarChar(20, ExaCharset.ASCII)).build(), + "table_name"); // + + assertThat(exasolLocalSqlGenerationVisitor.visit(argument), + equalTo("CAST(\"table_name\".\"a\" AS VARCHAR(20) UTF8)")); + + } + + @Test + public void testVisitSqlLiteralChar() throws AdapterException { + + final SqlColumn argument = new SqlColumn(1, // + ColumnMetadata.builder().name("a").type(DataType.createChar(20, ExaCharset.ASCII)).build(), + "table_name"); // + + assertThat(exasolLocalSqlGenerationVisitor.visit(argument), + equalTo("CAST(\"table_name\".\"a\" AS CHAR(20) UTF8)")); + + } + + @Test + public void testVisitSqlLiteralDouble() throws AdapterException { + + final SqlColumn argument = new SqlColumn(1, // + ColumnMetadata.builder().name("a").type(DataType.createDouble()).build(), "table_name"); // + + assertThat(exasolLocalSqlGenerationVisitor.visit(argument), equalTo("\"table_name\".\"a\"")); + + } +} From 13baba917fe99cfd3426f6ceac14c8ad8df5719c Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Tue, 2 Apr 2024 14:50:14 +0200 Subject: [PATCH 29/31] fix code smell --- .../exasol/ExasolLocalSqlGenerationVisitorTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitorTest.java b/src/test/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitorTest.java index 8436646..1995512 100644 --- a/src/test/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitorTest.java +++ b/src/test/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitorTest.java @@ -32,7 +32,7 @@ public static void beforeAll() { } @Test - public void testVisitSqlLiteralVarchar() throws AdapterException { + void testVisitSqlLiteralVarchar() throws AdapterException { final SqlColumn argument = new SqlColumn(1, // ColumnMetadata.builder().name("a").type(DataType.createVarChar(20, ExaCharset.ASCII)).build(), @@ -44,7 +44,7 @@ public void testVisitSqlLiteralVarchar() throws AdapterException { } @Test - public void testVisitSqlLiteralChar() throws AdapterException { + void testVisitSqlLiteralChar() throws AdapterException { final SqlColumn argument = new SqlColumn(1, // ColumnMetadata.builder().name("a").type(DataType.createChar(20, ExaCharset.ASCII)).build(), @@ -56,7 +56,7 @@ public void testVisitSqlLiteralChar() throws AdapterException { } @Test - public void testVisitSqlLiteralDouble() throws AdapterException { + void testVisitSqlLiteralDouble() throws AdapterException { final SqlColumn argument = new SqlColumn(1, // ColumnMetadata.builder().name("a").type(DataType.createDouble()).build(), "table_name"); // From de5fa20a787377f6ab45f3ee953cdd3f265b0ff3 Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Tue, 2 Apr 2024 14:54:56 +0200 Subject: [PATCH 30/31] small refactoring, added final --- .../dialects/exasol/ExasolLocalSqlGenerationVisitor.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitor.java b/src/main/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitor.java index 1eec0ab..0788471 100644 --- a/src/main/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitor.java +++ b/src/main/java/com/exasol/adapter/dialects/exasol/ExasolLocalSqlGenerationVisitor.java @@ -25,8 +25,7 @@ public class ExasolLocalSqlGenerationVisitor extends ExasolSqlGenerationVisitor @Override public String visit(final SqlColumn column) throws AdapterException { final ExasolSqlDialect exasolSqlDialect = new ExasolSqlDialect(null, null); - String tablePrefix = ""; - tablePrefix = getTablePrefix(column, exasolSqlDialect, tablePrefix); + final String tablePrefix = getTablePrefix(column, exasolSqlDialect); final ExaDataType exaDataType = column.getMetadata().getType().getExaDataType(); if (exaDataType == DataType.ExaDataType.CHAR || // exaDataType == DataType.ExaDataType.VARCHAR) { @@ -46,7 +45,8 @@ private String addCastAndReturnColumnName(final ExaDataType exaDataType, final S + ") UTF8)"; } - private String getTablePrefix(final SqlColumn column, final ExasolSqlDialect exasolSqlDialect, String tablePrefix) { + private String getTablePrefix(final SqlColumn column, final ExasolSqlDialect exasolSqlDialect) { + String tablePrefix = ""; if (column.hasTableAlias()) { tablePrefix = exasolSqlDialect.applyQuote(column.getTableAlias()) + exasolSqlDialect.getTableCatalogAndSchemaSeparator(); From 67e632f4984634e179aa7e2d01e5b263258621cb Mon Sep 17 00:00:00 2001 From: Pieterjan Spoelders Date: Tue, 2 Apr 2024 14:57:32 +0200 Subject: [PATCH 31/31] removed unused line --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index 18c1ccf..abb79ab 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,6 @@ https://github.com/exasol/exasol-virtual-schema/ 12.0.0 - 1.19.0