Skip to content

Commit 5aff2f1

Browse files
committed
feat: add snapshot update
1 parent 898d862 commit 5aff2f1

File tree

4 files changed

+629
-10
lines changed

4 files changed

+629
-10
lines changed

src/iceberg/table.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ Table::Table(TableIdentifier identifier, std::shared_ptr<TableMetadata> metadata
4646

4747
const std::string& Table::uuid() const { return metadata_->table_uuid; }
4848

49+
int8_t Table::format_version() const { return metadata_->format_version; }
50+
4951
Status Table::Refresh() {
5052
if (!catalog_) {
5153
return NotSupported("Refresh is not supported for table without a catalog");

src/iceberg/table.h

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,46 +48,52 @@ class ICEBERG_EXPORT Table {
4848
std::string metadata_location, std::shared_ptr<FileIO> io,
4949
std::shared_ptr<Catalog> catalog);
5050

51-
/// \brief Return the identifier of this table
51+
/// \brief Returns the identifier of this table
5252
const TableIdentifier& name() const { return identifier_; }
5353

54+
/// \brief Returns the metadata of this table
55+
const std::shared_ptr<TableMetadata>& metadata() const { return metadata_; }
56+
5457
/// \brief Returns the UUID of the table
5558
const std::string& uuid() const;
5659

60+
/// \brief Returns the format version of the table
61+
int8_t format_version() const;
62+
5763
/// \brief Refresh the current table metadata
5864
Status Refresh();
5965

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

63-
/// \brief Return a map of schema for this table
69+
/// \brief Returns a map of schema for this table
6470
Result<
6571
std::reference_wrapper<const std::unordered_map<int32_t, std::shared_ptr<Schema>>>>
6672
schemas() const;
6773

68-
/// \brief Return the partition spec for this table, return NotFoundError if not found
74+
/// \brief Returns the partition spec for this table, return NotFoundError if not found
6975
Result<std::shared_ptr<PartitionSpec>> spec() const;
7076

71-
/// \brief Return a map of partition specs for this table
77+
/// \brief Returns a map of partition specs for this table
7278
Result<std::reference_wrapper<
7379
const std::unordered_map<int32_t, std::shared_ptr<PartitionSpec>>>>
7480
specs() const;
7581

76-
/// \brief Return the sort order for this table, return NotFoundError if not found
82+
/// \brief Returns the sort order for this table, return NotFoundError if not found
7783
Result<std::shared_ptr<SortOrder>> sort_order() const;
7884

79-
/// \brief Return a map of sort order IDs to sort orders for this table
85+
/// \brief Returns a map of sort order IDs to sort orders for this table
8086
Result<std::reference_wrapper<
8187
const std::unordered_map<int32_t, std::shared_ptr<SortOrder>>>>
8288
sort_orders() const;
8389

84-
/// \brief Return a map of string properties for this table
90+
/// \brief Returns a map of string properties for this table
8591
const TableProperties& properties() const;
8692

87-
/// \brief Return the table's base location
93+
/// \brief Returns the table's base location
8894
const std::string& location() const;
8995

90-
/// \brief Return the table's current snapshot, return NotFoundError if not found
96+
/// \brief Returns the table's current snapshot, return NotFoundError if not found
9197
Result<std::shared_ptr<Snapshot>> current_snapshot() const;
9298

9399
/// \brief Get the snapshot of this table with the given id
@@ -124,6 +130,9 @@ class ICEBERG_EXPORT Table {
124130
/// \brief Returns a FileIO to read and write table data and metadata files
125131
const std::shared_ptr<FileIO>& io() const;
126132

133+
/// \brief Returns the catalog that this table belongs to
134+
const std::shared_ptr<Catalog>& catalog() const;
135+
127136
private:
128137
const TableIdentifier identifier_;
129138
std::shared_ptr<TableMetadata> metadata_;

src/iceberg/table_properties.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,9 @@ class ICEBERG_EXPORT TableProperties : public ConfigBase<TableProperties> {
244244
inline static Entry<int64_t> kDeleteTargetFileSizeBytes{
245245
"write.delete.target-file-size-bytes", int64_t{64} * 1024 * 1024}; // 64 MB
246246

247+
inline static Entry<bool> kSnapshotIdInheritanceEnabled{
248+
"compatibility.snapshot-id-inheritance.enabled", false};
249+
247250
// Garbage collection properties
248251

249252
inline static Entry<bool> kGcEnabled{"gc.enabled", true};

0 commit comments

Comments
 (0)