28#include <unordered_map>
41class ICEBERG_EXPORT
Table :
public std::enable_shared_from_this<Table> {
55 std::string metadata_location, std::shared_ptr<FileIO> io,
56 std::shared_ptr<Catalog> catalog, std::string full_name =
"",
57 std::shared_ptr<MetricsReporter> reporter =
nullptr);
65 const std::string&
full_name()
const {
return full_name_; }
68 const std::string&
uuid()
const;
75 std::reference_wrapper<const std::unordered_map<int32_t, std::shared_ptr<Schema>>>>
82 Result<std::reference_wrapper<
83 const std::unordered_map<int32_t, std::shared_ptr<PartitionSpec>>>>
90 Result<std::reference_wrapper<
91 const std::unordered_map<int32_t, std::shared_ptr<SortOrder>>>>
116 const std::vector<std::shared_ptr<Snapshot>>&
snapshots()
const;
119 const std::vector<SnapshotLogEntry>&
history()
const;
122 const std::shared_ptr<FileIO>&
io()
const;
125 const std::shared_ptr<TableMetadata>&
metadata()
const;
128 const std::shared_ptr<Catalog>&
catalog()
const;
131 const std::shared_ptr<MetricsReporter>&
reporter()
const;
213 std::string metadata_location, std::shared_ptr<FileIO> io,
214 std::shared_ptr<Catalog> catalog, std::string full_name,
215 std::shared_ptr<MetricsReporter> reporter =
nullptr);
218 const std::string full_name_;
219 std::shared_ptr<TableMetadata> metadata_;
220 std::string metadata_location_;
221 std::shared_ptr<FileIO> io_;
222 std::shared_ptr<Catalog> catalog_;
223 std::shared_ptr<MetricsReporter> reporter_;
224 std::unique_ptr<class TableMetadataCache> metadata_cache_;
232 std::string metadata_location, std::shared_ptr<FileIO> io,
233 std::shared_ptr<Catalog> catalog, std::string full_name =
"",
234 std::shared_ptr<MetricsReporter> reporter =
nullptr);
252 std::string metadata_location, std::shared_ptr<FileIO> io,
253 std::string full_name =
"");
A table created by stage-create and not yet committed.
Definition table.h:228
Result< std::unique_ptr< DataTableScanBuilder > > NewScan() const override
Create a new table scan builder for this table.
Status Refresh() override
Refresh the current table metadata.
Definition table.h:238
A read-only table.
Definition table.h:248
Result< std::shared_ptr< MergeAppend > > NewMergeAppend() override
Create a new MergeAppend to append data files and merge manifests.
Result< std::shared_ptr< ExpireSnapshots > > NewExpireSnapshots() override
Create a new ExpireSnapshots to remove expired snapshots and commit the changes.
Result< std::shared_ptr< SnapshotManager > > NewSnapshotManager() override
Create a new SnapshotManager to manage snapshots and snapshot references.
Result< std::shared_ptr< UpdateSchema > > NewUpdateSchema() override
Create a new UpdateSchema to alter the columns of this table and commit the changes.
Result< std::shared_ptr< DeleteFiles > > NewDeleteFiles() override
Create a new DeleteFiles to delete data files and commit the changes.
Result< std::shared_ptr< UpdateLocation > > NewUpdateLocation() override
Create a new UpdateLocation to update the table location and commit the changes.
Result< std::shared_ptr< UpdateSortOrder > > NewUpdateSortOrder() override
Create a new UpdateSortOrder to update the table sort order and commit the changes.
Status Refresh() override
Refresh the current table metadata.
Result< std::shared_ptr< UpdatePartitionSpec > > NewUpdatePartitionSpec() override
Create a new UpdatePartitionSpec to update the partition spec of this table and commit the changes.
Result< std::shared_ptr< Transaction > > NewTransaction() override
Create a new Transaction to commit multiple table operations at once.
Result< std::shared_ptr< RowDelta > > NewRowDelta() override
Create a new RowDelta to add rows and row-level deletes.
Result< std::shared_ptr< FastAppend > > NewFastAppend() override
Create a new FastAppend to append data files and commit the changes.
Result< std::shared_ptr< UpdateProperties > > NewUpdateProperties() override
Create a new UpdateProperties to update table properties and commit the changes.
Result< std::shared_ptr< OverwriteFiles > > NewOverwrite() override
Create a new OverwriteFiles to overwrite data files and commit the changes.
Result< std::shared_ptr< UpdatePartitionStatistics > > NewUpdatePartitionStatistics() override
Create a new UpdatePartitionStatistics to update partition statistics and commit the changes.
Result< std::shared_ptr< RewriteFiles > > NewRewriteFiles() override
Create a new RewriteFiles to replace files in this table and commit the changes.
Result< std::shared_ptr< UpdateStatistics > > NewUpdateStatistics() override
Create a new UpdateStatistics to update the table statistics and commit the changes.
Table properties for Iceberg tables.
Definition table_properties.h:40
Represents an Iceberg table.
Definition table.h:41
virtual Result< std::unique_ptr< DataTableScanBuilder > > NewScan() const
Create a new table scan builder for this table.
virtual Result< std::shared_ptr< DeleteFiles > > NewDeleteFiles()
Create a new DeleteFiles to delete data files and commit the changes.
virtual Result< std::shared_ptr< ExpireSnapshots > > NewExpireSnapshots()
Create a new ExpireSnapshots to remove expired snapshots and commit the changes.
virtual Result< std::shared_ptr< RowDelta > > NewRowDelta()
Create a new RowDelta to add rows and row-level deletes.
virtual Result< std::shared_ptr< Transaction > > NewTransaction()
Create a new Transaction to commit multiple table operations at once.
const TableProperties & properties() const
Returns the properties of this table.
virtual Result< std::shared_ptr< FastAppend > > NewFastAppend()
Create a new FastAppend to append data files and commit the changes.
TimePointMs last_updated_ms() const
Returns the time when this table was last updated.
virtual Result< std::shared_ptr< UpdatePartitionStatistics > > NewUpdatePartitionStatistics()
Create a new UpdatePartitionStatistics to update partition statistics and commit the changes.
const std::string & full_name() const
Returns the fully-qualified name of this table.
Definition table.h:65
virtual Result< std::shared_ptr< UpdateSortOrder > > NewUpdateSortOrder()
Create a new UpdateSortOrder to update the table sort order and commit the changes.
Result< std::reference_wrapper< const std::unordered_map< int32_t, std::shared_ptr< PartitionSpec > > > > specs() const
Returns a map of partition specs for this table.
const std::shared_ptr< FileIO > & io() const
Returns a FileIO to read and write table data and metadata files.
virtual Result< std::shared_ptr< RewriteFiles > > NewRewriteFiles()
Create a new RewriteFiles to replace files in this table and commit the changes.
Result< std::reference_wrapper< const std::unordered_map< int32_t, std::shared_ptr< SortOrder > > > > sort_orders() const
Returns a map of sort order IDs to sort orders for this table.
Result< std::shared_ptr< Snapshot > > SnapshotById(int64_t snapshot_id) const
Get the snapshot of this table with the given id.
virtual Result< std::shared_ptr< UpdateStatistics > > NewUpdateStatistics()
Create a new UpdateStatistics to update the table statistics and commit the changes.
virtual Result< std::shared_ptr< UpdateLocation > > NewUpdateLocation()
Create a new UpdateLocation to update the table location and commit the changes.
const std::shared_ptr< TableMetadata > & metadata() const
Returns the current metadata for this table.
virtual Result< std::shared_ptr< OverwriteFiles > > NewOverwrite()
Create a new OverwriteFiles to overwrite data files and commit the changes.
virtual Status Refresh()
Refresh the current table metadata.
std::string_view metadata_file_location() const
Returns the table's metadata file location.
Result< std::reference_wrapper< const std::unordered_map< int32_t, std::shared_ptr< Schema > > > > schemas() const
Returns a map of schema for this table.
const std::string & uuid() const
Returns the UUID of the table.
const TableIdentifier & name() const
Returns the identifier of this table.
Definition table.h:62
Result< std::unique_ptr< LocationProvider > > location_provider() const
Returns a LocationProvider for this table.
std::string_view location() const
Returns the table's base location.
const std::vector< SnapshotLogEntry > & history() const
Get the snapshot history of this table.
Result< std::shared_ptr< SortOrder > > sort_order() const
Returns the sort order for this table, return NotFoundError if not found.
virtual Result< std::shared_ptr< MergeAppend > > NewMergeAppend()
Create a new MergeAppend to append data files and merge manifests.
const std::shared_ptr< MetricsReporter > & reporter() const
Returns the metrics reporter for this table.
Result< std::shared_ptr< Schema > > schema() const
Returns the schema for this table, return NotFoundError if not found.
virtual Result< std::unique_ptr< IncrementalChangelogScanBuilder > > NewIncrementalChangelogScan() const
Create a new incremental changelog scan builder for this table.
virtual Result< std::shared_ptr< UpdatePartitionSpec > > NewUpdatePartitionSpec()
Create a new UpdatePartitionSpec to update the partition spec of this table and commit the changes.
virtual Result< std::shared_ptr< UpdateProperties > > NewUpdateProperties()
Create a new UpdateProperties to update table properties and commit the changes.
virtual Result< std::shared_ptr< SnapshotManager > > NewSnapshotManager()
Create a new SnapshotManager to manage snapshots and snapshot references.
const std::shared_ptr< Catalog > & catalog() const
Returns the catalog that this table belongs to.
virtual Result< std::shared_ptr< UpdateSchema > > NewUpdateSchema()
Create a new UpdateSchema to alter the columns of this table and commit the changes.
Result< std::shared_ptr< PartitionSpec > > spec() const
Returns the partition spec for this table, return NotFoundError if not found.
Result< std::shared_ptr< Snapshot > > current_snapshot() const
Returns the table's current snapshot, return NotFoundError if not found.
static Result< std::shared_ptr< Table > > Make(TableIdentifier identifier, std::shared_ptr< TableMetadata > metadata, std::string metadata_location, std::shared_ptr< FileIO > io, std::shared_ptr< Catalog > catalog, std::string full_name="", std::shared_ptr< MetricsReporter > reporter=nullptr)
Construct a table.
virtual Result< std::unique_ptr< IncrementalAppendScanBuilder > > NewIncrementalAppendScan() const
Create a new incremental append scan builder for this table.
const std::vector< std::shared_ptr< Snapshot > > & snapshots() const
Get the snapshots of this table.
Define symbol visibility macros for core Iceberg APIs.
Core Apache Iceberg C++ APIs.
Definition arrow_io_util.h:33
std::chrono::time_point< std::chrono::system_clock, std::chrono::milliseconds > TimePointMs
A time point in milliseconds.
Definition timepoint.h:33
std::expected< T, E > Result
Result alias.
Definition result.h:88
Define snapshot metadata types.
Identifies a table in iceberg catalog.
Definition table_identifier.h:46
Provide time point conversion helpers.
Updates the table location.