Skip to content

Commit

Permalink
#58: Updated to the new major version of virtual-schema-common-java. (#…
Browse files Browse the repository at this point in the history
…59)

* #58: Updated to the new major version of virtual-schema-common-java.
Co-authored-by: Sebastian Bär <sebastian.baer@exasol.com>
  • Loading branch information
AnastasiiaSergienko authored Sep 29, 2020
1 parent 6e99960 commit 1e21338
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 50 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
name: Upload Release Asset
name: GitHub Release

on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true
upload_url:
description: 'Upload URL'
required: true
asset_name:
description: 'Asset file name'
required: true
asset_path:
description: 'Asset file path'
required: true

jobs:
build:
Expand All @@ -28,6 +31,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.inputs.upload_url }}
asset_path: ./target/virtual-schema-common-jdbc-${{ github.event.inputs.version }}.jar
asset_name: virtual-schema-common-jdbc-${{ github.event.inputs.version }}.jar
asset_path: ${{ github.event.inputs.asset_path }}
asset_name: ${{ github.event.inputs.asset_name }}
asset_content_type: application/java-archive
7 changes: 4 additions & 3 deletions doc/changes/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Changes

* [5.0.4](changes-5.0.4.md)
* [5.0.3](changes-5.0.3.md)
* [5.0.2](changes-5.0.2.md)
* [6.0.0](changes_6.0.0.md)
* [5.0.4](changes_5.0.4.md)
* [5.0.3](changes_5.0.3.md)
* [5.0.2](changes_5.0.2.md)
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions doc/changes/changes_6.0.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Virtual Schema Common JDBC 6.0.0, released 2020-09-30

Code name: Updated to virtual-schema-common-java 12.0.0

## Refactoring

* #58: Updated to the new major version of `virtual-schema-common-java`.


## Dependency updates

* Updated com.exasol:virtual-schema-common-java:jar:11.0.0 to version 12.0.0
* Updated org.junit.jupiter:junit-jupiter:jar:5.6.2 to version 5.7.0
* Updated nl.jqno.equalsverifier:equalsverifier:jar:3.4.1 to version 3.4.3
* Updated org.mockito:mockito-junit-jupiter:jar:3.4.6 to version 3.5.13
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.exasol</groupId>
<artifactId>virtual-schema-common-jdbc</artifactId>
<version>5.0.4</version>
<version>6.0.0</version>
<name>Virtual Schema Common JDBC</name>
<description>Common module for JDBC-based data access from Virtual Schemas.</description>
<url>https://github.com/exasol/virtual-schema-common-jdbc</url>
Expand Down Expand Up @@ -64,7 +64,7 @@
<dependency>
<groupId>com.exasol</groupId>
<artifactId>virtual-schema-common-java</artifactId>
<version>11.0.0</version>
<version>12.0.0</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
Expand All @@ -91,19 +91,19 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.6.2</version>
<version>5.7.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>nl.jqno.equalsverifier</groupId>
<artifactId>equalsverifier</artifactId>
<version>3.4.1</version>
<version>3.4.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>3.4.6</version>
<version>3.5.13</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,13 @@ public String visit(final SqlFunctionScalarCase function) throws AdapterExceptio
@Override
public String visit(final SqlFunctionScalarCast function) throws AdapterException {
final String expression = function.getArguments().get(0).accept(this);
return function.toSimpleSql() + "(" + expression + " AS " + function.getDataType() + ")";
return "CAST(" + expression + " AS " + function.getDataType() + ")";
}

@Override
public String visit(final SqlFunctionScalarExtract function) throws AdapterException {
final String expression = function.getArguments().get(0).accept(this);
return function.toSimpleSql() + "(" + function.getToExtract() + " FROM " + expression + ")";
return "EXTRACT(" + function.getToExtract() + " FROM " + expression + ")";
}

@Override
Expand Down Expand Up @@ -360,7 +360,11 @@ public String visit(final SqlFunctionScalarJsonValue function) throws AdapterExc

@Override
public String visit(final SqlLimit limit) {
return limit.toSimpleSql();
String query = "LIMIT " + limit.getLimit();
if (limit.getOffset() != 0) {
query += " OFFSET " + limit.getOffset();
}
return query;
}

@Override
Expand Down Expand Up @@ -489,18 +493,20 @@ public String visit(final SqlPredicateInConstList predicate) throws AdapterExcep

@Override
public String visit(final SqlPredicateIsJson function) throws AdapterException {
return visitSqlPredicateJson(function.getExpression(), function.toSimpleSql(), function.getTypeConstraint(),
return visitSqlPredicateJson(function.getExpression(), "IS JSON", function.getTypeConstraint(),
function.getKeyUniquenessConstraint());
}

// We remove KEYS keyword from the query, because Exasol database can't parse it correctly in some cases.
// According to the SQL standard, KEYS is optional.
private String visitSqlPredicateJson(final SqlNode expression, final String functionToSimpleSql,
private String visitSqlPredicateJson(final SqlNode expression, final String functionName,
final String typeConstraint, final String keyUniquenessConstraint) throws AdapterException {
final StringBuilder stringBuilder = new StringBuilder();
final String expressionString = expression.accept(this);
stringBuilder.append(expressionString);
stringBuilder.append(functionToSimpleSql);
stringBuilder.append(" ");
stringBuilder.append(functionName);
stringBuilder.append(" ");
stringBuilder.append(typeConstraint);
stringBuilder.append(" ");
stringBuilder.append(keyUniquenessConstraint.replace(" KEYS", ""));
Expand All @@ -509,7 +515,7 @@ private String visitSqlPredicateJson(final SqlNode expression, final String func

@Override
public String visit(final SqlPredicateIsNotJson function) throws AdapterException {
return visitSqlPredicateJson(function.getExpression(), function.toSimpleSql(), function.getTypeConstraint(),
return visitSqlPredicateJson(function.getExpression(), "IS NOT JSON", function.getTypeConstraint(),
function.getKeyUniquenessConstraint());
}

Expand Down
10 changes: 5 additions & 5 deletions src/test/java/com/exasol/adapter/dialects/SqlDialectTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ void testScalarFunctionAliases() throws AdapterException {
final SqlTable fromClause = new SqlTable("TEST", clicksMeta);
final SqlColumn col1 = new SqlColumn(1, clicksMeta.getColumns().get(0));
final SqlSelectList selectList = SqlSelectList
.createRegularSelectList(List.of(new SqlFunctionScalar(ScalarFunction.ABS, List.of(col1), false, false),
.createRegularSelectList(List.of(new SqlFunctionScalar(ScalarFunction.ABS, List.of(col1)),
new SqlFunctionScalar(ScalarFunction.ADD,
List.of(col1, new SqlLiteralExactnumeric(new BigDecimal(100))), true, false),
List.of(col1, new SqlLiteralExactnumeric(new BigDecimal(100)))),
new SqlFunctionScalar(ScalarFunction.SUB,
List.of(col1, new SqlLiteralExactnumeric(new BigDecimal(100))), true, false),
new SqlFunctionScalar(ScalarFunction.TO_CHAR, List.of(col1), true, false),
new SqlFunctionScalar(ScalarFunction.NEG, List.of(col1), false, false)));
List.of(col1, new SqlLiteralExactnumeric(new BigDecimal(100)))),
new SqlFunctionScalar(ScalarFunction.TO_CHAR, List.of(col1)),
new SqlFunctionScalar(ScalarFunction.NEG, List.of(col1))));
final SqlNode node = SqlStatementSelect.builder().selectList(selectList).fromClause(fromClause).build();

final String schemaName = "SCHEMA";
Expand Down
24 changes: 0 additions & 24 deletions src/test/java/com/exasol/adapter/sql/DummySqlStatement.java

This file was deleted.

0 comments on commit 1e21338

Please sign in to comment.