Skip to content

Commit

Permalink
Remove redundant Iceberg product tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ebyhr committed Oct 7, 2024
1 parent c8ef468 commit 8fc7a2a
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 289 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,17 @@ public void testSelect()

assertThat(query("SELECT * FROM iceberg." + tpchSchema + ".region"))
.failure().hasMessageContaining("Not an Iceberg table");
assertThat(query("SELECT * FROM iceberg." + tpchSchema + ".\"region$data\""))
.failure().hasMessageMatching(".* Table .* does not exist");
assertThat(query("SELECT * FROM iceberg." + tpchSchema + ".\"region$files\""))
.failure().hasMessageMatching(".* Table .* does not exist");

assertThat(query("SELECT * FROM hive." + tpchSchema + ".nation"))
.failure().hasMessageContaining("Cannot query Iceberg table");
assertThat(query("SELECT * FROM hive." + tpchSchema + ".\"nation$partitions\""))
.failure().hasMessageMatching(".* Table .* does not exist");
assertThat(query("SELECT * FROM hive." + tpchSchema + ".\"nation$properties\""))
.failure().hasMessageMatching(".* Table .* does not exist");
}

@Test
Expand Down Expand Up @@ -87,6 +96,20 @@ public void testReadInformationSchema()
"('nation', 'nationkey'), ('nation', 'name'), ('nation', 'regionkey'), ('nation', 'comment')");
}

@Test
void testHiveSelectTableColumns()
{
assertThat(query("SELECT table_cat, table_schem, table_name, column_name FROM system.jdbc.columns WHERE table_cat = 'hive' AND table_schem = '" + tpchSchema + "' AND table_name = 'region'"))
.skippingTypesCheck()
.matches("VALUES " +
"('hive', '" + tpchSchema + "', 'region', 'regionkey')," +
"('hive', '" + tpchSchema + "', 'region', 'name')," +
"('hive', '" + tpchSchema + "', 'region', 'comment')");

// Hive does not show any information about tables with unsupported format
assertQueryReturnsEmptyResult("SELECT table_cat, table_schem, table_name, column_name FROM system.jdbc.columns WHERE table_cat = 'hive' AND table_schem = '" + tpchSchema + "' AND table_name = 'nation'");
}

@Test
public void testShowTables()
{
Expand Down Expand Up @@ -169,6 +192,34 @@ public void testTimeTravelWithRedirection()
}
}

@Test
void testIcebergCannotCreateTableNamesakeToHiveTable()
{
String tableName = "test_iceberg_create_namesake_hive_table_" + randomNameSuffix();
String hiveTableName = "hive.%s.%s".formatted(testSchema, tableName);
String icebergTableName = "iceberg.%s.%s".formatted(testSchema, tableName);

assertUpdate("CREATE TABLE " + hiveTableName + "(a bigint)");
assertThat(query("CREATE TABLE " + icebergTableName + "(a bigint)"))
.failure().hasMessageMatching(".* Table .* of unsupported type already exists");

assertUpdate("DROP TABLE " + hiveTableName);
}

@Test
void testHiveCannotCreateTableNamesakeToIcebergTable()
{
String tableName = "test_iceberg_create_namesake_hive_table_" + randomNameSuffix();
String hiveTableName = "hive.%s.%s".formatted(testSchema, tableName);
String icebergTableName = "iceberg.%s.%s".formatted(testSchema, tableName);

assertUpdate("CREATE TABLE " + icebergTableName + "(a bigint)");
assertThat(query("CREATE TABLE " + hiveTableName + "(a bigint)"))
.failure().hasMessageMatching(".* Table .* of unsupported type already exists");

assertUpdate("DROP TABLE " + icebergTableName);
}

@Test
public void testMigrateTable()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
package io.trino.tests.product.hudi;

import io.trino.tempto.ProductTest;
import io.trino.tests.product.iceberg.TestIcebergHiveTablesCompatibility;
import org.testng.annotations.Test;

import static io.trino.tempto.assertions.QueryAssert.Row.row;
Expand All @@ -30,7 +29,6 @@
* Tests interactions between Hudi and Hive connectors, when one tries to read a table created by the other.
*
* @see TestHudiHiveViewsCompatibility
* @see TestIcebergHiveTablesCompatibility
*/
public class TestHudiHiveTablesCompatibility
extends ProductTest
Expand Down Expand Up @@ -92,7 +90,7 @@ public void testHiveCannotCreateTableNamesakeToHudiTable()
String tableName = "test_hive_create_namesake_hudi_table_" + randomNameSuffix();
assertQueryFailure(() -> onTrino().executeQuery("CREATE TABLE hudi.default." + tableName + "(a bigint)"))
.hasMessageMatching("Query failed \\(#\\w+\\):\\Q This connector does not support creating tables");
// TODO implement test like TestIcebergHiveTablesCompatibility.testHiveCannotCreateTableNamesakeToIcebergTable when CREATE TABLE supported
// TODO implement test like BaseSharedMetastoreTest.testHiveCannotCreateTableNamesakeToIcebergTable when CREATE TABLE supported
}

@Test(groups = {HUDI, PROFILE_SPECIFIC_TESTS})
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
/**
* Tests interactions between Iceberg and Hive connectors, when one tries to read a view created by the other.
*
* @see TestIcebergHiveTablesCompatibility
* @see TestHudiHiveViewsCompatibility
*/
public class TestIcebergHiveViewsCompatibility
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class TestIcebergInsert
extends ProductTest
{
/**
* @see TestIcebergCreateTable#testCreateTable() See TestIcebergCreateTable for a non-concurrent INSERT test coverage.
* @see TestIcebergSparkCompatibility#testTrinoSparkConcurrentInsert()
*/
@Test(groups = {ICEBERG, STORAGE_FORMATS_DETAILED, HMS_ONLY}, timeOut = 60_000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
/**
* Tests interactions between Iceberg and Hive connectors, when one tries to read a table created by the other
* with redirects enabled.
*
* @see TestIcebergHiveTablesCompatibility
*/
public class TestIcebergRedirectionToHive
extends ProductTest
Expand Down
Loading

0 comments on commit 8fc7a2a

Please sign in to comment.