Skip to content

Commit

Permalink
Hide Hive system schemas in Hudi
Browse files Browse the repository at this point in the history
  • Loading branch information
ebyhr committed Oct 7, 2022
1 parent b44180d commit 326b786
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ public HudiMetadata(HiveMetastore metastore, HdfsEnvironment hdfsEnvironment, Ty
@Override
public List<String> listSchemaNames(ConnectorSession session)
{
return metastore.getAllDatabases();
return metastore.getAllDatabases().stream()
.filter(schemaName -> !isHiveSystemSchema(schemaName))
.collect(toImmutableList());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ public void testShowCreateTable()
")");
}

@Test
public void testHideHiveSysSchema()
{
assertThat(computeActual("SHOW SCHEMAS").getOnlyColumnAsSet()).doesNotContain("sys");
assertQueryFails("SHOW TABLES IN hudi.sys", ".*Schema 'sys' does not exist");
}

protected static String columnsToHide()
{
List<String> columns = new ArrayList<>(HOODIE_META_COLUMNS.size() + 1);
Expand Down

0 comments on commit 326b786

Please sign in to comment.