From 975e0622d094d74aa37a8106668236c025e2fc75 Mon Sep 17 00:00:00 2001 From: lukasz-stec Date: Mon, 23 Dec 2024 11:34:31 +0100 Subject: [PATCH] Fix failures in iceberg cloud tests --- .../iceberg/catalog/BaseTrinoCatalogTest.java | 21 ++++++++++++++++- .../catalog/glue/TestTrinoGlueCatalog.java | 23 +++++++++++++++++++ ...ergSnowflakeCatalogConnectorSmokeTest.java | 8 +++++++ 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/BaseTrinoCatalogTest.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/BaseTrinoCatalogTest.java index e2ae7af4c66b..acc0c3943fb9 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/BaseTrinoCatalogTest.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/BaseTrinoCatalogTest.java @@ -478,8 +478,9 @@ public void testListTables() try { SchemaTableName materializedView = new SchemaTableName(ns2, "mv"); - catalog.createMaterializedView( + createMaterializedView( SESSION, + catalog, materializedView, someMaterializedView(), ImmutableMap.of( @@ -514,6 +515,24 @@ public void testListTables() } } + protected void createMaterializedView( + ConnectorSession session, + TrinoCatalog catalog, + SchemaTableName materializedView, + ConnectorMaterializedViewDefinition materializedViewDefinition, + Map properties, + boolean replace, + boolean ignoreExisting) + { + catalog.createMaterializedView( + session, + materializedView, + materializedViewDefinition, + properties, + replace, + ignoreExisting); + } + protected Optional createExternalIcebergTable(TrinoCatalog catalog, String namespace, AutoCloseableCloser closer) throws Exception { diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/glue/TestTrinoGlueCatalog.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/glue/TestTrinoGlueCatalog.java index 80ee1628b561..4e30c6a7d8c4 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/glue/TestTrinoGlueCatalog.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/glue/TestTrinoGlueCatalog.java @@ -35,6 +35,7 @@ import io.trino.spi.connector.CatalogHandle; import io.trino.spi.connector.ConnectorMaterializedViewDefinition; import io.trino.spi.connector.ConnectorMetadata; +import io.trino.spi.connector.ConnectorSession; import io.trino.spi.connector.MaterializedViewNotFoundException; import io.trino.spi.connector.SchemaTableName; import io.trino.spi.security.PrincipalType; @@ -257,4 +258,26 @@ public void testDefaultLocation() } } } + + @Override + protected void createMaterializedView( + ConnectorSession session, + TrinoCatalog catalog, + SchemaTableName materializedView, + ConnectorMaterializedViewDefinition materializedViewDefinition, + Map properties, + boolean replace, + boolean ignoreExisting) + { + catalog.createMaterializedView( + session, + materializedView, + materializedViewDefinition, + ImmutableMap.builder() + .putAll(properties) + .put(LOCATION_PROPERTY, "file:///tmp/a/path/" + materializedView.getTableName()) + .buildOrThrow(), + replace, + ignoreExisting); + } } diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/snowflake/TestIcebergSnowflakeCatalogConnectorSmokeTest.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/snowflake/TestIcebergSnowflakeCatalogConnectorSmokeTest.java index 394e4c0b32a9..2488a1c683b5 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/snowflake/TestIcebergSnowflakeCatalogConnectorSmokeTest.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/snowflake/TestIcebergSnowflakeCatalogConnectorSmokeTest.java @@ -684,6 +684,14 @@ public void testSnowflakeNativeTable() .hasRootCauseMessage("SQL compilation error:\ninvalid parameter 'table ? is not a Snowflake iceberg table'"); } + @Test + @Override + public void testIcebergTablesFunction() + { + assertThatThrownBy(super::testIcebergTablesFunction) + .hasMessageContaining("schemaPath is not supported for Iceberg snowflake catalog"); + } + @Override protected boolean isFileSorted(Location path, String sortColumnName) {