Skip to content
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
6 changes: 6 additions & 0 deletions plugin/trino-thrift/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.trino</groupId>
<artifactId>trino-tpch</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>testing</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,58 @@
package io.trino.plugin.thrift.integration;

import com.google.common.collect.ImmutableMap;
import io.trino.testing.AbstractTestIntegrationSmokeTest;
import io.trino.testing.BaseConnectorTest;
import io.trino.testing.MaterializedResult;
import io.trino.testing.QueryRunner;
import io.trino.testing.TestingConnectorBehavior;
import org.testng.annotations.Test;

import static io.trino.plugin.thrift.integration.ThriftQueryRunner.createThriftQueryRunner;
import static io.trino.spi.type.VarcharType.VARCHAR;
import static io.trino.testing.QueryAssertions.assertContains;

public class TestThriftIntegrationSmokeTest
// TODO extend BaseConnectorTest
extends AbstractTestIntegrationSmokeTest
public class TestThriftConnectorTest
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There probably needs to be provided an own implementation of io.trino.testing.BaseConnectorTest#hasBehavior method here due to the fact that this connector does not support all the operations tested in BaseConnectorTest.
Use io.trino.plugin.cassandra.TestCassandraConnectorTest#hasBehavior as a template.

Use io.trino.plugin.thrift.ThriftMetadata and io.trino.spi.connector.ConnectorMetadata to see what is possible in this connector.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There probably needs to be provided an own implementation of io.trino.testing.BaseConnectorTest#hasBehavior method here due to the fact that this connector does not support all the operations tested in BaseConnectorTest.
Use io.trino.plugin.cassandra.TestCassandraConnectorTest#hasBehavior as a template.

Thank you for the reviewed! I will do it。

Use io.trino.plugin.thrift.ThriftMetadata and io.trino.spi.connector.ConnectorMetadata to see what is possible in this connector.

Sorry,I don't understand it。Do you mean to test the functionality of ThriftMetadata?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry,I don't understand it。Do you mean to test the functionality of ThriftMetadata?

By checking the code of the previously mentioned classes, you'll be able to figure out what values of the io.trino.testing.TestingConnectorBehavior you can add to the hasBehavior method .

Note that these values control whether a test needs to be executed or not

        skipTestUnless(hasBehavior(SUPPORTS_CREATE_TABLE));

extends BaseConnectorTest
{
@Override
protected boolean hasBehavior(TestingConnectorBehavior connectorBehavior)
{
switch (connectorBehavior) {
case SUPPORTS_INSERT:
case SUPPORTS_INSERT_NOT_NULL_COLUMN:
return false;

case SUPPORTS_CREATE_TABLE:
case SUPPORTS_RENAME_TABLE:
case SUPPORTS_CREATE_TABLE_WITH_DATA:
return false;

case SUPPORTS_CREATE_SCHEMA:
case SUPPORTS_RENAME_SCHEMA:
return false;

case SUPPORTS_ADD_COLUMN:
case SUPPORTS_DROP_COLUMN:
case SUPPORTS_RENAME_COLUMN:
return false;

case SUPPORTS_COMMENT_ON_COLUMN:
case SUPPORTS_COMMENT_ON_TABLE:
return false;

case SUPPORTS_TOPN_PUSHDOWN:
return false;

default:
return super.hasBehavior(connectorBehavior);
}
}

@Override
protected QueryRunner createQueryRunner()
throws Exception
{
return createThriftQueryRunner(2, false, ImmutableMap.of());
return createThriftQueryRunner(3, false, ImmutableMap.of());
}

@Override
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import io.trino.plugin.thrift.ThriftPlugin;
import io.trino.plugin.thrift.server.ThriftIndexedTpchService;
import io.trino.plugin.thrift.server.ThriftTpchService;
import io.trino.plugin.tpch.TpchPlugin;
import io.trino.server.testing.TestingTrinoServer;
import io.trino.spi.Plugin;
import io.trino.split.PageSourceManager;
Expand Down Expand Up @@ -139,6 +140,9 @@ private static DistributedQueryRunner createThriftQueryRunnerInternal(List<Drift
.build();
queryRunner.createCatalog("thrift", "trino-thrift", connectorProperties);

queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");

return queryRunner;
}

Expand Down