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

API for partition spec evolution. More...

#include <update_partition_spec.h>

Inheritance diagram for iceberg::UpdatePartitionSpec:
iceberg::PendingUpdate iceberg::ErrorCollector

Classes

struct  ApplyResult
 

Public Member Functions

UpdatePartitionSpecCaseSensitive (bool is_case_sensitive)
 Set whether column resolution in the source schema should be case sensitive.
 
UpdatePartitionSpecAddField (std::string_view source_name)
 Add a new partition field from a source column.
 
UpdatePartitionSpecAddField (const std::shared_ptr< Term > &term, std::string_view part_name="")
 Add a new partition field with a custom name.
 
UpdatePartitionSpecRemoveField (std::string_view name)
 Remove a partition field by name.
 
UpdatePartitionSpecRemoveField (const std::shared_ptr< Term > &term)
 Remove a partition field by its source term.
 
UpdatePartitionSpecRenameField (std::string_view name, std::string new_name)
 Rename a field in the partition spec.
 
UpdatePartitionSpecAddNonDefaultSpec ()
 Sets that the new partition spec will NOT be set as the default.
 
Kind kind () const final
 Return the kind of this pending update.
 
bool IsRetryable () const override
 Partition spec updates are not 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< UpdatePartitionSpec > > 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

API for partition spec evolution.

When committing, these changes will be applied to the current table metadata. Commit conflicts will not be resolved and will result in a CommitFailed error.

Member Function Documentation

◆ AddField() [1/2]

UpdatePartitionSpec & iceberg::UpdatePartitionSpec::AddField ( const std::shared_ptr< Term > &  term,
std::string_view  part_name = "" 
)

Add a new partition field with a custom name.

Parameters
termThe term representing the source column, should be unbound.
part_nameName for the partition field.
Returns
Reference to this for method chaining.

◆ AddField() [2/2]

UpdatePartitionSpec & iceberg::UpdatePartitionSpec::AddField ( std::string_view  source_name)

Add a new partition field from a source column.

The partition field will use identity transform on the source column, and use source column name as the partition field name.

Parameters
source_nameSource column name in the table schema.
Returns
Reference to this for method chaining.

◆ AddNonDefaultSpec()

UpdatePartitionSpec & iceberg::UpdatePartitionSpec::AddNonDefaultSpec ( )

Sets that the new partition spec will NOT be set as the default.

The default behavior is to set the new spec as the default partition spec.

Returns
Reference to this for method chaining.

◆ IsRetryable()

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

Partition spec updates are not retryable.

The update caches the current schema/spec state and may allocate or recycle partition field IDs from that base. Replaying after a refresh can change the intended transform bindings or field ID assignment semantics.

Implements iceberg::PendingUpdate.

◆ kind()

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

Return the kind of this pending update.

Implements iceberg::PendingUpdate.

◆ RemoveField() [1/2]

UpdatePartitionSpec & iceberg::UpdatePartitionSpec::RemoveField ( const std::shared_ptr< Term > &  term)

Remove a partition field by its source term.

The partition field with the same transform and source reference will be removed. If the term is a reference and does not have a transform, identity transform is used.

Parameters
termThe term representing the source column, should be unbound.
Returns
Reference to this for method chaining.

◆ RemoveField() [2/2]

UpdatePartitionSpec & iceberg::UpdatePartitionSpec::RemoveField ( std::string_view  name)

Remove a partition field by name.

Parameters
nameName of the partition field to remove.
Returns
Reference to this for method chaining.

◆ RenameField()

UpdatePartitionSpec & iceberg::UpdatePartitionSpec::RenameField ( std::string_view  name,
std::string  new_name 
)

Rename a field in the partition spec.

Parameters
nameName of the partition field to rename.
new_nameReplacement name for the partition field.
Returns
Reference to this for method chaining.

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