Skip to content

Commit

Permalink
#47: Fixed wrong data type for double literals (#48)
Browse files Browse the repository at this point in the history
* #47: Fixed wrong data type for double literals

Co-authored-by: Muhammet Orazov <[email protected]>
  • Loading branch information
jakobbraun and morazow authored Mar 18, 2021
1 parent 759b900 commit bdaca27
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 16 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/broken_links_checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Broken Links Checker

on:
schedule:
- cron: "0 5 * * *"
push:

jobs:
linkChecker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: lychee Link Checker
id: lc
uses: lycheeverse/lychee-action@v1
- name: Fail if there were link errors
run: exit ${{ steps.lc.outputs.exit_code }}
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Exasol Virtual Schema
# Exasol Virtual Schema

[![Build Status](https://travis-ci.com/exasol/exasol-virtual-schema.svg?branch=master)](https://travis-ci.com/exasol/exasol-virtual-schema)
[![Maven Central](https://img.shields.io/maven-central/v/com.exasol/exasol-virtual-schema)](https://search.maven.org/artifact/com.exasol/exasol-virtual-schema)
Expand All @@ -17,8 +17,7 @@ SonarCloud results:
[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=com.exasol%3Aexasol-virtual-schema&metric=duplicated_lines_density)](https://sonarcloud.io/dashboard?id=com.exasol%3Aexasol-virtual-schema)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=com.exasol%3Aexasol-virtual-schema&metric=ncloc)](https://sonarcloud.io/dashboard?id=com.exasol%3Aexasol-virtual-schema)

This project contains the Exasol dialect for the Exasol's Virtual Schema.
Use this dialect if you want to create a Virtual Schema based on the Exasol database.
This project contains the Exasol dialect for the Exasol's Virtual Schema. Use this dialect if you want to create a Virtual Schema based on the Exasol database.

If you want to set up a Virtual Schema for a different database system, please head over to the [Virtual Schemas Repository][virtual-schemas].

Expand All @@ -42,7 +41,7 @@ It takes the name of a connection definition in case you are using `IMPORT FROM

Find all the documentation in the [Virtual Schemas project][vs-doc].

## Information for Developers
## Information for Developers

* [Virtual Schema API Documentation][vs-api]

Expand All @@ -65,7 +64,6 @@ Running the Virtual Schema requires a Java Runtime version 11 or later.
| [Testcontainers](https://www.testcontainers.org/) | Container-based integration tests | MIT License |
| [SLF4J](http://www.slf4j.org/) | Logging facade | MIT License |


### Maven Plug-ins

| Plug-in | Purpose | License |
Expand All @@ -84,6 +82,7 @@ Running the Virtual Schema requires a Java Runtime version 11 or later.
| [Versions Maven Plugin][versions-maven-plugin] | Checking if dependencies updates are available | Apache License 2.0 |
| [Test Database Builder][test-db-builder] | Fluent database interfaces for testing | MIT License |

<!-- @formatter:off -->
[artifact-ref-checker-plugin]: https://github.com/exasol/artifact-reference-checker-maven-plugin
[exasol-jdbc-driver]: https://www.exasol.com/portal/display/DOWNLOAD/Exasol+Download+Section
[maven-compiler-plugin]: https://maven.apache.org/plugins/maven-compiler-plugin/
Expand All @@ -95,11 +94,11 @@ Running the Virtual Schema requires a Java Runtime version 11 or later.
[maven-source-plugin]: https://maven.apache.org/plugins/maven-source-plugin/
[maven-surefire-plugin]: https://maven.apache.org/surefire/maven-surefire-plugin/
[sonatype-oss-index-maven-plugin]: https://sonatype.github.io/ossindex-maven/maven-plugin/
[test-db-builder]: https://github.com/exasol/test-db-builder/
[test-db-builder]: https://github.com/exasol/test-db-builder-java
[versions-maven-plugin]: https://www.mojohaus.org/versions-maven-plugin/
[virtual-schema-common-jdbc]: https://github.com/exasol/virtual-schema-common-jdbc

[user-guide]: https://docs.exasol.com/database_concepts/virtual_schemas.htm
[virtual-schemas]: https://github.com/exasol/virtual-schemas
[vs-api]: https://github.com/exasol/virtual-schema-common-java/blob/master/doc/development/api/virtual_schema_api.md
[vs-doc]: https://github.com/exasol/virtual-schemas/tree/master/doc
<!-- @formatter:on -->
1 change: 1 addition & 0 deletions doc/changes/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Changes

* [5.0.1](changes_5.0.1.md)
* [5.0.0](changes_5.0.0.md)
* [4.0.0](changes_4.0.0.md)
* [3.1.0](changes_3.1.0.md)
Expand Down
25 changes: 25 additions & 0 deletions doc/changes/changes_5.0.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Exasol Virtual Schema Common 5.0.1, released 2021-03-18

Code name: Fixed double literals

## Summary

In this released we fixed double literals.

## Bugfixes:

* #47: Fixed wrong data type for double literals

## Dependency Updates

### Compile Dependency Updates

* Updated `com.exasol:virtual-schema-common-jdbc:9.0.1` to `9.0.2`

### Test Dependency Updates

* Updated `com.exasol:virtual-schema-common-jdbc:9.0.1` to `9.0.2`

### Plugin Dependency Updates

* Updated `com.exasol:project-keeper-maven-plugin:0.4.2` to `0.5.0`
2 changes: 1 addition & 1 deletion doc/dialects/exasol.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,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/<BFS service>/<bucket>/virtual-schema-dist-9.0.1-exasol-5.0.0.jar;
%jar /buckets/<BFS service>/<bucket>/virtual-schema-dist-9.0.2-exasol-5.0.1.jar;
/
```

Expand Down
6 changes: 3 additions & 3 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>exasol-virtual-schema</artifactId>
<version>5.0.0</version>
<version>5.0.1</version>
<name>Exasol Virtual Schema</name>
<description>This projects contains the Exasol dialect for Exasol's Virtual Schema</description>
<url>https://github.com/exasol/exasol-virtual-schema</url>
Expand All @@ -13,7 +13,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>11</java.version>
<surefire.and.failsafe.plugin.version>3.0.0-M3</surefire.and.failsafe.plugin.version>
<vscjdbc.version>9.0.1</vscjdbc.version>
<vscjdbc.version>9.0.2</vscjdbc.version>
<sonar.coverage.jacoco.xmlReportPaths>target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml
</sonar.coverage.jacoco.xmlReportPaths>
<gpg.skip>true</gpg.skip>
Expand Down Expand Up @@ -156,7 +156,7 @@
<plugin>
<groupId>com.exasol</groupId>
<artifactId>project-keeper-maven-plugin</artifactId>
<version>0.4.2</version>
<version>0.5.0</version>
<executions>
<execution>
<goals>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.exasol.adapter.dialects.SqlDialect;
import com.exasol.adapter.dialects.rewriting.SqlGenerationContext;
import com.exasol.adapter.dialects.rewriting.SqlGenerationVisitor;
import com.exasol.adapter.sql.SqlLiteralDouble;
import com.exasol.adapter.sql.SqlLiteralTimestampUtc;
import com.exasol.errorreporting.ExaError;

Expand Down Expand Up @@ -44,4 +45,10 @@ public String visit(final SqlLiteralTimestampUtc literal) {
.parameter("switchParameter", EXASOL_TIMESTAMP_WITH_LOCAL_TIME_ZONE_SWITCH).toString());
}
}

@Override
public String visit(final SqlLiteralDouble literal) {
return "CAST(" + literal.getValue() + " AS DOUBLE)";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
import java.util.*;
import java.util.concurrent.TimeoutException;

import com.exasol.containers.ExasolDockerImageReference;
import org.hamcrest.Matcher;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.condition.*;
import org.junit.jupiter.api.condition.EnabledIf;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.ValueSource;
Expand All @@ -31,6 +30,7 @@
import com.exasol.bucketfs.Bucket;
import com.exasol.bucketfs.BucketAccessException;
import com.exasol.containers.ExasolContainer;
import com.exasol.containers.ExasolDockerImageReference;
import com.exasol.dbbuilder.dialects.*;
import com.exasol.dbbuilder.dialects.exasol.*;
import com.exasol.dbbuilder.dialects.exasol.AdapterScript.Language;
Expand Down Expand Up @@ -299,6 +299,22 @@ void testGeometryMapping() {
assertVirtualTableContents(table, table("VARCHAR").row("POINT (2 3)").matches());
}

@Test
void testDecimalLiteral() {
final Table table = createSingleColumnTable("BOOLEAN").insert(true);
this.virtualSchema = createVirtualSchema(this.sourceSchema);
assertVsQuery("SELECT 10.2 FROM " + getVirtualTableName(this.virtualSchema, table),
table("DECIMAL").row(BigDecimal.valueOf(10.2)).matches());
}

@Test
void testDoubleLiteral() {
final Table table = createSingleColumnTable("BOOLEAN").insert(true);
this.virtualSchema = createVirtualSchema(this.sourceSchema);
assertVsQuery("SELECT CAST(10.2 as DOUBLE) FROM " + getVirtualTableName(this.virtualSchema, table),
table("DOUBLE PRECISION").row(10.2).matches());
}

@Test
void testIdentifierCaseSensitivityOnTable() {
Schema mixedCaseSchema = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;

import com.exasol.adapter.sql.SqlLiteralDouble;
import com.exasol.adapter.sql.SqlLiteralTimestampUtc;

@ExtendWith(MockitoExtension.class)
Expand All @@ -32,10 +33,17 @@ void testVisitSqlLiteralTimestampUtc() {
when(this.exasolSqlDialect.isTimestampWithLocalTimeZoneEnabled()).thenReturn(true);
final String value = "2015-12-01 12:01:01.1234";
when(this.exasolSqlDialect.getStringLiteral(value)).thenReturn("'" + value + "'");
final ExasolSqlGenerationVisitor exasolSqlGenerationVisitor =
new ExasolSqlGenerationVisitor(this.exasolSqlDialect, null);
final ExasolSqlGenerationVisitor exasolSqlGenerationVisitor = new ExasolSqlGenerationVisitor(
this.exasolSqlDialect, null);
final SqlLiteralTimestampUtc sqlLiteralTimestampUtc = new SqlLiteralTimestampUtc(value);
assertThat(exasolSqlGenerationVisitor.visit(sqlLiteralTimestampUtc),
equalTo("TIMESTAMP '2015-12-01 12:01:01.1234'"));
}

@Test
void testVisitSqlLiteralDouble() {
final ExasolSqlGenerationVisitor exasolSqlGenerationVisitor = new ExasolSqlGenerationVisitor(
this.exasolSqlDialect, null);
assertThat(exasolSqlGenerationVisitor.visit(new SqlLiteralDouble(1.23)), equalTo("CAST(1.23 AS DOUBLE)"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

public final class IntegrationTestConfiguration {
private static final String DEFAULT_DOCKER_DB_REFERENCE = "7.0.7";
public static final String VIRTUAL_SCHEMAS_JAR_NAME_AND_VERSION = "virtual-schema-dist-9.0.1-exasol-5.0.0.jar";
public static final String VIRTUAL_SCHEMAS_JAR_NAME_AND_VERSION = "virtual-schema-dist-9.0.2-exasol-5.0.1.jar";
public static final Path PATH_TO_VIRTUAL_SCHEMAS_JAR = Path.of("target", VIRTUAL_SCHEMAS_JAR_NAME_AND_VERSION);

private IntegrationTestConfiguration() {
Expand Down

0 comments on commit bdaca27

Please sign in to comment.