Search in sources :

Example 6 with Flaky

use of io.trino.testng.services.Flaky in project trino by trinodb.

the class TestHivePartitionsTable method testShowPartitionsFromHiveTable.

@Test(groups = HIVE_PARTITIONING)
@Flaky(issue = ERROR_COMMITTING_WRITE_TO_HIVE_ISSUE, match = ERROR_COMMITTING_WRITE_TO_HIVE_MATCH)
public void testShowPartitionsFromHiveTable() {
    String tableNameInDatabase = tablesState.get(PARTITIONED_TABLE).getNameInDatabase();
    String partitionsTable = "\"" + tableNameInDatabase + "$partitions\"";
    QueryResult partitionListResult;
    partitionListResult = onTrino().executeQuery("SELECT * FROM " + partitionsTable);
    assertThat(partitionListResult).containsExactlyInOrder(row(1), row(2));
    assertColumnNames(partitionListResult, "part_col");
    partitionListResult = onTrino().executeQuery(format("SELECT * FROM %s WHERE part_col = 1", partitionsTable));
    assertThat(partitionListResult).containsExactlyInOrder(row(1));
    assertColumnNames(partitionListResult, "part_col");
    assertQueryFailure(() -> onTrino().executeQuery(format("SELECT * FROM %s WHERE no_such_column = 1", partitionsTable))).hasMessageContaining("Column 'no_such_column' cannot be resolved");
    assertQueryFailure(() -> onTrino().executeQuery(format("SELECT * FROM %s WHERE col = 1", partitionsTable))).hasMessageContaining("Column 'col' cannot be resolved");
}
Also used : QueryResult(io.trino.tempto.query.QueryResult) Test(org.testng.annotations.Test) ProductTest(io.trino.tempto.ProductTest) Flaky(io.trino.testng.services.Flaky)

Example 7 with Flaky

use of io.trino.testng.services.Flaky in project trino by trinodb.

the class TestSyncPartitionMetadata method testMixedCasePartitionNames.

@Test(groups = { HIVE_PARTITIONING, SMOKE })
@Flaky(issue = ERROR_COMMITTING_WRITE_TO_HIVE_ISSUE, match = ERROR_COMMITTING_WRITE_TO_HIVE_MATCH)
public void testMixedCasePartitionNames() {
    String tableName = "test_sync_partition_mixed_case";
    prepare(hdfsClient, hdfsDataSourceWriter, tableName);
    String tableLocation = tableLocation(tableName);
    HiveDataSource dataSource = createResourceDataSource(tableName, "io/trino/tests/product/hive/data/single_int_column/data.orc");
    hdfsDataSourceWriter.ensureDataOnHdfs(tableLocation + "/col_x=h/col_Y=11", dataSource);
    hdfsClient.createDirectory(tableLocation + "/COL_X=UPPER/COL_Y=12");
    hdfsDataSourceWriter.ensureDataOnHdfs(tableLocation + "/COL_X=UPPER/COL_Y=12", dataSource);
    onTrino().executeQuery("CALL system.sync_partition_metadata('default', '" + tableName + "', 'FULL', false)");
    assertPartitions(tableName, row("UPPER", "12"), row("a", "1"), row("f", "9"), row("g", "10"), row("h", "11"));
    assertData(tableName, row(1, "a", "1"), row(42, "UPPER", "12"), row(42, "f", "9"), row(42, "g", "10"), row(42, "h", "11"));
}
Also used : HiveDataSource(io.trino.tempto.fulfillment.table.hive.HiveDataSource) ProductTest(io.trino.tempto.ProductTest) Test(org.testng.annotations.Test) Flaky(io.trino.testng.services.Flaky)

Example 8 with Flaky

use of io.trino.testng.services.Flaky in project trino by trinodb.

the class TestMemoryConnectorTest method testCustomMetricsScanOnly.

@Test
@Flaky(issue = "https://github.com/trinodb/trino/issues/8691", match = "ComparisonFailure: expected:<LongCount\\{total=\\[\\d+]}> but was:<(LongCount\\{total=\\[\\d+]}|null)>")
public void testCustomMetricsScanOnly() {
    Metrics metrics = collectCustomMetrics("SELECT partkey FROM part");
    assertThat(metrics.getMetrics().get("rows")).isEqualTo(new LongCount(PART_COUNT));
    assertThat(metrics.getMetrics().get("started")).isEqualTo(metrics.getMetrics().get("finished"));
    assertThat(((Count<?>) metrics.getMetrics().get("finished")).getTotal()).isGreaterThan(0);
}
Also used : Metrics(io.trino.spi.metrics.Metrics) LongCount(io.trino.plugin.base.metrics.LongCount) LongCount(io.trino.plugin.base.metrics.LongCount) Count(io.trino.spi.metrics.Count) Test(org.testng.annotations.Test) BaseConnectorTest(io.trino.testing.BaseConnectorTest) Flaky(io.trino.testng.services.Flaky)

Aggregations

Flaky (io.trino.testng.services.Flaky)8 Test (org.testng.annotations.Test)8 ProductTest (io.trino.tempto.ProductTest)4 QueryResult (io.trino.tempto.query.QueryResult)4 LongCount (io.trino.plugin.base.metrics.LongCount)2 Count (io.trino.spi.metrics.Count)2 Metrics (io.trino.spi.metrics.Metrics)2 HiveDataSource (io.trino.tempto.fulfillment.table.hive.HiveDataSource)2 BaseConnectorTest (io.trino.testing.BaseConnectorTest)2 ThriftHiveMetastoreClient (io.trino.plugin.hive.metastore.thrift.ThriftHiveMetastoreClient)1 TemporaryHiveTable (io.trino.tests.product.hive.util.TemporaryHiveTable)1 SkipException (org.testng.SkipException)1