diff --git a/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/metastore/glue/TestDeltaLakeViewsGlueMetastore.java b/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/metastore/glue/TestDeltaLakeViewsGlueMetastore.java index f7ddf7a81b1199..cce31746b617ab 100644 --- a/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/metastore/glue/TestDeltaLakeViewsGlueMetastore.java +++ b/plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/metastore/glue/TestDeltaLakeViewsGlueMetastore.java @@ -83,6 +83,8 @@ public void testCreateView() TestView view = new TestView(getQueryRunner()::execute, viewName, "SELECT * FROM " + table.getName())) { assertQuery(format("SELECT * FROM %s", view.getName()), "VALUES 'test'"); assertQuery(format("SELECT table_type FROM information_schema.tables WHERE table_name = '%s' AND table_schema='%s'", view.getName(), SCHEMA), "VALUES 'VIEW'"); + // Ensure all relations are being listed + assertQuery(format("SELECT table_type FROM information_schema.tables WHERE table_name LIKE '%%%s' AND table_schema='%s'", view.getName(), SCHEMA), "VALUES 'VIEW'"); } } diff --git a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/glue/converter/GlueInputConverter.java b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/glue/converter/GlueInputConverter.java index 994466d64f897d..4984a75f8cb0ca 100644 --- a/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/glue/converter/GlueInputConverter.java +++ b/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/glue/converter/GlueInputConverter.java @@ -42,6 +42,8 @@ import static com.google.common.collect.ImmutableList.toImmutableList; import static com.google.common.collect.ImmutableMap.toImmutableMap; import static io.trino.plugin.hive.HiveMetadata.TABLE_COMMENT; +import static io.trino.plugin.hive.ViewReaderUtil.isTrinoMaterializedView; +import static io.trino.plugin.hive.ViewReaderUtil.isTrinoView; import static io.trino.plugin.hive.metastore.thrift.ThriftMetastoreUtil.metastoreFunctionName; import static io.trino.plugin.hive.metastore.thrift.ThriftMetastoreUtil.toResourceUris; import static io.trino.plugin.hive.metastore.thrift.ThriftMetastoreUtil.updateStatisticsParameters; @@ -64,12 +66,16 @@ public static DatabaseInput convertDatabase(Database database) public static TableInput convertTable(Table table) { + TableInput input = new TableInput(); + Map tableParameters = table.getParameters(); Optional comment = Optional.ofNullable(table.getParameters().get(TABLE_COMMENT)); - Map tableParameters = table.getParameters().entrySet().stream() - .filter(entry -> !entry.getKey().equals(TABLE_COMMENT)) - .collect(toImmutableMap(Map.Entry::getKey, Map.Entry::getValue)); + if (!(isTrinoView(table) || isTrinoMaterializedView(table))) { + tableParameters = table.getParameters().entrySet().stream() + .filter(entry -> !entry.getKey().equals(TABLE_COMMENT)) + .collect(toImmutableMap(Map.Entry::getKey, Map.Entry::getValue)); + comment.ifPresent(input::setDescription); + } - TableInput input = new TableInput(); input.setName(table.getTableName()); input.setOwner(table.getOwner().orElse(null)); input.setTableType(table.getTableType()); @@ -78,7 +84,6 @@ public static TableInput convertTable(Table table) input.setParameters(tableParameters); table.getViewOriginalText().ifPresent(input::setViewOriginalText); table.getViewExpandedText().ifPresent(input::setViewExpandedText); - comment.ifPresent(input::setDescription); return input; }