Skip to content

Commit

Permalink
Revert "Test against Pinot 1.1.0"
Browse files Browse the repository at this point in the history
The new TestPinotPreviousConnectorTest is too flaky.

This reverts commit d550260.
  • Loading branch information
ebyhr committed Sep 2, 2024
1 parent f0d416d commit 8994e73
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 181 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,138 @@
*/
package io.trino.plugin.pinot;

import io.trino.testing.BaseConnectorTest;
import io.trino.testing.MaterializedResult;
import io.trino.testing.QueryRunner;
import io.trino.testing.TestingConnectorBehavior;
import io.trino.testing.kafka.TestingKafka;
import org.intellij.lang.annotations.Language;
import org.junit.jupiter.api.Test;

import static io.trino.plugin.pinot.TestingPinotCluster.PINOT_LATEST_IMAGE_NAME;
import static io.trino.spi.type.VarcharType.VARCHAR;
import static io.trino.testing.MaterializedResult.resultBuilder;
import static org.assertj.core.api.Assertions.assertThat;

public class TestPinotConnectorTest
extends BasePinotConnectorTest
extends BaseConnectorTest
{
@Override
String serverVersionUnderTest()
protected QueryRunner createQueryRunner()
throws Exception
{
TestingKafka kafka = closeAfterClass(TestingKafka.createWithSchemaRegistry());
kafka.start();
TestingPinotCluster pinot = closeAfterClass(new TestingPinotCluster(PINOT_LATEST_IMAGE_NAME, kafka.getNetwork(), false));
pinot.start();

return PinotQueryRunner.builder()
.setKafka(kafka)
.setPinot(pinot)
.setInitialTables(REQUIRED_TPCH_TABLES)
.build();
}

@Override
protected boolean hasBehavior(TestingConnectorBehavior connectorBehavior)
{
return switch (connectorBehavior) {
case SUPPORTS_ADD_COLUMN,
SUPPORTS_ARRAY,
SUPPORTS_COMMENT_ON_COLUMN,
SUPPORTS_COMMENT_ON_TABLE,
SUPPORTS_CREATE_MATERIALIZED_VIEW,
SUPPORTS_CREATE_SCHEMA,
SUPPORTS_CREATE_TABLE,
SUPPORTS_CREATE_VIEW,
SUPPORTS_DELETE,
SUPPORTS_INSERT,
SUPPORTS_MERGE,
SUPPORTS_RENAME_COLUMN,
SUPPORTS_RENAME_TABLE,
SUPPORTS_ROW_TYPE,
SUPPORTS_SET_COLUMN_TYPE,
SUPPORTS_TOPN_PUSHDOWN,
SUPPORTS_UPDATE -> false;
default -> super.hasBehavior(connectorBehavior);
};
}

@Override // Override because updated_at_seconds column exists
protected MaterializedResult getDescribeOrdersResult()
{
return resultBuilder(getSession(), VARCHAR, VARCHAR, VARCHAR, VARCHAR)
.row("updated_at_seconds", "bigint", "", "")
.row("clerk", "varchar", "", "") // String columns are reported only as varchar
.row("comment", "varchar", "", "")
.row("custkey", "bigint", "", "") // Long columns are reported as bigint
.row("orderdate", "date", "", "")
.row("orderkey", "bigint", "", "")
.row("orderpriority", "varchar", "", "")
.row("orderstatus", "varchar", "", "")
.row("shippriority", "integer", "", "")
.row("totalprice", "double", "", "")
.build();
}

@Test
@Override // Override because updated_at_seconds column exists
public void testShowColumns()
{
assertThat(query("SHOW COLUMNS FROM orders")).result().matches(getDescribeOrdersResult());
}

@Test
@Override // Override because updated_at_seconds column exists
public void testSelectAll()
{
assertQuery("SELECT orderkey, custkey, orderstatus, totalprice, orderdate, orderpriority, clerk, shippriority, comment FROM orders");
}

@Override
protected @Language("SQL") String getOrdersTableWithColumns()
{
return """
VALUES
('orders', 'orderkey'),
('orders', 'custkey'),
('orders', 'orderstatus'),
('orders', 'totalprice'),
('orders', 'orderdate'),
('orders', 'updated_at_seconds'),
('orders', 'orderpriority'),
('orders', 'clerk'),
('orders', 'shippriority'),
('orders', 'comment')
""";
}

@Test
@Override // Override because updated_at_seconds column exists
public void testShowCreateTable()
{
assertThat(computeActual("SHOW CREATE TABLE orders").getOnlyValue())
.isEqualTo("""
CREATE TABLE pinot.default.orders (
clerk varchar,
comment varchar,
custkey bigint,
orderdate date,
orderkey bigint,
orderpriority varchar,
orderstatus varchar,
shippriority integer,
totalprice double,
updated_at_seconds bigint
)""");
}

@Test
@Override // Override because the regexp is different from the base test
public void testPredicateReflectedInExplain()
{
return PINOT_LATEST_IMAGE_NAME;
assertExplain(
"EXPLAIN SELECT name FROM nation WHERE nationkey = 42",
"columnName=nationkey", "dataType=bigint", "\\s\\{\\[42\\]\\}");
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ public class TestingPinotCluster
implements Closeable
{
public static final String PINOT_LATEST_IMAGE_NAME = "apachepinot/pinot:1.2.0";
public static final String PINOT_PREVIOUS_IMAGE_NAME = "apachepinot/pinot:1.1.0";
private static final String ZOOKEEPER_INTERNAL_HOST = "zookeeper";
private static final JsonCodec<List<String>> LIST_JSON_CODEC = listJsonCodec(String.class);
private static final JsonCodec<PinotSuccessResponse> PINOT_SUCCESS_RESPONSE_JSON_CODEC = jsonCodec(PinotSuccessResponse.class);
Expand Down

0 comments on commit 8994e73

Please sign in to comment.