30#include "iceberg/expression/literal.h"
31#include "iceberg/iceberg_export.h"
32#include "iceberg/result.h"
64 case TransformType::kUnknown:
66 case TransformType::kIdentity:
68 case TransformType::kBucket:
70 case TransformType::kTruncate:
72 case TransformType::kYear:
74 case TransformType::kMonth:
76 case TransformType::kDay:
78 case TransformType::kHour:
80 case TransformType::kVoid:
96 static std::shared_ptr<Transform> Identity();
103 static std::shared_ptr<Transform> Bucket(int32_t num_buckets);
110 static std::shared_ptr<Transform> Truncate(int32_t width);
116 static std::shared_ptr<Transform> Year();
122 static std::shared_ptr<Transform> Month();
128 static std::shared_ptr<Transform> Day();
134 static std::shared_ptr<Transform> Hour();
140 static std::shared_ptr<Transform> Void();
151 Result<std::shared_ptr<TransformFunction>> Bind(
152 const std::shared_ptr<Type>& source_type)
const;
157 bool CanTransform(
const Type& source_type)
const;
160 bool PreservesOrder()
const;
171 bool SatisfiesOrderOf(
const Transform& other)
const;
182 Result<std::unique_ptr<UnboundPredicate>> Project(
183 std::string_view name,
const std::shared_ptr<BoundPredicate>& predicate);
194 Result<std::unique_ptr<UnboundPredicate>> ProjectStrict(
195 std::string_view name,
const std::shared_ptr<BoundPredicate>& predicate);
201 Result<std::string> ToHumanString(
const Literal& value);
204 std::string ToString()
const override;
208 std::string DedupName()
const;
213 Result<std::string> GeneratePartitionName(std::string_view source_name)
const;
217 return lhs.Equals(rhs);
231 [[nodiscard]]
virtual bool Equals(
const Transform& other)
const;
235 std::variant<std::monostate, int32_t> param_;
247ICEBERG_EXPORT Result<std::shared_ptr<Transform>> TransformFromString(
248 std::string_view transform_str);
262 const std::shared_ptr<Type>& source_type()
const;
272 return lhs.Equals(rhs);
280 std::shared_ptr<Type> source_type_;
Literal is a literal value that is associated with a primitive type.
Definition literal.h:39
Interface for a data type for a field.
Definition type.h:44