Skip to content

Conversation

sc250072
Copy link

@sc250072 sc250072 commented Sep 7, 2025

Description

This PR introduces the Teradata connector, enabling Trino to
query and interact with Teradata data sources.

Key additions:

Implements the Teradata connector SPI with support for:
• Connection setup
• Schema retrieval
• SQL pushdown support
• Data type mapping
Adds integration tests against a Teradata ClearScape Analytics™ Experience instance to verify
connection, query execution, and result mapping.
Updates documentation under connectors to include usage
examples and configuration options.
This connector extends Trino’s ecosystem to support Teradata users, allowing them
to leverage Trino’s distributed query engine for federated queries.

Additional context and related issues

The Teradata connector module has both unit tests and integration tests.
The integration tests require access to a Teradata ClearScape Analytics™ Experience.
You can follow the steps below to run the integration tests locally.

Prerequisites

1. Create a new ClearScape Analytics™ Experience account

If you don't already have one, sign up at:

Teradata ClearScape Analytics™ Experience

2. Login

Sign in with your new account at:

ClearScape Analytics™ Experience Login

3. Collect the API Token

Use the Copy API Token button in the UI to retrieve your token.

4. Define the following environment variables

⚠️ Note: The Teradata database password must be at least 8 characters long.

export CLEARSCAPE_TOKEN=<API Token>
export CLEARSCAPE_PASSWORD=<Password for Teradata database (min 8 chars)>

Running Integration Tests

Once the environment variables are set, run the integration tests with:

⚠️ Note: Run the following command from the Trino parent directory.

./mvnw clean install -pl :trino-teradata

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
(x) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:

## Connectors
* Add Teradata connector. ({issue}`<issue-number-if-any>`)

Implements the Teradata connector SPI with support for:
• Connection setup
• Schema retrieval
• SQL pushdown support
• Data type mapping
Adds integration tests against a Teradata ClearScape Analytics™ Experience instance to verify
connection, query execution, and result mapping.
Updates documentation under connectors to include usage
examples and configuration options.
This connector extends Trino’s ecosystem to support Teradata users, allowing them
to leverage Trino’s distributed query engine for federated queries.
Copy link

cla-bot bot commented Sep 7, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@github-actions github-actions bot added the docs label Sep 7, 2025
@ebyhr
Copy link
Member

ebyhr commented Sep 9, 2025

The integration tests require access to a Teradata ClearScape Analytics™ Experience.

Is it free to use? Otherwise, who's responsible for CI expenses?

Removed not required tests
Copy link

cla-bot bot commented Sep 9, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@sc250072
Copy link
Author

sc250072 commented Sep 9, 2025

The integration tests require access to a Teradata ClearScape Analytics™ Experience.

Is it free to use? Otherwise, who's responsible for CI expenses?

It is free of use.

Copy link

cla-bot bot commented Sep 9, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

Fixed github error prone check issues
Copy link

cla-bot bot commented Sep 9, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@chenjian2664
Copy link
Contributor

Could you add a test that overrides BaseConnectorTest?

@sc250072
Copy link
Author

Could you add a test that overrides BaseConnectorTest?

https://github.com/trinodb/trino/pull/26574/files#diff-b3eb8fb41d01a2646e4f9dd43103edcdedf1140acbbadcd0cc5fd5d3377dbd5cR62 we have already added TeradataJdbcConnectorTest, which extends BaseJdbcConnectorTest, and in turn extends BaseConnectorTest.

Copy link

cla-bot bot commented Sep 12, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

Snowflake <connector/snowflake>
SQL Server <connector/sqlserver>
System <connector/system>
Teradata <connector/teradata>
Copy link
Member

@ebyhr ebyhr Sep 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update ci.yml so we can run tests on CI. You can ask maintainers to add secrets to this repository in Slack.

<img src="../_static/img/teradata.png" class="connector-logo">
```

The Teradata connector allows querying and creating tables in an external Teradata database.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrap at 80 characters. Same for other places.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in new PR #26731

- `TINYINT`
- `TINYINT`
-

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove redundant empty lines and fix indentation:

* - Teradata type
  - Trino type
  - Notes
* - `TINYINT`
  - `TINYINT`
  -
...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in new PR #26731

<parent>
<groupId>io.trino</groupId>
<artifactId>trino-root</artifactId>
<version>476</version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to 477-SNAPSHOT.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to 478-SNAPSHOT as per latest code of trino core

<packaging>trino-plugin</packaging>
<name>${project.artifactId}</name>
<description>Trino - Teradata connector</description>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enable compiler fail warnings:

    <properties>
        <air.compiler.fail-warnings>true</air.compiler.fail-warnings>
    </properties>

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in new PR #26731

public void testNumericAggregationPushdown()
{
if (!this.hasBehavior(TestingConnectorBehavior.SUPPORTS_AGGREGATION_PUSHDOWN)) {
Assertions.assertThat(this.query("SELECT min(nationkey) FROM nation")).isNotFullyPushedDown(AggregationNode.class);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static import assertThat method.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in new PR #26731

{
if (!this.hasBehavior(TestingConnectorBehavior.SUPPORTS_AGGREGATION_PUSHDOWN)) {
Assertions.assertThat(this.query("SELECT min(nationkey) FROM nation")).isNotFullyPushedDown(AggregationNode.class);
Assertions.assertThat(this.query("SELECT max(nationkey) FROM nation")).isNotFullyPushedDown(AggregationNode.class);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove redundant this..

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in new PR #26731


tableName = "test_ctas" + randomNameSuffix();
assertExplainAnalyze("EXPLAIN ANALYZE CREATE TABLE " + tableName + " AS SELECT name FROM nation");
assertQuery("SELECT * from " + tableName, "SELECT name FROM nation");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use assertThat(query(...)) instead.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in new PR #26731

import static io.trino.type.JsonType.JSON;
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;

public class TestTeradataJDBCTypeMapping
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to TestTeradataTypeMapping.

Also, please follow our test guideline. https://trino.io/docs/current/develop/tests.html#conventions-and-recommendations

  • Test classes should be defined as package-private and final.
  • Test methods should be defined as package-private.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in new PR #26731

@Test
public void testByteint()
{
SqlDataTypeTest.create().addRoundTrip("byteint", "0", TINYINT, "CAST(0 AS TINYINT)").addRoundTrip("byteint", "127", TINYINT, "CAST(127 AS TINYINT)").addRoundTrip("byteint", "-128", TINYINT, "CAST(-128 AS TINYINT)").addRoundTrip("byteint", "null", TINYINT, "CAST(null AS TINYINT)").execute(getQueryRunner(), teradataJDBCCreateAndInsert("byteint"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrap per round trip:

        SqlDataTypeTest.create()
                .addRoundTrip("byteint", "0", TINYINT, "CAST(0 AS TINYINT)")
                .addRoundTrip("byteint", "127", TINYINT, "CAST(127 AS TINYINT)")
...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in #26731

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants