Skip to content

Commit

Permalink
Return table metadata for translated Hive views
Browse files Browse the repository at this point in the history
  • Loading branch information
kokosing committed Mar 22, 2020
1 parent ee4cf93 commit aafe479
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ private ConnectorTableMetadata getTableMetadata(ConnectorSession session, Schema
private ConnectorTableMetadata doGetTableMetadata(ConnectorSession session, SchemaTableName tableName)
{
Optional<Table> 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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit aafe479

Please sign in to comment.