Skip to content

Commit a4f0504

Browse files
author
shuxu.li
committed
feat: RegisterTable support for InMemoryCatalog
1 parent fa57abd commit a4f0504

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/iceberg/catalog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ class ICEBERG_EXPORT Catalog {
166166
/// \param identifier a table identifier
167167
/// \return instance of Table implementation referred to by identifier or
168168
/// ErrorKind::kNoSuchTable if the table does not exist
169-
virtual Result<std::shared_ptr<Table>> LoadTable(const TableIdentifier& identifier) = 0;
169+
virtual Result<std::unique_ptr<Table>> LoadTable(const TableIdentifier& identifier) = 0;
170170

171171
/// \brief Register a table with the catalog if it does not exist
172172
///

src/iceberg/catalog/in_memory_catalog.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ Status InMemoryCatalog::DropTable(const TableIdentifier& identifier, bool purge)
408408
return root_namespace_->UnregisterTable(identifier);
409409
}
410410

411-
Result<std::shared_ptr<Table>> InMemoryCatalog::LoadTable(
411+
Result<std::unique_ptr<Table>> InMemoryCatalog::LoadTable(
412412
const TableIdentifier& identifier) {
413413
if (!file_io_) [[unlikely]] {
414414
return InvalidArgument("file_io is not set for catalog {}", catalog_name_);
@@ -424,7 +424,7 @@ Result<std::shared_ptr<Table>> InMemoryCatalog::LoadTable(
424424
ICEBERG_ASSIGN_OR_RAISE(auto metadata,
425425
TableMetadataUtil::Read(*file_io_, metadata_location.value()));
426426

427-
return std::make_shared<Table>(identifier, std::move(metadata),
427+
return std::make_unique<Table>(identifier, std::move(metadata),
428428
metadata_location.value(), file_io_,
429429
std::static_pointer_cast<Catalog>(shared_from_this()));
430430
}

src/iceberg/catalog/in_memory_catalog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class ICEBERG_EXPORT InMemoryCatalog
8484

8585
Status DropTable(const TableIdentifier& identifier, bool purge) override;
8686

87-
Result<std::shared_ptr<Table>> LoadTable(const TableIdentifier& identifier) override;
87+
Result<std::unique_ptr<Table>> LoadTable(const TableIdentifier& identifier) override;
8888

8989
Result<std::shared_ptr<Table>> RegisterTable(
9090
const TableIdentifier& identifier,

0 commit comments

Comments
 (0)