@@ -716,6 +716,7 @@ public ResultSet getTables(String catalog, String schemaPattern, String tableNam
716716 FixedResultSetFactory .ResultSetBuilder rs = MetaDataTables .TABLES .createResultSet ();
717717 listTables (tableNamePattern ).stream ()
718718 .map (TableRecord ::new )
719+ .filter (tr -> !tr .isHidden )
719720 .filter (tr -> (matchTables && !tr .isSystem ) || (matchSystemTables && tr .isSystem ))
720721 .sorted ()
721722 .forEach (tr -> {
@@ -730,21 +731,28 @@ public ResultSet getTables(String catalog, String schemaPattern, String tableNam
730731
731732 private class TableRecord implements Comparable <TableRecord > {
732733 private final boolean isSystem ;
734+ private final boolean isHidden ;
733735 private final String name ;
734736
735737 TableRecord (String name ) {
736738 this .name = name ;
739+ // https://github.com/ydb-platform/ydb/blob/main/ydb/core/tx/schemeshard/schemeshard_system_names.cpp#L16
737740 this .isSystem = name .startsWith (".sys/" )
738741 || name .startsWith (".sys_health/" )
739- || name .startsWith (".sys_health_dev/" )
740- || name .startsWith (".metadata/" );
742+ || name .startsWith (".sys_health_dev/" );
743+ this .isHidden = name .startsWith (".metadata/" )
744+ || name .startsWith (".tmp/" )
745+ || name .startsWith (".backups/" );
741746 }
742747
743748 @ Override
744749 public int compareTo (TableRecord o ) {
745750 if (isSystem != o .isSystem ) {
746751 return isSystem ? 1 : -1 ;
747752 }
753+ if (isHidden != o .isHidden ) {
754+ return isHidden ? 1 : -1 ;
755+ }
748756 return name .compareTo (o .name );
749757 }
750758 }
@@ -1385,7 +1393,8 @@ private TableDescription describeTable(String table) throws SQLException {
13851393 .describeTable (databaseWithSuffix + table , settings )
13861394 .thenApply (result -> {
13871395 // ignore scheme errors like path not found
1388- if (result .getStatus ().getCode () == StatusCode .SCHEME_ERROR ) {
1396+ StatusCode code = result .getStatus ().getCode ();
1397+ if (code == StatusCode .SCHEME_ERROR || code == StatusCode .UNAUTHORIZED ) {
13891398 LOGGER .log (Level .WARNING , "Cannot describe table {0} -> {1}" ,
13901399 new Object []{table , result .getStatus ()}
13911400 );
0 commit comments