iceberg-cpp
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
iceberg::UpdateStatistics Class Reference

Updates table statistics. More...

#include <update_statistics.h>

Inheritance diagram for iceberg::UpdateStatistics:
iceberg::PendingUpdate iceberg::ErrorCollector

Classes

struct  ApplyResult
 

Public Member Functions

UpdateStatisticsSetStatistics (std::shared_ptr< StatisticsFile > statistics_file)
 Set statistics file for a snapshot.
 
UpdateStatisticsRemoveStatistics (int64_t snapshot_id)
 Remove statistics for a snapshot.
 
Kind kind () const final
 Return the kind of this pending update.
 
bool IsRetryable () const override
 Statistics updates are retryable.
 
Result< ApplyResultApply ()
 
- Public Member Functions inherited from iceberg::PendingUpdate
virtual Status Commit ()
 Apply the pending changes and commit.
 
virtual Status Finalize (Result< const TableMetadata * > commit_result)
 Finalize the pending update.
 
 PendingUpdate (const PendingUpdate &)=delete
 
PendingUpdateoperator= (const PendingUpdate &)=delete
 
 PendingUpdate (PendingUpdate &&) noexcept=default
 
PendingUpdateoperator= (PendingUpdate &&) noexcept=default
 
- Public Member Functions inherited from iceberg::ErrorCollector
 ErrorCollector (ErrorCollector &&)=default
 
ErrorCollectoroperator= (ErrorCollector &&)=default
 
 ErrorCollector (const ErrorCollector &)=default
 
ErrorCollectoroperator= (const ErrorCollector &)=default
 
template<typename... Args>
auto & AddError (this auto &self, ErrorKind kind, const std::format_string< Args... > fmt, Args &&... args)
 Add a specific error and return reference to derived class.
 
auto & AddError (this auto &self, Error err)
 Add an existing error object and return reference to derived class.
 
auto & AddError (this auto &self, std::unexpected< Error > err)
 Add an unexpected result's error and return reference to derived class.
 
bool has_errors () const
 Check if any errors have been collected.
 
size_t error_count () const
 Get the number of errors collected.
 
Status CheckErrors () const
 Check for accumulated errors and return them if any exist.
 
void ClearErrors ()
 Clear all accumulated errors.
 
const std::vector< Error > & errors () const
 Get read-only access to all collected errors.
 

Static Public Member Functions

static Result< std::shared_ptr< UpdateStatistics > > Make (std::shared_ptr< TransactionContext > ctx)
 

Additional Inherited Members

- Public Types inherited from iceberg::PendingUpdate
enum class  Kind : uint8_t {
  kExpireSnapshots , kSetSnapshot , kUpdateLocation , kUpdatePartitionSpec ,
  kUpdatePartitionStatistics , kUpdateProperties , kUpdateSchema , kUpdateSnapshot ,
  kUpdateSnapshotReference , kUpdateSortOrder , kUpdateStatistics
}
 
- Protected Member Functions inherited from iceberg::PendingUpdate
 PendingUpdate (std::shared_ptr< TransactionContext > ctx)
 
const TableMetadatabase () const
 
- Protected Attributes inherited from iceberg::PendingUpdate
std::shared_ptr< TransactionContextctx_
 
- Protected Attributes inherited from iceberg::ErrorCollector
std::vector< Errorerrors_
 

Detailed Description

Updates table statistics.

Member Function Documentation

◆ IsRetryable()

bool iceberg::UpdateStatistics::IsRetryable ( ) const
inlineoverridevirtual

Statistics updates are retryable.

The operation is keyed by snapshot ID and only replaces or removes statistics file references, so replaying it after a refresh preserves the caller's intent.

Implements iceberg::PendingUpdate.

◆ kind()

Kind iceberg::UpdateStatistics::kind ( ) const
inlinefinalvirtual

Return the kind of this pending update.

Implements iceberg::PendingUpdate.

◆ RemoveStatistics()

UpdateStatistics & iceberg::UpdateStatistics::RemoveStatistics ( int64_t  snapshot_id)

Remove statistics for a snapshot.

Marks the statistics for the given snapshot ID for removal.

Parameters
snapshot_idThe snapshot ID whose statistics to remove
Returns
Reference to this UpdateStatistics for chaining

◆ SetStatistics()

UpdateStatistics & iceberg::UpdateStatistics::SetStatistics ( std::shared_ptr< StatisticsFile statistics_file)

Set statistics file for a snapshot.

Associates a statistics file with a snapshot ID. If statistics already exist for this snapshot, they will be replaced.

Parameters
statistics_fileThe statistics file to set
Returns
Reference to this UpdateStatistics for chaining

The documentation for this class was generated from the following files: