From ce5c10afba111c59afdf0879a08c5206a3a4d812 Mon Sep 17 00:00:00 2001 From: Sebastian Nehls <10393149+snehlsen@users.noreply.github.com> Date: Tue, 7 May 2019 13:34:05 +0200 Subject: [PATCH] #151: enabled join pushdown for postgresql (#173) * #151: enabled join pushdown for postgresql * #151: fixed review findings * #151 replaced long casts in integration test with literals * #151: increased version to 1.14.0 * #151: added assertAll in integration test --- doc/dialects/athena.md | 2 +- doc/dialects/db2.md | 2 +- doc/dialects/exasol.md | 2 +- doc/dialects/hive.md | 2 +- doc/dialects/impala.md | 2 +- doc/dialects/oracle.md | 2 +- doc/dialects/postgresql.md | 2 +- doc/dialects/redshift.md | 2 +- doc/dialects/sql_server.md | 2 +- doc/dialects/sybase.md | 2 +- doc/dialects/teradata.md | 2 +- .../deploying_the_virtual_schema_adapter.md | 8 +- doc/user-guide/dialects/db2.md | 2 +- doc/user-guide/dialects/exasol.md | 2 +- doc/user-guide/dialects/hive.md | 2 +- doc/user-guide/dialects/impala.md | 2 +- doc/user-guide/dialects/oracle.md | 2 +- doc/user-guide/dialects/postgresql.md | 2 +- doc/user-guide/dialects/redshift.md | 2 +- doc/user-guide/dialects/sql_server.md | 2 +- doc/user-guide/dialects/sybase.md | 2 +- doc/user-guide/dialects/teradata.md | 2 +- .../integration-test-db2.yaml | 2 +- .../integration-test-sample.yaml | 2 +- .../integration-test-travis.yaml | 2 +- .../local/integration-test-config.yaml | 2 +- jdbc-adapter/pom.xml | 2 +- .../postgresql/PostgreSQLSqlDialect.java | 3 +- .../postgresql/PostgreSQLSqlDialectIT.java | 75 ++++++++++++------- .../postgresql/PostgreSQLSqlDialectTest.java | 3 +- 30 files changed, 80 insertions(+), 61 deletions(-) diff --git a/doc/dialects/athena.md b/doc/dialects/athena.md index 495b93625..2b1cb852b 100644 --- a/doc/dialects/athena.md +++ b/doc/dialects/athena.md @@ -43,7 +43,7 @@ You install the adapter script via the special SQL command `CREATE JAVA ADAPTER ```sql CREATE OR REPLACE JAVA ADAPTER SCRIPT ADAPTER.JDBC_ADAPTER AS %scriptclass com.exasol.adapter.jdbc.JdbcAdapter; - %jar /buckets/bucketfs1/jdbc/virtualschema-jdbc-adapter-dist-1.13.1.jar; + %jar /buckets/bucketfs1/jdbc/virtualschema-jdbc-adapter-dist-1.14.0.jar; %jar /buckets/bucketfs1/jdbc/AthenaJDBC42-.jar; / ``` diff --git a/doc/dialects/db2.md b/doc/dialects/db2.md index a9f2e7de4..35a8e4dd0 100644 --- a/doc/dialects/db2.md +++ b/doc/dialects/db2.md @@ -46,7 +46,7 @@ CREATE or replace JAVA ADAPTER SCRIPT adapter.jdbc_adapter AS // This will add the adapter jar to the classpath so that it can be used inside the adapter script // Replace the names of the bucketfs and the bucket with the ones you used. - %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.13.1.jar; + %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.14.0.jar; // DB2 Driver files %jar /buckets/bucketfs1/bucket1/db2jcc4.jar; diff --git a/doc/dialects/exasol.md b/doc/dialects/exasol.md index e867f806f..7ecd7c13d 100644 --- a/doc/dialects/exasol.md +++ b/doc/dialects/exasol.md @@ -17,7 +17,7 @@ After uploading the adapter jar, the adapter script can be created as follows: CREATE SCHEMA adapter; CREATE JAVA ADAPTER SCRIPT adapter.jdbc_adapter AS %scriptclass com.exasol.adapter.jdbc.JdbcAdapter; - %jar /buckets/your-bucket-fs/your-bucket/virtualschema-jdbc-adapter-dist-1.13.1.jar; + %jar /buckets/your-bucket-fs/your-bucket/virtualschema-jdbc-adapter-dist-1.14.0.jar; / ``` diff --git a/doc/dialects/hive.md b/doc/dialects/hive.md index 6f9bf65b0..2b637b28c 100644 --- a/doc/dialects/hive.md +++ b/doc/dialects/hive.md @@ -23,7 +23,7 @@ CREATE SCHEMA adapter; CREATE JAVA ADAPTER SCRIPT jdbc_adapter AS %scriptclass com.exasol.adapter.jdbc.JdbcAdapter; - %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.13.1.jar; + %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.14.0.jar; %jar /buckets/bucketfs1/bucket1/HiveJDBC41.jar; / diff --git a/doc/dialects/impala.md b/doc/dialects/impala.md index 0e98c93af..d472d61c6 100644 --- a/doc/dialects/impala.md +++ b/doc/dialects/impala.md @@ -22,7 +22,7 @@ CREATE SCHEMA adapter; CREATE JAVA ADAPTER SCRIPT jdbc_adapter AS %scriptclass com.exasol.adapter.jdbc.JdbcAdapter; - %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.13.1.jar; + %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.14.0.jar; %jar /buckets/bucketfs1/bucket1/hive_metastore.jar; %jar /buckets/bucketfs1/bucket1/hive_service.jar; diff --git a/doc/dialects/oracle.md b/doc/dialects/oracle.md index 2a8836105..4fb909238 100644 --- a/doc/dialects/oracle.md +++ b/doc/dialects/oracle.md @@ -32,7 +32,7 @@ CREATE JAVA ADAPTER SCRIPT adapter.jdbc_oracle AS // You need to replace `your-bucket-fs` and `your-bucket` to match the actual location // of the adapter jar. - %jar /buckets/your-bucket-fs/your-bucket/virtualschema-jdbc-adapter-dist-1.13.1.jar; + %jar /buckets/your-bucket-fs/your-bucket/virtualschema-jdbc-adapter-dist-1.14.0.jar; // Add the oracle jdbc driver to the classpath %jar /buckets/bucketfs1/bucket1/ojdbc7-12.1.0.2.jar diff --git a/doc/dialects/postgresql.md b/doc/dialects/postgresql.md index 508abb444..6ed909dba 100644 --- a/doc/dialects/postgresql.md +++ b/doc/dialects/postgresql.md @@ -15,7 +15,7 @@ CREATE OR REPLACE JAVA ADAPTER SCRIPT adapter.jdbc_adapter // This will add the adapter jar to the classpath so that it can be used inside the adapter script // Replace the names of the bucketfs and the bucket with the ones you used. - %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.13.1.jar; + %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.14.0.jar; // You have to add all files of the data source jdbc driver here (e.g. MySQL or Hive) %jar /buckets/bucketfs1/bucket1/postgresql-42.0.0.jar; diff --git a/doc/dialects/redshift.md b/doc/dialects/redshift.md index d3808a4e9..e4aa665b9 100644 --- a/doc/dialects/redshift.md +++ b/doc/dialects/redshift.md @@ -45,7 +45,7 @@ You install the adapter script via the special SQL command `CREATE JAVA ADAPTER ```sql CREATE OR REPLACE JAVA ADAPTER SCRIPT ADAPTER.JDBC_ADAPTER AS %scriptclass com.exasol.adapter.jdbc.JdbcAdapter; - %jar /buckets/bucketfs1/jdbc/virtualschema-jdbc-adapter-dist-1.13.1.jar; + %jar /buckets/bucketfs1/jdbc/virtualschema-jdbc-adapter-dist-1.14.0.jar; %jar /buckets/bucketfs1/jdbc/RedshiftJDBC42-.jar; / ``` diff --git a/doc/dialects/sql_server.md b/doc/dialects/sql_server.md index ddd436568..7794d17d8 100644 --- a/doc/dialects/sql_server.md +++ b/doc/dialects/sql_server.md @@ -17,7 +17,7 @@ CREATE OR REPLACE JAVA ADAPTER SCRIPT adapter.sql_server_jdbc_adapter // This will add the adapter jar to the classpath so that it can be used inside the adapter script // Replace the names of the bucketfs and the bucket with the ones you used. - %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.13.1.jar; + %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.14.0.jar; // You have to add all files of the data source jdbc driver here %jar /buckets/bucketfs1/bucket1/jtds.jar; diff --git a/doc/dialects/sybase.md b/doc/dialects/sybase.md index f8d87be46..edfb504d1 100644 --- a/doc/dialects/sybase.md +++ b/doc/dialects/sybase.md @@ -18,7 +18,7 @@ CREATE OR REPLACE JAVA ADAPTER SCRIPT adapter.jdbc_adapter AS %scriptclass com.exasol.adapter.jdbc.JdbcAdapter; - %jar /buckets/bucketfs1/virtualschema/virtualschema-jdbc-adapter-dist-1.13.1.jar; + %jar /buckets/bucketfs1/virtualschema/virtualschema-jdbc-adapter-dist-1.14.0.jar; %jar /buckets/bucketfs1/virtualschema/jtds-1.3.1.jar; / ``` diff --git a/doc/dialects/teradata.md b/doc/dialects/teradata.md index f19ec7fc8..b3064ec15 100644 --- a/doc/dialects/teradata.md +++ b/doc/dialects/teradata.md @@ -22,7 +22,7 @@ CREATE OR REPLACE JAVA ADAPTER SCRIPT adapter.jdbc_adapter // This will add the adapter jar to the classpath so that it can be used inside the adapter script // Replace the names of the bucketfs and the bucket with the ones you used. - %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.13.1.jar; + %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.14.0.jar; // You have to add all files of the data source jdbc driver here (e.g. MySQL or Hive) %jar /buckets/bucketfs1/bucket1/terajdbc4.jar; diff --git a/doc/user-guide/deploying_the_virtual_schema_adapter.md b/doc/user-guide/deploying_the_virtual_schema_adapter.md index 899f183bb..b47d30629 100644 --- a/doc/user-guide/deploying_the_virtual_schema_adapter.md +++ b/doc/user-guide/deploying_the_virtual_schema_adapter.md @@ -23,7 +23,7 @@ cd virtual-schemas/jdbc-adapter/ mvn clean -DskipTests package ``` -The resulting fat JAR is stored in `virtualschema-jdbc-adapter-dist/target/virtualschema-jdbc-adapter-dist-1.13.1.jar`. +The resulting fat JAR is stored in `virtualschema-jdbc-adapter-dist/target/virtualschema-jdbc-adapter-dist-1.14.0.jar`. ## Uploading the Adapter JAR Archive @@ -42,8 +42,8 @@ Following steps are required to upload a file to a bucket: 1. Now upload the file into this bucket, e.g. using curl (adapt the hostname, BucketFS port, bucket name and bucket write password). ```bash -curl -X PUT -T virtualschema-jdbc-adapter-dist/target/virtualschema-jdbc-adapter-dist-1.13.1.jar \ - http://w:write-password@your.exasol.host.com:2580/bucket1/virtualschema-jdbc-adapter-dist-1.13.1.jar +curl -X PUT -T virtualschema-jdbc-adapter-dist/target/virtualschema-jdbc-adapter-dist-1.14.0.jar \ + http://w:write-password@your.exasol.host.com:2580/bucket1/virtualschema-jdbc-adapter-dist-1.14.0.jar ``` See chapter 3.6.4. "The synchronous cluster file system BucketFS" in the EXASolution User Manual for more details about BucketFS. @@ -75,7 +75,7 @@ CREATE JAVA ADAPTER SCRIPT adapter.jdbc_adapter AS // This will add the adapter jar to the classpath so that it can be used inside the adapter script // Replace the names of the bucketfs and the bucket with the ones you used. - %jar /buckets/your-bucket-fs/your-bucket/virtualschema-jdbc-adapter-dist-1.13.1.jar; + %jar /buckets/your-bucket-fs/your-bucket/virtualschema-jdbc-adapter-dist-1.14.0.jar; // You have to add all files of the data source jdbc driver here (e.g. Hive JDBC driver files) %jar /buckets/your-bucket-fs/your-bucket/name-of-data-source-jdbc-driver.jar; diff --git a/doc/user-guide/dialects/db2.md b/doc/user-guide/dialects/db2.md index a9f2e7de4..35a8e4dd0 100644 --- a/doc/user-guide/dialects/db2.md +++ b/doc/user-guide/dialects/db2.md @@ -46,7 +46,7 @@ CREATE or replace JAVA ADAPTER SCRIPT adapter.jdbc_adapter AS // This will add the adapter jar to the classpath so that it can be used inside the adapter script // Replace the names of the bucketfs and the bucket with the ones you used. - %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.13.1.jar; + %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.14.0.jar; // DB2 Driver files %jar /buckets/bucketfs1/bucket1/db2jcc4.jar; diff --git a/doc/user-guide/dialects/exasol.md b/doc/user-guide/dialects/exasol.md index e867f806f..7ecd7c13d 100644 --- a/doc/user-guide/dialects/exasol.md +++ b/doc/user-guide/dialects/exasol.md @@ -17,7 +17,7 @@ After uploading the adapter jar, the adapter script can be created as follows: CREATE SCHEMA adapter; CREATE JAVA ADAPTER SCRIPT adapter.jdbc_adapter AS %scriptclass com.exasol.adapter.jdbc.JdbcAdapter; - %jar /buckets/your-bucket-fs/your-bucket/virtualschema-jdbc-adapter-dist-1.13.1.jar; + %jar /buckets/your-bucket-fs/your-bucket/virtualschema-jdbc-adapter-dist-1.14.0.jar; / ``` diff --git a/doc/user-guide/dialects/hive.md b/doc/user-guide/dialects/hive.md index 6f9bf65b0..2b637b28c 100644 --- a/doc/user-guide/dialects/hive.md +++ b/doc/user-guide/dialects/hive.md @@ -23,7 +23,7 @@ CREATE SCHEMA adapter; CREATE JAVA ADAPTER SCRIPT jdbc_adapter AS %scriptclass com.exasol.adapter.jdbc.JdbcAdapter; - %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.13.1.jar; + %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.14.0.jar; %jar /buckets/bucketfs1/bucket1/HiveJDBC41.jar; / diff --git a/doc/user-guide/dialects/impala.md b/doc/user-guide/dialects/impala.md index 0e98c93af..d472d61c6 100644 --- a/doc/user-guide/dialects/impala.md +++ b/doc/user-guide/dialects/impala.md @@ -22,7 +22,7 @@ CREATE SCHEMA adapter; CREATE JAVA ADAPTER SCRIPT jdbc_adapter AS %scriptclass com.exasol.adapter.jdbc.JdbcAdapter; - %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.13.1.jar; + %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.14.0.jar; %jar /buckets/bucketfs1/bucket1/hive_metastore.jar; %jar /buckets/bucketfs1/bucket1/hive_service.jar; diff --git a/doc/user-guide/dialects/oracle.md b/doc/user-guide/dialects/oracle.md index 2a8836105..4fb909238 100644 --- a/doc/user-guide/dialects/oracle.md +++ b/doc/user-guide/dialects/oracle.md @@ -32,7 +32,7 @@ CREATE JAVA ADAPTER SCRIPT adapter.jdbc_oracle AS // You need to replace `your-bucket-fs` and `your-bucket` to match the actual location // of the adapter jar. - %jar /buckets/your-bucket-fs/your-bucket/virtualschema-jdbc-adapter-dist-1.13.1.jar; + %jar /buckets/your-bucket-fs/your-bucket/virtualschema-jdbc-adapter-dist-1.14.0.jar; // Add the oracle jdbc driver to the classpath %jar /buckets/bucketfs1/bucket1/ojdbc7-12.1.0.2.jar diff --git a/doc/user-guide/dialects/postgresql.md b/doc/user-guide/dialects/postgresql.md index 508abb444..6ed909dba 100644 --- a/doc/user-guide/dialects/postgresql.md +++ b/doc/user-guide/dialects/postgresql.md @@ -15,7 +15,7 @@ CREATE OR REPLACE JAVA ADAPTER SCRIPT adapter.jdbc_adapter // This will add the adapter jar to the classpath so that it can be used inside the adapter script // Replace the names of the bucketfs and the bucket with the ones you used. - %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.13.1.jar; + %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.14.0.jar; // You have to add all files of the data source jdbc driver here (e.g. MySQL or Hive) %jar /buckets/bucketfs1/bucket1/postgresql-42.0.0.jar; diff --git a/doc/user-guide/dialects/redshift.md b/doc/user-guide/dialects/redshift.md index 4c31af209..d5826286c 100644 --- a/doc/user-guide/dialects/redshift.md +++ b/doc/user-guide/dialects/redshift.md @@ -21,7 +21,7 @@ CREATE OR REPLACE JAVA ADAPTER SCRIPT adapter.jdbc_adapter // This will add the adapter jar to the classpath so that it can be used inside the adapter script // Replace the names of the bucketfs and the bucket with the ones you used. - %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.13.1.jar; + %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.14.0.jar; // You have to add all files of the data source jdbc driver here (e.g. MySQL or Hive) diff --git a/doc/user-guide/dialects/sql_server.md b/doc/user-guide/dialects/sql_server.md index ddd436568..7794d17d8 100644 --- a/doc/user-guide/dialects/sql_server.md +++ b/doc/user-guide/dialects/sql_server.md @@ -17,7 +17,7 @@ CREATE OR REPLACE JAVA ADAPTER SCRIPT adapter.sql_server_jdbc_adapter // This will add the adapter jar to the classpath so that it can be used inside the adapter script // Replace the names of the bucketfs and the bucket with the ones you used. - %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.13.1.jar; + %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.14.0.jar; // You have to add all files of the data source jdbc driver here %jar /buckets/bucketfs1/bucket1/jtds.jar; diff --git a/doc/user-guide/dialects/sybase.md b/doc/user-guide/dialects/sybase.md index f8d87be46..edfb504d1 100644 --- a/doc/user-guide/dialects/sybase.md +++ b/doc/user-guide/dialects/sybase.md @@ -18,7 +18,7 @@ CREATE OR REPLACE JAVA ADAPTER SCRIPT adapter.jdbc_adapter AS %scriptclass com.exasol.adapter.jdbc.JdbcAdapter; - %jar /buckets/bucketfs1/virtualschema/virtualschema-jdbc-adapter-dist-1.13.1.jar; + %jar /buckets/bucketfs1/virtualschema/virtualschema-jdbc-adapter-dist-1.14.0.jar; %jar /buckets/bucketfs1/virtualschema/jtds-1.3.1.jar; / ``` diff --git a/doc/user-guide/dialects/teradata.md b/doc/user-guide/dialects/teradata.md index f19ec7fc8..b3064ec15 100644 --- a/doc/user-guide/dialects/teradata.md +++ b/doc/user-guide/dialects/teradata.md @@ -22,7 +22,7 @@ CREATE OR REPLACE JAVA ADAPTER SCRIPT adapter.jdbc_adapter // This will add the adapter jar to the classpath so that it can be used inside the adapter script // Replace the names of the bucketfs and the bucket with the ones you used. - %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.13.1.jar; + %jar /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.14.0.jar; // You have to add all files of the data source jdbc driver here (e.g. MySQL or Hive) %jar /buckets/bucketfs1/bucket1/terajdbc4.jar; diff --git a/jdbc-adapter/integration-test-data/integration-test-db2.yaml b/jdbc-adapter/integration-test-data/integration-test-db2.yaml index 5ca847b49..156eaa551 100644 --- a/jdbc-adapter/integration-test-data/integration-test-db2.yaml +++ b/jdbc-adapter/integration-test-data/integration-test-db2.yaml @@ -5,7 +5,7 @@ general: debugAddress: '192.168.0.12:3000' # Address which will be defined as DEBUG_ADDRESS in the virtual schemas bucketFsUrl: http://exasol-host:2580/bucket1 bucketFsPassword: bucket1 - jdbcAdapterPath: /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.13.1.jar + jdbcAdapterPath: /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.14.0.jar exasol: runIntegrationTests: true diff --git a/jdbc-adapter/integration-test-data/integration-test-sample.yaml b/jdbc-adapter/integration-test-data/integration-test-sample.yaml index 1e1d91159..2c9d24e86 100644 --- a/jdbc-adapter/integration-test-data/integration-test-sample.yaml +++ b/jdbc-adapter/integration-test-data/integration-test-sample.yaml @@ -5,7 +5,7 @@ general: debugAddress: '192.168.0.12:3000' # Address which will be defined as DEBUG_ADDRESS in the virtual schemas bucketFsUrl: http://exasol-host:2580/bucket1 bucketFsPassword: bucket1 - jdbcAdapterPath: /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.13.1.jar + jdbcAdapterPath: /buckets/bucketfs1/bucket1/virtualschema-jdbc-adapter-dist-1.14.0.jar exasol: runIntegrationTests: true diff --git a/jdbc-adapter/integration-test-data/integration-test-travis.yaml b/jdbc-adapter/integration-test-data/integration-test-travis.yaml index b7316a072..c24903f69 100644 --- a/jdbc-adapter/integration-test-data/integration-test-travis.yaml +++ b/jdbc-adapter/integration-test-data/integration-test-travis.yaml @@ -4,7 +4,7 @@ general: debug: false debugAddress: '' bucketFsUrl: http://127.0.0.1:6594/default - jdbcAdapterPath: /buckets/bfsdefault/default/virtualschema-jdbc-adapter-dist-1.13.1.jar + jdbcAdapterPath: /buckets/bfsdefault/default/virtualschema-jdbc-adapter-dist-1.14.0.jar additionalJDBCDriverDir: /vagrant/drivers/ exasol: diff --git a/jdbc-adapter/local/integration-test-config.yaml b/jdbc-adapter/local/integration-test-config.yaml index 3dcfeb428..fb1f2c499 100644 --- a/jdbc-adapter/local/integration-test-config.yaml +++ b/jdbc-adapter/local/integration-test-config.yaml @@ -5,7 +5,7 @@ general: debugAddress: '10.44.1.228:3000' # Address which will be defined as DEBUG_ADDRESS in the virtual schemas bucketFsUrl: http://localhost:2580/jars bucketFsPassword: public - jdbcAdapterPath: /buckets/bfsdefault/jars/virtualschema-jdbc-adapter-dist-1.13.1.jar + jdbcAdapterPath: /buckets/bfsdefault/jars/virtualschema-jdbc-adapter-dist-1.14.0.jar exasol: runIntegrationTests: true diff --git a/jdbc-adapter/pom.xml b/jdbc-adapter/pom.xml index b8d1ab538..2e83babec 100644 --- a/jdbc-adapter/pom.xml +++ b/jdbc-adapter/pom.xml @@ -10,7 +10,7 @@ virtualschema-jdbc-adapter-dist - 1.13.1 + 1.14.0 UTF-8 UTF-8 1.8 diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/postgresql/PostgreSQLSqlDialect.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/postgresql/PostgreSQLSqlDialect.java index 687a8886e..befe81041 100644 --- a/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/postgresql/PostgreSQLSqlDialect.java +++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/main/java/com/exasol/adapter/dialects/postgresql/PostgreSQLSqlDialect.java @@ -40,7 +40,8 @@ public Capabilities getCapabilities() { final Capabilities.Builder builder = Capabilities.builder(); builder.addMain(SELECTLIST_PROJECTION, SELECTLIST_EXPRESSIONS, FILTER_EXPRESSIONS, AGGREGATE_SINGLE_GROUP, AGGREGATE_GROUP_BY_COLUMN, AGGREGATE_GROUP_BY_EXPRESSION, AGGREGATE_GROUP_BY_TUPLE, AGGREGATE_HAVING, - ORDER_BY_COLUMN, ORDER_BY_EXPRESSION, LIMIT, LIMIT_WITH_OFFSET); + ORDER_BY_COLUMN, ORDER_BY_EXPRESSION, LIMIT, LIMIT_WITH_OFFSET, JOIN, JOIN_TYPE_INNER, + JOIN_TYPE_LEFT_OUTER, JOIN_TYPE_RIGHT_OUTER, JOIN_TYPE_FULL_OUTER, JOIN_CONDITION_EQUI); builder.addPredicate(AND, OR, NOT, EQUAL, NOTEQUAL, LESS, LESSEQUAL, LIKE, LIKE_ESCAPE, BETWEEN, REGEXP_LIKE, IN_CONSTLIST, IS_NULL, IS_NOT_NULL); builder.addLiteral(BOOL, NULL, DATE, TIMESTAMP, TIMESTAMP_UTC, DOUBLE, EXACTNUMERIC, STRING); diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/postgresql/PostgreSQLSqlDialectIT.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/postgresql/PostgreSQLSqlDialectIT.java index 65521de79..e36174797 100644 --- a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/postgresql/PostgreSQLSqlDialectIT.java +++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/postgresql/PostgreSQLSqlDialectIT.java @@ -5,6 +5,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertAll; import java.io.FileNotFoundException; import java.math.BigDecimal; @@ -231,51 +232,67 @@ void testSelectSingleColumn() throws SQLException { // Join Tests ------------------------------------------------------------- @Test - void innerJoin() throws SQLException { - final String query = String.format("SELECT * FROM %1$s.t1 a INNER JOIN %1$s.t2 b ON a.x=b.x", VIRTUAL_SCHEMA); + void testInnerJoin() throws SQLException { + final String query = "SELECT * FROM " + VIRTUAL_SCHEMA + ".t1 a INNER JOIN " + VIRTUAL_SCHEMA + + ".t2 b ON a.x=b.x"; final ResultSet result = executeQuery(query); - matchNextRow(result, (long) 2, "bbb", (long) 2, "bbb"); - assertFalse(result.next()); + assertAll(() -> matchNextRow(result, 2L, "bbb", 2L, "bbb"), () -> assertFalse(result.next())); } @Test - void innerJoinWithProjection() throws SQLException { - final String query = String - .format("SELECT b.y || %1$s.t1.y FROM %1$s.t1 INNER JOIN %1$s.t2 b ON %1$s.t1.x=b.x", VIRTUAL_SCHEMA); + void testInnerJoinWithProjection() throws SQLException { + final String query = "SELECT b.y || " + VIRTUAL_SCHEMA + ".t1.y FROM " + VIRTUAL_SCHEMA + ".t1 INNER JOIN " + + VIRTUAL_SCHEMA + ".t2 b ON " + VIRTUAL_SCHEMA + ".t1.x=b.x"; final ResultSet result = executeQuery(query); - matchNextRow(result, "bbbbbb"); - assertFalse(result.next()); + assertAll(() -> matchNextRow(result, "bbbbbb"), () -> assertFalse(result.next())); } @Test - void leftJoin() throws SQLException { - final String query = String - .format("SELECT * FROM %1$s.t1 a LEFT OUTER JOIN %1$s.t2 b ON a.x=b.x ORDER BY a.x", VIRTUAL_SCHEMA); + void testLeftJoin() throws SQLException { + final String query = "SELECT * FROM " + VIRTUAL_SCHEMA + ".t1 a LEFT OUTER JOIN " + VIRTUAL_SCHEMA + + ".t2 b ON a.x=b.x ORDER BY a.x"; final ResultSet result = executeQuery(query); - matchNextRow(result, (long) 1, "aaa", null, null); - matchNextRow(result, (long) 2, "bbb", (long) 2, "bbb"); - assertFalse(result.next()); + assertAll(() -> matchNextRow(result, 1L, "aaa", null, null), + () -> matchNextRow(result, 2L, "bbb", 2L, "bbb"), + () -> assertFalse(result.next())); } @Test - void rightJoin() throws SQLException { - final String query = String - .format("SELECT * FROM %1$s.t1 a RIGHT OUTER JOIN %1$s.t2 b ON a.x=b.x ORDER BY a.x", VIRTUAL_SCHEMA); + void testRightJoin() throws SQLException { + final String query = "SELECT * FROM " + VIRTUAL_SCHEMA + ".t1 a RIGHT OUTER JOIN " + VIRTUAL_SCHEMA + + ".t2 b ON a.x=b.x ORDER BY a.x"; final ResultSet result = executeQuery(query); - matchNextRow(result, (long) 2, "bbb", (long) 2, "bbb"); - matchNextRow(result, null, null, (long) 3, "ccc"); - assertFalse(result.next()); + assertAll(() -> matchNextRow(result, 2L, "bbb", 2L, "bbb"), + () -> matchNextRow(result, null, null, 3L, "ccc"), () -> assertFalse(result.next())); } @Test - void fullOuterJoin() throws SQLException { - final String query = String - .format("SELECT * FROM %1$s.t1 a FULL OUTER JOIN %1$s.t2 b ON a.x=b.x ORDER BY a.x", VIRTUAL_SCHEMA); + void testFullOuterJoin() throws SQLException { + final String query = "SELECT * FROM " + VIRTUAL_SCHEMA + ".t1 a FULL OUTER JOIN " + VIRTUAL_SCHEMA + + ".t2 b ON a.x=b.x ORDER BY a.x"; final ResultSet result = executeQuery(query); - matchNextRow(result, (long) 1, "aaa", null, null); - matchNextRow(result, (long) 2, "bbb", (long) 2, "bbb"); - matchNextRow(result, null, null, (long) 3, "ccc"); - assertFalse(result.next()); + assertAll(() -> matchNextRow(result, 1L, "aaa", null, null), + () -> matchNextRow(result, 2L, "bbb", 2L, "bbb"), + () -> matchNextRow(result, null, null, 3L, "ccc"), () -> assertFalse(result.next())); + } + + @Test + void testRightJoinWithComplexCondition() throws SQLException { + final String query = "SELECT * FROM " + VIRTUAL_SCHEMA + ".t1 a RIGHT OUTER JOIN " + VIRTUAL_SCHEMA + + ".t2 b ON a.x||a.y=b.x||b.y ORDER BY a.x"; + final ResultSet result = executeQuery(query); + assertAll(() -> matchNextRow(result, 2L, "bbb", 2L, "bbb"), + () -> matchNextRow(result, null, null, 3L, "ccc"), () -> assertFalse(result.next())); + } + + @Test + void testFullOuterJoinWithComplexCondition() throws SQLException { + final String query = "SELECT * FROM " + VIRTUAL_SCHEMA + ".t1 a FULL OUTER JOIN " + VIRTUAL_SCHEMA + + ".t2 b ON a.x-b.x=0 ORDER BY a.x"; + final ResultSet result = executeQuery(query); + assertAll(() -> matchNextRow(result, 1L, "aaa", null, null), + () -> matchNextRow(result, 2L, "bbb", 2L, "bbb"), + () -> matchNextRow(result, null, null, 3L, "ccc"), () -> assertFalse(result.next())); } // Identifier Test - CONVERT_TO_UPPER mode -------------------------------- @@ -606,4 +623,4 @@ private static void createPostgreSQLJDBCAdapter() throws SQLException, FileNotFo PostgreSQLIncludes.add(jdbcDriverPath); createJDBCAdapter(PostgreSQLIncludes); } -} \ No newline at end of file +} diff --git a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/postgresql/PostgreSQLSqlDialectTest.java b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/postgresql/PostgreSQLSqlDialectTest.java index c46a28684..714d14b66 100644 --- a/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/postgresql/PostgreSQLSqlDialectTest.java +++ b/jdbc-adapter/virtualschema-jdbc-adapter/src/test/java/com/exasol/adapter/dialects/postgresql/PostgreSQLSqlDialectTest.java @@ -46,7 +46,8 @@ void testGetCapabilities() { containsInAnyOrder(SELECTLIST_PROJECTION, SELECTLIST_EXPRESSIONS, FILTER_EXPRESSIONS, AGGREGATE_SINGLE_GROUP, AGGREGATE_GROUP_BY_COLUMN, AGGREGATE_GROUP_BY_EXPRESSION, AGGREGATE_GROUP_BY_TUPLE, AGGREGATE_HAVING, ORDER_BY_COLUMN, ORDER_BY_EXPRESSION, LIMIT, - LIMIT_WITH_OFFSET)), // + LIMIT_WITH_OFFSET, JOIN, JOIN_TYPE_INNER, JOIN_TYPE_LEFT_OUTER, JOIN_TYPE_RIGHT_OUTER, + JOIN_TYPE_FULL_OUTER, JOIN_CONDITION_EQUI)), () -> assertThat(capabilities.getLiteralCapabilities(), containsInAnyOrder(BOOL, NULL, DATE, TIMESTAMP, TIMESTAMP_UTC, DOUBLE, EXACTNUMERIC, STRING)), () -> assertThat(capabilities.getPredicateCapabilities(),