Skip to content

Commit

Permalink
Feature/249 evaluate expected resultset datatype (#250)
Browse files Browse the repository at this point in the history
* #249 implemented 
remaining questions: see ticket #249 
Co-authored-by: Christoph Pirkl <[email protected]>
  • Loading branch information
ckunki authored Sep 9, 2022
1 parent db92c56 commit 332f400
Show file tree
Hide file tree
Showing 26 changed files with 870 additions and 160 deletions.
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
dependencies.md linguist-generated=true
doc/changes/changelog.md linguist-generated=true
pk_generated_parent.pom linguist-generated=true
.github/workflows/broken_links_checker.yml linguist-generated=true
.github/workflows/ci-build-next-java.yml linguist-generated=true
.github/workflows/ci-build.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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ venv/
*.orig
*.old
*.md.html
*.flattened-pom.xml
*.flattened-pom.xml
/.apt_generated/
/.apt_generated_tests/
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ This is one of the modules of Virtual Schemas Adapters. The libraries provided b

A Virtual Schema adapter is basically a [UDF](https://docs.exasol.com/database_concepts/udf_scripts.htm). The Exasol core database communicates with this UDF using JSON strings. There are different types of messages, that define the API for a virtual Schema adapter ([protocol reference](doc/development/api/virtual_schema_api.md)). This repository wraps this JSON API with a Java API to facilitate the implementation of Virtual Schema adapters in Java.

Please note that the artifact name changed from "virtualschema-common" to "virtual-schema-common-java". First to unify the naming schemes, second to make sure the new adapters do not accidentally use the old line of libraries.

## Information for Users

* [Changelog](doc/changes/changelog.md)
Expand Down
71 changes: 36 additions & 35 deletions dependencies.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions doc/changes/changelog.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions doc/changes/changes_16.0.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Common module of Exasol Virtual Schemas Adapters 16.0.0, released 2022-??-??

Code name: Evaluate expected resultset datatypes

## Summary

Starting with major version 8 Exasol database uses the capabilities reported by each virtual schema to provide select list data types for each push down request. Based on this information the JDBC virtual schemas no longer need to infer the data types of the result set by inspecting its values. Instead the JDBC virtual schemas can now use the information provided by the database.

This create a list of benefits
* Improved performance of queries to virtual schema by avoiding one query for each push down
* Enhanced accuracy of data type mapping
* Simplified data type mapping which is easier to extend
* Support for additional use cases

## Features

* #249: Evaluate expected resultset datatypes

## Dependency Updates

### Plugin Dependency Updates

* Updated `com.exasol:error-code-crawler-maven-plugin:1.1.1` to `1.1.2`
* Updated `com.exasol:project-keeper-maven-plugin:2.5.0` to `2.7.0`
* Updated `org.apache.maven.plugins:maven-enforcer-plugin:3.0.0` to `3.1.0`
2 changes: 1 addition & 1 deletion error_code_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ error-tags:
VSCOMJAVA:
packages:
- com.exasol
highest-index: 35
highest-index: 40
34 changes: 17 additions & 17 deletions pk_generated_parent.pom

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.exasol</groupId>
<artifactId>virtual-schema-common-java</artifactId>
<version>15.3.3</version>
<version>16.0.0</version>
<name>Common module of Exasol Virtual Schemas Adapters</name>
<description>This is one of the modules of Virtual Schemas Adapters. The libraries provided by this project are the
foundation of the adapter development, i.e. adapters must be implemented on top of them.</description>
Expand Down Expand Up @@ -89,7 +88,7 @@
<plugin>
<groupId>com.exasol</groupId>
<artifactId>project-keeper-maven-plugin</artifactId>
<version>2.5.0</version>
<version>2.7.0</version>
<executions>
<execution>
<goals>
Expand All @@ -103,7 +102,7 @@
<parent>
<artifactId>virtual-schema-common-java-generated-parent</artifactId>
<groupId>com.exasol</groupId>
<version>15.3.3</version>
<version>16.0.0</version>
<relativePath>pk_generated_parent.pom</relativePath>
</parent>
</project>
23 changes: 17 additions & 6 deletions src/main/java/com/exasol/adapter/request/PushDownRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,36 @@
import com.exasol.ExaMetadata;
import com.exasol.adapter.AdapterCallExecutor;
import com.exasol.adapter.AdapterException;
import com.exasol.adapter.metadata.SchemaMetadataInfo;
import com.exasol.adapter.metadata.TableMetadata;
import com.exasol.adapter.metadata.*;
import com.exasol.adapter.sql.SqlStatement;

/**
* This class represents a request that tells a Virtual Schema Adapter to push a SQL statement down to the external data
* source
* source.
*/
public class PushDownRequest extends AbstractAdapterRequest {
private final SqlStatement select;
private final List<TableMetadata> involvedTablesMetadata;
private final List<DataType> selectListDataTypes;

/**
* Create a new request of type {@link PushDownRequest}
* Create a new request of type {@link PushDownRequest}.
*
* @param schemaMetadataInfo schema metadata
* @param select SQL statement to be pushed down to the external data source
* @param involvedTablesMetadata tables involved in the push-down request
* @param selectListDataType expected data types for the result set
*/
public PushDownRequest(final SchemaMetadataInfo schemaMetadataInfo, final SqlStatement select,
final List<TableMetadata> involvedTablesMetadata) {
final List<TableMetadata> involvedTablesMetadata, final List<DataType> selectListDataType) {
super(schemaMetadataInfo, AdapterRequestType.PUSHDOWN);
this.select = select;
this.involvedTablesMetadata = involvedTablesMetadata;
this.selectListDataTypes = selectListDataType;
}

/**
* Get the <code>SELECT</code> statement that should be pushed down to the external data source
* Get the <code>SELECT</code> statement that should be pushed down to the external data source.
*
* @return <code>SELECT</code> statement
*/
Expand All @@ -49,6 +51,15 @@ public List<TableMetadata> getInvolvedTablesMetadata() {
return this.involvedTablesMetadata;
}

/**
* Get the expected data types for the result set.
*
* @return expected data types for the result set
*/
public List<DataType> getSelectListDataTypes() {
return this.selectListDataTypes;
}

@Override
public String executeWith(final AdapterCallExecutor adapterCallExecutor, final ExaMetadata metadata)
throws AdapterException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.Map.Entry;
import java.util.logging.Logger;

import com.exasol.errorreporting.ExaError;

Expand All @@ -17,7 +16,6 @@
* Abstract base class for parsers reading fragments of the Virtual Schema requests.
*/
class AbstractRequestParser {
private static final Logger LOGGER = Logger.getLogger(AbstractRequestParser.class.getName());

/**
* Create a JSON reader for raw request data.
Expand All @@ -36,7 +34,7 @@ protected JsonReader createJsonReader(final String rawRequest) {

/**
* Read the properties from the schema metadata.
*
*
* @param jsonSchemaMetadataInfo json schema metadata info
* @return parsed Properties.
*/
Expand Down Expand Up @@ -85,7 +83,6 @@ private void addProperty(final Map<String, String> properties, final Entry<Strin
+ "Supported types are strings, booleans, numbers and NULL.")
.parameter("type", type).toString());
}
LOGGER.finer(() -> "Parsed property: \"" + key + "\" = \"" + stringValue + "\"");
properties.put(key, stringValue);
}
}
Loading

0 comments on commit 332f400

Please sign in to comment.