Represents a transform used in partitioning or sorting in Iceberg.
More...
#include <transform.h>
|
|
TransformType | transform_type () const |
| | Returns the transform type.
|
| |
| Result< std::shared_ptr< TransformFunction > > | Bind (const std::shared_ptr< Type > &source_type) const |
| | Binds this transform to a source type, returning a typed TransformFunction.
|
| |
| bool | CanTransform (const Type &source_type) const |
| | Checks whether this function can be applied to the given Type.
|
| |
|
bool | PreservesOrder () const |
| | Whether the transform preserves the order of values (is monotonic).
|
| |
| bool | SatisfiesOrderOf (const Transform &other) const |
| | Whether ordering by this transform's result satisfies the ordering of another transform's result.
|
| |
| Result< std::unique_ptr< UnboundPredicate > > | Project (std::string_view name, const std::shared_ptr< BoundPredicate > &predicate) |
| | Transforms a BoundPredicate to an inclusive predicate on the partition values produced by the transform.
|
| |
| Result< std::unique_ptr< UnboundPredicate > > | ProjectStrict (std::string_view name, const std::shared_ptr< BoundPredicate > &predicate) |
| | Transforms a BoundPredicate to a strict predicate on the partition values produced by the transform.
|
| |
| Result< std::string > | ToHumanString (const Literal &value) |
| | Returns a human-readable string representation of a transformed value.
|
| |
| std::string | ToString () const override |
| | Returns a string representation of this transform (e.g., "bucket[16]").
|
| |
|
std::string | DedupName () const |
| | Return the unique transform name to check if similar transforms for the same source field are added multiple times in partition spec builder.
|
| |
| Result< std::string > | GeneratePartitionName (std::string_view source_name) const |
| | Generates a partition name for the transform.
|
| |
|
| static std::shared_ptr< Transform > | Identity () |
| | Returns a shared singleton instance of the Identity transform.
|
| |
| static std::shared_ptr< Transform > | Bucket (int32_t num_buckets) |
| | Creates a shared instance of the Bucket transform.
|
| |
| static std::shared_ptr< Transform > | Truncate (int32_t width) |
| | Creates a shared instance of the Truncate transform.
|
| |
| static std::shared_ptr< Transform > | Year () |
| | Creates a shared singleton instance of the Year transform.
|
| |
| static std::shared_ptr< Transform > | Month () |
| | Creates a shared singleton instance of the Month transform.
|
| |
| static std::shared_ptr< Transform > | Day () |
| | Creates a shared singleton instance of the Day transform.
|
| |
| static std::shared_ptr< Transform > | Hour () |
| | Creates a shared singleton instance of the Hour transform.
|
| |
| static std::shared_ptr< Transform > | Void () |
| | Creates a shared singleton instance of the Void transform.
|
| |
Represents a transform used in partitioning or sorting in Iceberg.
This class supports binding to a source type and instantiating the corresponding TransformFunction, as well as serialization-friendly introspection.
◆ Bind()
| Result< std::shared_ptr< TransformFunction > > iceberg::Transform::Bind |
( |
const std::shared_ptr< Type > & |
source_type | ) |
const |
Binds this transform to a source type, returning a typed TransformFunction.
This creates a concrete transform implementation based on the transform type and parameter.
- Parameters
-
| source_type | The source column type to bind to. |
- Returns
- A TransformFunction instance wrapped in
expected, or an error on failure.
◆ Bucket()
| std::shared_ptr< Transform > iceberg::Transform::Bucket |
( |
int32_t |
num_buckets | ) |
|
|
static |
Creates a shared instance of the Bucket transform.
Buckets values using a hash modulo operation. Commonly used for distributing data.
- Parameters
-
| num_buckets | The number of buckets. |
- Returns
- A shared pointer to the Bucket transform.
◆ CanTransform()
| bool iceberg::Transform::CanTransform |
( |
const Type & |
source_type | ) |
const |
Checks whether this function can be applied to the given Type.
- Parameters
-
| source_type | The source type to check. |
- Returns
- true if this transform can be applied to the type, false otherwise
◆ Day()
| std::shared_ptr< Transform > iceberg::Transform::Day |
( |
| ) |
|
|
static |
Creates a shared singleton instance of the Day transform.
Extracts the number of days from a date or timestamp since the epoch.
- Returns
- A shared pointer to the Day transform.
◆ GeneratePartitionName()
| Result< std::string > iceberg::Transform::GeneratePartitionName |
( |
std::string_view |
source_name | ) |
const |
Generates a partition name for the transform.
- Parameters
-
| source_name | The name of the source column. |
- Returns
- A string representation of the partition name.
◆ Hour()
| std::shared_ptr< Transform > iceberg::Transform::Hour |
( |
| ) |
|
|
static |
Creates a shared singleton instance of the Hour transform.
Extracts the number of hours from a timestamp since the epoch.
- Returns
- A shared pointer to the Hour transform.
◆ Identity()
| std::shared_ptr< Transform > iceberg::Transform::Identity |
( |
| ) |
|
|
static |
Returns a shared singleton instance of the Identity transform.
This transform leaves values unchanged and is commonly used for direct partitioning.
- Returns
- A shared pointer to the Identity transform.
◆ Month()
| std::shared_ptr< Transform > iceberg::Transform::Month |
( |
| ) |
|
|
static |
Creates a shared singleton instance of the Month transform.
Extracts the number of months from a date or timestamp since the epoch.
- Returns
- A shared pointer to the Month transform.
◆ Project()
| Result< std::unique_ptr< UnboundPredicate > > iceberg::Transform::Project |
( |
std::string_view |
name, |
|
|
const std::shared_ptr< BoundPredicate > & |
predicate |
|
) |
| |
Transforms a BoundPredicate to an inclusive predicate on the partition values produced by the transform.
This inclusive transform guarantees that if predicate->Test(value) is true, then Projected(transform(value)) is true.
- Parameters
-
| name | The name of the partition column. |
| predicate | The predicate to project. |
- Returns
- A Result containing either a unique pointer to the projected predicate, nullptr if the projection cannot be performed, or an Error if the projection fails.
◆ ProjectStrict()
| Result< std::unique_ptr< UnboundPredicate > > iceberg::Transform::ProjectStrict |
( |
std::string_view |
name, |
|
|
const std::shared_ptr< BoundPredicate > & |
predicate |
|
) |
| |
Transforms a BoundPredicate to a strict predicate on the partition values produced by the transform.
This strict transform guarantees that if Projected(transform(value)) is true, then predicate->Test(value) is also true.
- Parameters
-
| name | The name of the partition column. |
| predicate | The predicate to project. |
- Returns
- A Result containing either a unique pointer to the projected predicate, nullptr if the projection cannot be performed, or an Error if the projection fails.
◆ SatisfiesOrderOf()
| bool iceberg::Transform::SatisfiesOrderOf |
( |
const Transform & |
other | ) |
const |
Whether ordering by this transform's result satisfies the ordering of another transform's result.
For example, sorting by day(ts) will produce an ordering that is also by month(ts) or year(ts). However, sorting by day(ts) will not satisfy the order of hour(ts) or identity(ts).
- Parameters
-
| other | The other transform to compare with. |
- Returns
- true if ordering by this transform is equivalent to ordering by the other transform.
◆ ToHumanString()
| Result< std::string > iceberg::Transform::ToHumanString |
( |
const Literal & |
value | ) |
|
Returns a human-readable string representation of a transformed value.
- Parameters
-
| value | The literal value to be transformed. |
- Returns
- A human-readable string representation of the value
◆ ToString()
| std::string iceberg::Transform::ToString |
( |
| ) |
const |
|
overridevirtual |
◆ Truncate()
| std::shared_ptr< Transform > iceberg::Transform::Truncate |
( |
int32_t |
width | ) |
|
|
static |
Creates a shared instance of the Truncate transform.
Truncates values to a fixed width (e.g., for strings or binary data).
- Parameters
-
| width | The width to truncate to. |
- Returns
- A shared pointer to the Truncate transform.
◆ Void()
| std::shared_ptr< Transform > iceberg::Transform::Void |
( |
| ) |
|
|
static |
Creates a shared singleton instance of the Void transform.
Ignores values and always returns null. Useful for testing or special cases.
- Returns
- A shared pointer to the Void transform.
◆ Year()
| std::shared_ptr< Transform > iceberg::Transform::Year |
( |
| ) |
|
|
static |
Creates a shared singleton instance of the Year transform.
Extracts the number of years from a date or timestamp since the epoch.
- Returns
- A shared pointer to the Year transform.
The documentation for this class was generated from the following files: