diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 40aaa2275d98..8a7a44de8e7a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -525,7 +525,6 @@ jobs: - { modules: plugin/trino-hive, profile: test-parquet } - { modules: plugin/trino-hudi } - { modules: plugin/trino-iceberg } - - { modules: plugin/trino-iceberg, profile: additional-catalog-tests } - { modules: plugin/trino-iceberg, profile: cloud-tests } - { modules: plugin/trino-ignite } - { modules: plugin/trino-kafka } diff --git a/plugin/trino-iceberg/pom.xml b/plugin/trino-iceberg/pom.xml index 0ebbd2e4725e..fccff6cc8884 100644 --- a/plugin/trino-iceberg/pom.xml +++ b/plugin/trino-iceberg/pom.xml @@ -565,8 +565,6 @@ **/TestIcebergGlueCatalogSkipArchive.java **/TestIcebergGcsConnectorSmokeTest.java **/TestIcebergAbfsConnectorSmokeTest.java - io/trino/plugin/iceberg/catalog/jdbc/Test*.java - io/trino/plugin/iceberg/catalog/rest/Test*.java **/Test*FailureRecoveryTest.java @@ -592,24 +590,6 @@ - - additional-catalog-tests - - - - org.apache.maven.plugins - maven-surefire-plugin - - - **/io/trino/plugin/iceberg/catalog/jdbc/Test*.java - **/io/trino/plugin/iceberg/catalog/rest/Test*.java - - - - - - - cloud-tests diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/jdbc/TestIcebergJdbcConnectorTest.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/jdbc/TestIcebergJdbcConnectorTest.java deleted file mode 100644 index fc9b5c614750..000000000000 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/jdbc/TestIcebergJdbcConnectorTest.java +++ /dev/null @@ -1,312 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.trino.plugin.iceberg.catalog.jdbc; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import io.trino.plugin.iceberg.BaseIcebergConnectorTest; -import io.trino.plugin.iceberg.IcebergConfig; -import io.trino.plugin.iceberg.IcebergQueryRunner; -import io.trino.testing.QueryRunner; -import io.trino.tpch.TpchTable; -import org.testng.SkipException; -import org.testng.annotations.Test; - -import java.io.File; -import java.nio.file.Files; -import java.util.Optional; -import java.util.OptionalInt; - -import static com.google.common.io.MoreFiles.deleteRecursively; -import static com.google.common.io.RecursiveDeleteOption.ALLOW_INSECURE; -import static io.trino.plugin.iceberg.catalog.jdbc.TestingIcebergJdbcServer.PASSWORD; -import static io.trino.plugin.iceberg.catalog.jdbc.TestingIcebergJdbcServer.USER; -import static io.trino.tpch.TpchTable.LINE_ITEM; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class TestIcebergJdbcConnectorTest - extends BaseIcebergConnectorTest -{ - private File warehouseLocation; - - public TestIcebergJdbcConnectorTest() - { - super(new IcebergConfig().getFileFormat()); - } - - @Override - protected QueryRunner createQueryRunner() - throws Exception - { - warehouseLocation = Files.createTempDirectory("test_iceberg_jdbc_connector_test").toFile(); - closeAfterClass(() -> deleteRecursively(warehouseLocation.toPath(), ALLOW_INSECURE)); - TestingIcebergJdbcServer server = closeAfterClass(new TestingIcebergJdbcServer()); - return IcebergQueryRunner.builder() - .setBaseDataDir(Optional.of(warehouseLocation.toPath())) - .setIcebergProperties( - ImmutableMap.builder() - .put("iceberg.file-format", format.name()) - .put("iceberg.catalog.type", "jdbc") - .put("iceberg.jdbc-catalog.driver-class", "org.postgresql.Driver") - .put("iceberg.jdbc-catalog.connection-url", server.getJdbcUrl()) - .put("iceberg.jdbc-catalog.connection-user", USER) - .put("iceberg.jdbc-catalog.connection-password", PASSWORD) - .put("iceberg.jdbc-catalog.catalog-name", "tpch") - .put("iceberg.jdbc-catalog.default-warehouse-dir", warehouseLocation.toPath().resolve("iceberg_data").toFile().getAbsolutePath()) - .buildOrThrow()) - .setInitialTables(ImmutableList.>builder() - .addAll(REQUIRED_TPCH_TABLES) - .add(LINE_ITEM) - .build()) - .build(); - } - - @Override - public void testShowCreateSchema() - { - // Override because Iceberg JDBC catalog requires location in the namespace - assertThat(computeActual("SHOW CREATE SCHEMA tpch").getOnlyValue().toString()) - .matches(""" - CREATE SCHEMA iceberg.tpch - WITH \\( - location = '.*' - \\)"""); - } - - @Override - protected boolean isFileSorted(String path, String sortColumnName) - { - throw new SkipException("Not implemented"); - } - - @Override - public void testRenameSchema() - { - assertThatThrownBy(super::testRenameSchema) - .hasMessage("renameNamespace is not supported for Iceberg JDBC catalogs"); - } - - @Override - public void testRenameSchemaToLongName() - { - assertThatThrownBy(super::testRenameSchemaToLongName) - .hasMessage("renameNamespace is not supported for Iceberg JDBC catalogs"); - } - - @Override - public void testView() - { - assertThatThrownBy(super::testView) - .hasMessage("createView is not supported for Iceberg JDBC catalogs"); - } - - @Override - public void testCreateViewSchemaNotFound() - { - assertThatThrownBy(super::testCreateViewSchemaNotFound) - .hasMessageContaining("createView is not supported for Iceberg JDBC catalogs"); - } - - @Override - public void testShowCreateView() - { - assertThatThrownBy(super::testShowCreateView) - .hasMessageContaining("createView is not supported for Iceberg JDBC catalogs"); - } - - @Override - public void testCompatibleTypeChangeForView() - { - assertThatThrownBy(super::testCompatibleTypeChangeForView) - .hasMessage("createView is not supported for Iceberg JDBC catalogs"); - } - - @Override - public void testCompatibleTypeChangeForView2() - { - assertThatThrownBy(super::testCompatibleTypeChangeForView2) - .hasMessage("createView is not supported for Iceberg JDBC catalogs"); - } - - @Override - public void testDropNonEmptySchemaWithView() - { - assertThatThrownBy(super::testDropNonEmptySchemaWithView) - .hasMessage("createView is not supported for Iceberg JDBC catalogs"); - } - - @Test(dataProvider = "testViewMetadataDataProvider") - @Override - public void testViewMetadata(String securityClauseInCreate, String securityClauseInShowCreate) - { - assertThatThrownBy(() -> super.testViewMetadata(securityClauseInCreate, securityClauseInShowCreate)) - .hasMessage("createView is not supported for Iceberg JDBC catalogs"); - } - - @Override - public void testViewCaseSensitivity() - { - assertThatThrownBy(super::testViewCaseSensitivity) - .hasMessage("createView is not supported for Iceberg JDBC catalogs"); - } - - @Override - public void testViewAndMaterializedViewTogether() - { - assertThatThrownBy(super::testViewAndMaterializedViewTogether) - .hasMessage("createView is not supported for Iceberg JDBC catalogs"); - } - - @Override - public void testCommentView() - { - assertThatThrownBy(super::testCommentView) - .hasMessage("createView is not supported for Iceberg JDBC catalogs"); - } - - @Override - public void testCommentViewColumn() - { - assertThatThrownBy(super::testCommentViewColumn) - .hasMessage("createView is not supported for Iceberg JDBC catalogs"); - } - - @Override - public void testReadMetadataWithRelationsConcurrentModifications() - { - assertThatThrownBy(super::testReadMetadataWithRelationsConcurrentModifications) - .hasMessageMatching(".* (createView|createMaterializedView) is not supported for Iceberg JDBC catalogs"); - } - - @Override - public void testMaterializedView() - { - assertThatThrownBy(super::testMaterializedView) - .hasMessage("createMaterializedView is not supported for Iceberg JDBC catalogs"); - } - - @Override - public void testMaterializedViewAllTypes() - { - assertThatThrownBy(super::testMaterializedViewAllTypes) - .hasMessage("createMaterializedView is not supported for Iceberg JDBC catalogs"); - } - - @Override - public void testMaterializedViewGracePeriod() - { - assertThatThrownBy(super::testMaterializedViewGracePeriod) - .hasMessage("createMaterializedView is not supported for Iceberg JDBC catalogs"); - } - - @Override - public void testFederatedMaterializedViewWithGracePeriod() - { - assertThatThrownBy(super::testFederatedMaterializedViewWithGracePeriod) - .hasMessage("createMaterializedView is not supported for Iceberg JDBC catalogs"); - } - - @Override - public void testMaterializedViewBaseTableGone(boolean initialized) - { - assertThatThrownBy(() -> super.testMaterializedViewBaseTableGone(initialized)) - .hasMessage("createMaterializedView is not supported for Iceberg JDBC catalogs"); - } - - @Test(dataProvider = "testColumnNameDataProvider") - @Override - public void testMaterializedViewColumnName(String columnName) - { - assertThatThrownBy(() -> super.testMaterializedViewColumnName(columnName)) - .hasMessage("createMaterializedView is not supported for Iceberg JDBC catalogs"); - } - - @Override - public void testDropNonEmptySchemaWithMaterializedView() - { - assertThatThrownBy(super::testDropNonEmptySchemaWithMaterializedView) - .hasMessage("createMaterializedView is not supported for Iceberg JDBC catalogs"); - } - - @Override - public void testRenameMaterializedView() - { - assertThatThrownBy(super::testRenameMaterializedView) - .hasMessage("createMaterializedView is not supported for Iceberg JDBC catalogs"); - } - - @Override - public void testFederatedMaterializedView() - { - assertThatThrownBy(super::testFederatedMaterializedView) - .hasMessage("createMaterializedView is not supported for Iceberg JDBC catalogs"); - } - - @Override - public void testMaterializedViewSnapshotSummariesHaveTrinoQueryId() - { - assertThatThrownBy(super::testMaterializedViewSnapshotSummariesHaveTrinoQueryId) - .hasMessage("createMaterializedView is not supported for Iceberg JDBC catalogs"); - } - - @Override - public void testDropAmbiguousRowFieldCaseSensitivity() - { - // TODO https://github.com/trinodb/trino/issues/16273 The connector can't read row types having ambiguous field names in ORC files. e.g. row(X int, x int) - assertThatThrownBy(super::testDropAmbiguousRowFieldCaseSensitivity) - .hasMessageContaining("Error opening Iceberg split") - .hasStackTraceContaining("Multiple entries with same key"); - } - - @Override - protected void verifyConcurrentAddColumnFailurePermissible(Exception e) - { - assertThat(e) - .hasMessageStartingWith("Failed to add column: Failed to update table due to concurrent updates"); - } - - @Override - protected boolean supportsIcebergFileStatistics(String typeName) - { - return !typeName.equalsIgnoreCase("varbinary") && - !typeName.equalsIgnoreCase("uuid"); - } - - @Override - protected boolean supportsRowGroupStatistics(String typeName) - { - return !typeName.equalsIgnoreCase("varbinary"); - } - - @Override - protected OptionalInt maxSchemaNameLength() - { - return OptionalInt.of(255); - } - - @Override - protected void verifySchemaNameLengthFailurePermissible(Throwable e) - { - assertThat(e) - .hasMessageContaining("Failed to create a namespace") - .hasStackTraceContaining("ERROR: value too long for type character varying(255)"); - } - - @Override - protected void verifyTableNameLengthFailurePermissible(Throwable e) - { - assertThat(e).hasMessageMatching("Failed to create file.*|.*Failed to rename table.*"); - } -} diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/rest/TestTrinoRestCatalogConnectorTest.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/rest/TestTrinoRestCatalogConnectorTest.java deleted file mode 100644 index 72a9acacf616..000000000000 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/rest/TestTrinoRestCatalogConnectorTest.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.trino.plugin.iceberg.catalog.rest; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import io.airlift.http.server.testing.TestingHttpServer; -import io.trino.plugin.iceberg.IcebergQueryRunner; -import io.trino.plugin.iceberg.TestIcebergParquetConnectorTest; -import io.trino.testing.MaterializedResult; -import io.trino.testing.MaterializedRow; -import io.trino.testing.QueryRunner; -import io.trino.testing.TestingConnectorBehavior; -import io.trino.tpch.TpchTable; -import org.apache.iceberg.catalog.Catalog; -import org.apache.iceberg.rest.DelegatingRestSessionCatalog; -import org.assertj.core.util.Files; - -import java.io.File; -import java.util.Optional; -import java.util.OptionalInt; - -import static com.google.common.io.MoreFiles.deleteRecursively; -import static com.google.common.io.RecursiveDeleteOption.ALLOW_INSECURE; -import static io.trino.plugin.iceberg.catalog.rest.RestCatalogTestUtils.backendCatalog; -import static io.trino.testing.MaterializedResult.DEFAULT_PRECISION; -import static io.trino.tpch.TpchTable.LINE_ITEM; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class TestTrinoRestCatalogConnectorTest - extends TestIcebergParquetConnectorTest -{ - @SuppressWarnings("DuplicateBranchesInSwitch") - @Override - protected boolean hasBehavior(TestingConnectorBehavior connectorBehavior) - { - return switch (connectorBehavior) { - case SUPPORTS_RENAME_SCHEMA -> false; - case SUPPORTS_CREATE_VIEW, SUPPORTS_COMMENT_ON_VIEW, SUPPORTS_COMMENT_ON_VIEW_COLUMN -> false; - case SUPPORTS_CREATE_MATERIALIZED_VIEW, SUPPORTS_RENAME_MATERIALIZED_VIEW -> false; - default -> super.hasBehavior(connectorBehavior); - }; - } - - @Override - protected QueryRunner createQueryRunner() - throws Exception - { - File warehouseLocation = Files.newTemporaryFolder(); - closeAfterClass(() -> deleteRecursively(warehouseLocation.toPath(), ALLOW_INSECURE)); - - Catalog backend = backendCatalog(warehouseLocation); - - DelegatingRestSessionCatalog delegatingCatalog = DelegatingRestSessionCatalog.builder() - .delegate(backend) - .build(); - - TestingHttpServer testServer = delegatingCatalog.testServer(); - testServer.start(); - closeAfterClass(testServer::stop); - - return IcebergQueryRunner.builder() - .setBaseDataDir(Optional.of(warehouseLocation.toPath())) - .setIcebergProperties( - ImmutableMap.builder() - .put("iceberg.file-format", format.name()) - .put("iceberg.catalog.type", "rest") - .put("iceberg.rest-catalog.uri", testServer.getBaseUrl().toString()) - .buildOrThrow()) - .setInitialTables(ImmutableList.>builder() - .addAll(REQUIRED_TPCH_TABLES) - .add(LINE_ITEM) - .build()) - .build(); - } - - @Override - protected OptionalInt maxSchemaNameLength() - { - // h2 test database backend limit - return OptionalInt.of(255); - } - - @Override - protected void verifySchemaNameLengthFailurePermissible(Throwable e) - { - assertThat(e).hasMessageContaining("Failed to execute"); - } - - @Override - protected OptionalInt maxTableNameLength() - { - // This value depends on metastore backend limit - // The connector appends uuids to the end of all table names - // 33 is the length of random suffix. e.g. {table name}-142763c594d54e4b9329a98f90528caf - return OptionalInt.of(255 - 33); - } - - @Override - protected void verifyTableNameLengthFailurePermissible(Throwable e) - { - assertThat(e).hasMessageMatching(".*Failed to create.*|.*Failed to execute.*|.*Failed to rename.*"); - } - - @Override - protected int maxTableRenameLength() - { - // h2 test database backend limit - return 255; - } - - @Override - protected void verifyConcurrentAddColumnFailurePermissible(Exception e) - { - assertThat(e) - .getCause() - .hasMessageContaining("Commit failed: Requirement failed: last assigned field id changed"); - } - - @Override - public void testShowCreateSchema() - { - // Overridden due to REST catalog not supporting namespace principal - assertThat(computeActual("SHOW CREATE SCHEMA tpch").getOnlyValue().toString()) - .matches("\\QCREATE SCHEMA iceberg.tpch\n" + - "WITH (\n" + - " location = '\\E.*\\Q/iceberg_data/tpch'\n" + - ")\\E"); - } - - @Override - protected void verifyIcebergTableProperties(MaterializedResult actual) - { - assertThat(actual) - .anySatisfy(row -> assertThat(row).isEqualTo(new MaterializedRow(DEFAULT_PRECISION, "write.format.default", this.format.name()))) - .anySatisfy(row -> assertThat(row.getFields()).contains("created-at")); - } - - @Override - public void testView() - { - assertThatThrownBy(super::testView) - .hasMessageContaining("createView is not supported for Iceberg REST catalog"); - } - - @Override - public void testMaterializedView() - { - assertThatThrownBy(super::testMaterializedView) - .hasMessageContaining("createMaterializedView is not supported for Iceberg REST catalog"); - } - - @Override - public void testFederatedMaterializedView() - { - assertThatThrownBy(super::testFederatedMaterializedView) - .hasMessageContaining("createMaterializedView is not supported for Iceberg REST catalog"); - } - - @Override - public void testRenameSchema() - { - assertThatThrownBy(super::testRenameSchema) - .hasMessageContaining("renameNamespace is not supported for Iceberg REST catalog"); - } - - @Override - public void testMaterializedViewSnapshotSummariesHaveTrinoQueryId() - { - assertThatThrownBy(super::testMaterializedViewSnapshotSummariesHaveTrinoQueryId) - .hasMessageContaining("createMaterializedView is not supported for Iceberg REST catalog"); - } -}