Skip to content

Commit 08e8127

Browse files
authored
feat: expose location_provider to Table (apache#506)
1 parent f869003 commit 08e8127

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/iceberg/table.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <memory>
2323

2424
#include "iceberg/catalog.h"
25+
#include "iceberg/location_provider.h"
2526
#include "iceberg/partition_spec.h"
2627
#include "iceberg/result.h"
2728
#include "iceberg/schema.h"
@@ -140,6 +141,10 @@ const std::shared_ptr<TableMetadata>& Table::metadata() const { return metadata_
140141

141142
const std::shared_ptr<Catalog>& Table::catalog() const { return catalog_; }
142143

144+
Result<std::unique_ptr<LocationProvider>> Table::location_provider() const {
145+
return LocationProvider::Make(metadata_->location, metadata_->properties);
146+
}
147+
143148
Result<std::unique_ptr<TableScanBuilder>> Table::NewScan() const {
144149
return TableScanBuilder::Make(metadata_, io_);
145150
}

src/iceberg/table.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class ICEBERG_EXPORT Table : public std::enable_shared_from_this<Table> {
5656
/// \brief Returns the UUID of the table
5757
const std::string& uuid() const;
5858

59-
/// \brief Return the schema for this table, return NotFoundError if not found
59+
/// \brief Returns the schema for this table, return NotFoundError if not found
6060
Result<std::shared_ptr<Schema>> schema() const;
6161

6262
/// \brief Returns a map of schema for this table
@@ -116,6 +116,9 @@ class ICEBERG_EXPORT Table : public std::enable_shared_from_this<Table> {
116116
/// \brief Returns the catalog that this table belongs to
117117
const std::shared_ptr<Catalog>& catalog() const;
118118

119+
/// \brief Returns a LocationProvider for this table
120+
Result<std::unique_ptr<LocationProvider>> location_provider() const;
121+
119122
/// \brief Refresh the current table metadata
120123
virtual Status Refresh();
121124

0 commit comments

Comments
 (0)