Skip to content

Commit

Permalink
Fix code indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Sep 26, 2022
1 parent 01302b2 commit f2b557f
Showing 1 changed file with 27 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -532,33 +532,34 @@ public Iterator<TableColumnsMetadata> streamTableColumns(ConnectorSession sessio
.map(ignored -> singletonList(prefix.toSchemaTableName()))
.orElseGet(() -> listTables(session, prefix.getSchema()));

return tables.stream().flatMap(table -> {
try {
if (redirectTable(session, table).isPresent()) {
// put "redirect marker" for current table
return Stream.of(TableColumnsMetadata.forRedirectedTable(table));
}
return tables.stream()
.flatMap(table -> {
try {
if (redirectTable(session, table).isPresent()) {
// put "redirect marker" for current table
return Stream.of(TableColumnsMetadata.forRedirectedTable(table));
}

// intentionally skip case when table snapshot is present but it lacks metadata portion
return metastore.getMetadata(metastore.getSnapshot(table, session), session).stream().map(metadata -> {
Map<String, String> columnComments = getColumnComments(metadata);
Map<String, Boolean> columnsNullability = getColumnsNullability(metadata);
List<ColumnMetadata> columnMetadata = getColumns(metadata).stream()
.map(column -> getColumnMetadata(column, columnComments.get(column.getName()), columnsNullability.getOrDefault(column.getName(), true)))
.collect(toImmutableList());
return TableColumnsMetadata.forTable(table, columnMetadata);
});
}
catch (NotADeltaLakeTableException e) {
return Stream.empty();
}
catch (RuntimeException e) {
// this may happen when table is being deleted concurrently, it still exists in metastore but TL is no longer present
// there can be several different exceptions thrown this is why all RTE are caught and ignored here
LOG.debug(e, "Ignored exception when trying to list columns from %s", table);
return Stream.empty();
}
})
// intentionally skip case when table snapshot is present but it lacks metadata portion
return metastore.getMetadata(metastore.getSnapshot(table, session), session).stream().map(metadata -> {
Map<String, String> columnComments = getColumnComments(metadata);
Map<String, Boolean> columnsNullability = getColumnsNullability(metadata);
List<ColumnMetadata> columnMetadata = getColumns(metadata).stream()
.map(column -> getColumnMetadata(column, columnComments.get(column.getName()), columnsNullability.getOrDefault(column.getName(), true)))
.collect(toImmutableList());
return TableColumnsMetadata.forTable(table, columnMetadata);
});
}
catch (NotADeltaLakeTableException e) {
return Stream.empty();
}
catch (RuntimeException e) {
// this may happen when table is being deleted concurrently, it still exists in metastore but TL is no longer present
// there can be several different exceptions thrown this is why all RTE are caught and ignored here
LOG.debug(e, "Ignored exception when trying to list columns from %s", table);
return Stream.empty();
}
})
.iterator();
}

Expand Down

0 comments on commit f2b557f

Please sign in to comment.