Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Exasol connector #16202

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ jobs:
!:trino-docs,
!:trino-druid,
!:trino-elasticsearch,
!:trino-exasol,
!:trino-faulttolerant-tests,
!:trino-filesystem,
!:trino-filesystem-azure,
Expand Down Expand Up @@ -466,6 +467,7 @@ jobs:
- { modules: plugin/trino-delta-lake, profile: fte-tests }
- { modules: plugin/trino-druid }
- { modules: plugin/trino-elasticsearch }
- { modules: plugin/trino-exasol }
- { modules: plugin/trino-google-sheets }
- { modules: plugin/trino-hive }
- { modules: plugin/trino-hive, profile: fte-tests }
Expand Down Expand Up @@ -527,7 +529,7 @@ jobs:
timeout-minutes: 10
with:
cache: restore
cleanup-node: ${{ format('{0}', matrix.modules == 'plugin/trino-singlestore') }}
cleanup-node: ${{ format('{0}', matrix.modules == 'plugin/trino-singlestore' || matrix.modules == 'plugin/trino-exasol') }}
java-version: ${{ matrix.jdk != '' && matrix.jdk || '22' }}
- name: Maven Install
run: |
Expand Down
6 changes: 6 additions & 0 deletions core/trino-server/src/main/provisio/trino.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@
</artifact>
</artifactSet>

<artifactSet to="plugin/exasol">
<artifact id="${project.groupId}:trino-exasol:zip:${project.version}">
<unpack />
</artifact>
</artifactSet>

<artifactSet to="plugin/exchange-filesystem">
<artifact id="${project.groupId}:trino-exchange-filesystem:zip:${project.version}">
<unpack />
Expand Down
1 change: 1 addition & 0 deletions docs/src/main/sphinx/connector.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ ClickHouse <connector/clickhouse>
Delta Lake <connector/delta-lake>
Druid <connector/druid>
Elasticsearch <connector/elasticsearch>
Exasol <connector/exasol>
Google Sheets <connector/googlesheets>
Hive <connector/hive>
Hudi <connector/hudi>
Expand Down
195 changes: 195 additions & 0 deletions docs/src/main/sphinx/connector/exasol.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
---
myst:
substitutions:
default_domain_compaction_threshold: '`32`'
---

# Exasol connector

```{raw} html
<img src="../_static/img/exasol.png" class="connector-logo">
```

The Exasol connector allows querying an [Exasol](https://www.exasol.com/) database.

## Requirements

To connect to Exasol, you need:

* Exasol database version 7.1 or higher.
* Network access from the Trino coordinator and workers to Exasol.
Port 8563 is the default port.

## Configuration

To configure the Exasol connector as the ``example`` catalog, create a file
named ``example.properties`` in ``etc/catalog``. Include the following
connection properties in the file:

```text
connector.name=exasol
connection-url=jdbc:exa:exasol.example.com:8563
connection-user=user
connection-password=secret
```

The ``connection-url`` defines the connection information and parameters to pass
to the JDBC driver. See the
[Exasol JDBC driver documentation](https://docs.exasol.com/db/latest/connect_exasol/drivers/jdbc.htm#ExasolURL)
for more information.

The ``connection-user`` and ``connection-password`` are typically required and
determine the user credentials for the connection, often a service user. You can
use {doc}`secrets </security/secrets>` to avoid using actual values in catalog
properties files.

:::{note}
If your Exasol database uses a self-signed TLS certificate you must
specify the certificate's fingerprint in the JDBC URL using parameter
``fingerprint``, e.g.: ``jdbc:exa:exasol.example.com:8563;fingerprint=ABC123``.
:::

```{include} jdbc-authentication.fragment
```

```{include} jdbc-common-configurations.fragment
```

```{include} jdbc-domain-compaction-threshold.fragment
```

```{include} jdbc-case-insensitive-matching.fragment
```

(exasol-type-mapping)=
## Type mapping

Because Trino and Exasol each support types that the other does not, this
connector {ref}`modifies some types <type-mapping-overview>` when reading data.
Data types may not map the same way in both directions between
Trino and the data source. Refer to the following sections for type mapping in
each direction.

### Exasol to Trino type mapping

Trino supports selecting Exasol database types. This table shows the Exasol to
Trino data type mapping:

```{eval-rst}
.. list-table:: Exasol to Trino type mapping
:widths: 25, 25, 50
:header-rows: 1

* - Exasol database type
kaklakariada marked this conversation as resolved.
Show resolved Hide resolved
- Trino type
- Notes
* - ``BOOLEAN``
- ``BOOLEAN``
-
* - ``DOUBLE PRECISION``
- ``REAL``
-
* - ``DECIMAL(p, s)``
- ``DECIMAL(p, s)``
- See :ref:`exasol-number-mapping`
* - ``CHAR(n)``
- ``CHAR(n)``
-
* - ``VARCHAR(n)``
- ``VARCHAR(n)``
-
* - ``DATE``
- ``DATE``
-
```

No other types are supported.

(exasol-number-mapping)=
### Mapping numeric types

An Exasol `DECIMAL(p, s)` maps to Trino's `DECIMAL(p, s)` and vice versa
except in these conditions:

- No precision is specified for the column (example: `DECIMAL` or
`DECIMAL(*)`).
- Scale (`s`) is greater than precision.
- Precision (`p`) is greater than 36.
- Scale is negative.

(exasol-character-mapping)=
### Mapping character types

Trino's `VARCHAR(n)` maps to `VARCHAR(n)` and vice versa if `n` is no greater
than 2000000. Exasol does not support longer values.
If no length is specified, the connector uses 2000000.

Trino's `CHAR(n)` maps to `CHAR(n)` and vice versa if `n` is no greater than 2000.
Exasol does not support longer values.

```{include} jdbc-type-mapping.fragment
```

(exasol-sql-support)=
## SQL support

The connector provides {ref}`globally available <sql-globally-available>` and
{ref}`read operation <sql-read-operations>` statements to access data and
metadata in the Exasol database.

## Table functions

The connector provides specific {doc}`table functions </functions/table>` to
access Exasol.

(exasol-query-function)=
### `query(varchar) -> table`

The `query` function allows you to query the underlying database directly. It
requires syntax native to Exasol, because the full query is pushed down and
processed in Exasol. This can be useful for accessing native features which are
not available in Trino or for improving query performance in situations where
running a query natively may be faster.

```{include} query-passthrough-warning.fragment
```

As a simple example, query the `example` catalog and select an entire table::

```sql
SELECT
*
FROM
TABLE(
example.system.query(
query => 'SELECT
*
FROM
tpch.nation'
)
);
```

As a practical example, you can use the
[WINDOW clause from Exasol](https://docs.exasol.com/db/latest/sql_references/functions/analyticfunctions.htm#AnalyticFunctions):

```sql
SELECT
*
FROM
TABLE(
example.system.query(
query => 'SELECT
id, department, hire_date, starting_salary,
AVG(starting_salary) OVER w2 AVG,
MIN(starting_salary) OVER w2 MIN_STARTING_SALARY,
MAX(starting_salary) OVER (w1 ORDER BY hire_date)
FROM employee_table
WINDOW w1 as (PARTITION BY department), w2 as (w1 ORDER BY hire_date)
ORDER BY department, hire_date'
)
);
```

```{include} query-table-function-ordering.fragment
```
Binary file added docs/src/main/sphinx/static/img/exasol.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading