A partition spec for a Table.
More...
#include <partition_spec.h>
|
|
int32_t | spec_id () const |
| | Get the spec ID.
|
| |
|
std::span< const PartitionField > | fields () const |
| | Get a list view of the partition fields.
|
| |
|
Result< std::unique_ptr< StructType > > | PartitionType (const Schema &schema) const |
| | Get the partition type binding to the input schema.
|
| |
|
Result< std::string > | PartitionPath (const PartitionValues &data) const |
| | Get the partition path for the given partition data.
|
| |
|
bool | CompatibleWith (const PartitionSpec &other) const |
| | Returns true if this spec is equivalent to the other, with partition field ids ignored. That is, if both specs have the same number of fields, field order, field name, source columns, and transforms.
|
| |
| std::string | ToString () const override |
| | Get a user-readable string representation.
|
| |
|
int32_t | last_assigned_field_id () const |
| |
| Status | Validate (const Schema &schema, bool allow_missing_fields) const |
| | Validates the partition spec against a schema.
|
| |
|
Result< std::vector< PartitionFieldRef > > | GetFieldsBySourceId (int32_t source_id) const |
| |
|
|
static constexpr int32_t | kInitialSpecId = 0 |
| |
|
static constexpr int32_t | kLegacyPartitionDataIdStart = 1000 |
| | The start ID for partition field. It is only used to generate partition field id for v1 metadata where it is tracked.
|
| |
|
static constexpr int32_t | kInvalidPartitionFieldId = -1 |
| |
A partition spec for a Table.
A partition spec is a list of partition fields, along with a unique integer ID. A Table may have different partition specs over its lifetime due to partition spec evolution.
◆ PartitionFieldRef
Get the partition fields by source ID.
- Parameters
-
| source_id | The id of the source field. |
- Returns
- The partition fields by source ID, or NotFound if the source field is not found.
◆ Make() [1/2]
| Result< std::unique_ptr< PartitionSpec > > iceberg::PartitionSpec::Make |
( |
const Schema & |
schema, |
|
|
int32_t |
spec_id, |
|
|
std::vector< PartitionField > |
fields, |
|
|
bool |
allow_missing_fields, |
|
|
std::optional< int32_t > |
last_assigned_field_id = std::nullopt |
|
) |
| |
|
static |
Create a PartitionSpec binding to a schema.
- Parameters
-
| schema | The schema to bind the partition spec to. |
| spec_id | The spec ID. |
| fields | The partition fields. |
| allowMissingFields | Whether to skip validation for partition fields whose source columns have been dropped from the schema. |
| last_assigned_field_id | The last assigned field ID assigned to ensure new fields get unique IDs. |
- Returns
- A Result containing the partition spec or an error.
◆ Make() [2/2]
| Result< std::unique_ptr< PartitionSpec > > iceberg::PartitionSpec::Make |
( |
int32_t |
spec_id, |
|
|
std::vector< PartitionField > |
fields, |
|
|
std::optional< int32_t > |
last_assigned_field_id = std::nullopt |
|
) |
| |
|
static |
Create a PartitionSpec without binding to a schema.
- Parameters
-
| spec_id | The spec ID. |
| fields | The partition fields. |
| last_assigned_field_id | The last assigned field ID assigned to ensure new fields get unique IDs. |
- Returns
- A Result containing the partition spec or an error.
- Note
- This method does not check whether the sort fields are valid for any schema.
◆ ToString()
| std::string iceberg::PartitionSpec::ToString |
( |
| ) |
const |
|
overridevirtual |
◆ Validate()
| Status iceberg::PartitionSpec::Validate |
( |
const Schema & |
schema, |
|
|
bool |
allow_missing_fields |
|
) |
| const |
Validates the partition spec against a schema.
- Parameters
-
| schema | The schema to validate against. |
| allow_missing_fields | Whether to skip validation for partition fields whose source columns have been dropped from the schema. |
- Returns
- Error status if the partition spec is invalid.
The documentation for this class was generated from the following files: