diff --git a/presto-hive/src/main/java/io/prestosql/plugin/hive/HiveMetadata.java b/presto-hive/src/main/java/io/prestosql/plugin/hive/HiveMetadata.java index c998e480ab90..66e815a70d49 100644 --- a/presto-hive/src/main/java/io/prestosql/plugin/hive/HiveMetadata.java +++ b/presto-hive/src/main/java/io/prestosql/plugin/hive/HiveMetadata.java @@ -521,7 +521,7 @@ private ConnectorTableMetadata getTableMetadata(ConnectorSession session, Schema private ConnectorTableMetadata doGetTableMetadata(ConnectorSession session, SchemaTableName tableName) { Optional table = metastore.getTable(new HiveIdentity(session), tableName.getSchemaName(), tableName.getTableName()); - if (!table.isPresent() || isHiveOrPrestoView(table.get())) { + if (!table.isPresent() || (!translateHiveViews && isHiveOrPrestoView(table.get()))) { throw new TableNotFoundException(tableName); } diff --git a/presto-product-tests/src/main/java/io/prestosql/tests/hive/TestHiveViews.java b/presto-product-tests/src/main/java/io/prestosql/tests/hive/TestHiveViews.java index e7bd1d810390..cf71977c9208 100644 --- a/presto-product-tests/src/main/java/io/prestosql/tests/hive/TestHiveViews.java +++ b/presto-product-tests/src/main/java/io/prestosql/tests/hive/TestHiveViews.java @@ -153,6 +153,9 @@ public void testHiveViewInInformationSchema() assertThat(query("SELECT view_definition FROM information_schema.views WHERE table_schema = 'test_schema' and table_name = 'hive_test_view'")).containsOnly( row("SELECT \"nation\".\"n_nationkey\", \"nation\".\"n_name\", \"nation\".\"n_regionkey\", \"nation\".\"n_comment\" FROM \"default\".\"nation\"")); + + assertThat(query("DESCRIBE test_schema.hive_test_view")) + .contains(row("n_nationkey", "bigint", "", "")); } @Test(groups = HIVE_VIEWS)