Skip to content

Commit

Permalink
Nessie: Add table() and view() API to NessieIcebergClient (apache#9477)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajantha-bhat authored Jan 15, 2024
1 parent 5a1b0d1 commit 23e17ce
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,16 @@ private TableIdentifier toIdentifier(EntriesResponse.Entry entry) {
return TableIdentifier.of(elements.toArray(new String[elements.size()]));
}

public IcebergTable table(TableIdentifier tableIdentifier) {
IcebergContent icebergContent = fetchContent(tableIdentifier);
return icebergContent == null ? null : icebergContent.unwrap(IcebergTable.class).orElse(null);
}

public IcebergView view(TableIdentifier tableIdentifier) {
IcebergContent icebergContent = fetchContent(tableIdentifier);
return icebergContent == null ? null : icebergContent.unwrap(IcebergView.class).orElse(null);
}

public IcebergContent fetchContent(TableIdentifier tableIdentifier) {
try {
ContentKey key = NessieUtil.toKey(tableIdentifier);
Expand Down

0 comments on commit 23e17ce

Please sign in to comment.